> 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/linux-easy/underpass-hackthebox-writeup.md).

# شرح Underpass HackTheBox

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

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

* تعداد UDP
* بيانات الاعتماد الافتراضية (DaloRADIUS)
* كسر كلمات المرور
* تصعيد الصلاحيات عبر SUDO (mosh-server)
  {% endhint %}

## الاستطلاع

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

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

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

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

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

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

### TCP

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

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

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

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

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

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

```bash
nmap -sCV -p22,80 10.10.11.48 -oN targeted
```

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

### UDP

**فحص منافذ UDP الأكثر استخدامًا:**

نقوم بإجراء فحص لأكثر 100 منفذ UDP شيوعًا:

```bash
nmap -sU --top-ports 100 --open -vvv -n 10.10.11.48 -oG allPortsUDP
```

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

* المنافذ المحددة: **161, 1812, 1813**.

<figure><img src="/files/80d7adf7d1cad26ee633c61092f66e9afc5a8ec5" alt=""><figcaption></figcaption></figure>

**فحص إصدارات خدمات UDP:**/ نستهدف المنافذ المحددة للحصول على معلومات إضافية:

```bash
nmap -sUCV -p161,1812,1813 10.10.11.48 -oN targetedUDP
```

<figure><img src="/files/23f352b1e16a2b90ecf51fd918b268b461c0ae2e" alt=""><figcaption></figcaption></figure>

**ملاحظة أولية :**

* النطاق **underpass.htb** يتم اكتشافه.
* يوجد نظام إدارة محتوى يسمى **DaloRADIUS** تم تحديده.

## CMS - **DaloRADIUS**

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

**فحص الأدلة باستخدام Gobuster:**/ نستكشف أدلة الموقع:

```bash
gobuster dir -u http://underpass.htb/daloradius/ -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 100
```

النتيجة: دليل باسم **`/app`** يتم اكتشافه.

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

**قائمة الأدلة الفرعية:**<br>

من خلال استكشاف **`/app`**، نجد:

```bash
gobuster dir -u http://underpass.htb/daloradius/app/ -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 100
```

<figure><img src="/files/996cd51dee3ac0a1c1a73c093841d23ca9959a94" alt=""><figcaption></figcaption></figure>

* ملف **صفحة تسجيل دخول للمستخدمين**.

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

* ملف **صفحة تسجيل دخول للمشغلين**.

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

**الوصول باستخدام بيانات الاعتماد الافتراضية لـ DaloRADIUS:**/ من خلال اختبار بيانات الاعتماد الافتراضية لـ RADIUS:

* **اسم المستخدم:** `administrator`
* **كلمة المرور:** `radius`/ تعمل هذه البيانات على لوحة المشغل.

<figure><img src="/files/35970e2e683331a42ff2dd8789775f4b0567e4c9" alt=""><figcaption></figcaption></figure>

### **استخراج المعلومات الحساسة:**

في **الإدارة** في هذا القسم نجد **اسم المستخدم** و **تجزئة كلمة مرور**:

* **المستخدم:** `svcMosh`
* **التجزئة :** `412DD4759978ACFCC81DEAB01B382403`

<figure><img src="/files/56a2b657987d12cd0627f2bfeab2d2aa10e17396" alt=""><figcaption></figcaption></figure>

### **كسر التجزئة:**<br>

نستخدم **CrackStation** لفك تجزئة الهاش:

{% embed url="<https://crackstation.net/>" %}

**كلمة المرور المفككة:** `underwaterfriends`

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

**اتصال SSH:**/ باستخدام هذه البيانات، نصل إلى الجهاز عبر SSH:

```bash
ssh svcMosh@underpass.htb

underwaterfriends
```

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

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

### SUDO - Mosh-Server

من خلال التحقق من الأذونات باستخدام `sudo -l` الأمر، نكتشف أن المستخدم **svcMosh** يمكنه تشغيل **mosh-server** الثنائي بصلاحيات المدير دون إدخال كلمة مرور

```bash
sudo -l
```

<figure><img src="/files/953edd35f0ad9a41251d5bc6571f729e91653102" alt=""><figcaption></figcaption></figure>

> بما أنه لديك خيار تشغيل **mosh-server** بصلاحيات root، يمكنك استغلال ذلك لإنشاء اتصال مع **mosh** باستخدام **sudo** لتشغيل الخادم كمدير.

سيقوم الأمر التالي بتشغيل **mosh-server** بصلاحيات root، ثم إنشاء اتصال مع **mosh** العميل:

```bash
mosh --server="sudo /usr/bin/mosh-server" localhost
```

سيسمح هذا لـ **mosh** بالاتصال بالخادم **mosh-server** الذي يعمل بصلاحيات root على **localhost**. باستخدام هذه الطريقة ستحصل على وصول مميز إلى الجهاز بصلاحيات المدير.

<figure><img src="/files/92ee9286ff755915db2ea570051bb2f4f117e3d2" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/c9aceb0ca10d131ee4520eb6bef983b6fc80e628" alt="" width="547"><figcaption></figcaption></figure>

<figure><img src="/files/06adb4ca6da9d82aa1c7d294ea25970f373879c1" alt="" width="522"><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/linux-easy/underpass-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.
