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

# تقرير HackTheBox عن Mirai

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

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

* تحديد جهاز إنترنت الأشياء
* استعادة ملف جنائي
  {% endhint %}

## الاستطلاع

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

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

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

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

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

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

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

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

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

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

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

استخدم دالة extractPorts لعرض المنافذ المفتوحة بتنسيق مختصر ونسخها إلى الحافظة (22,53,80,1178,32400,32469)

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

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

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

```bash
nmap -sCV -p22,53,80,1178,32400,32469 10.10.10.48 -oN targeted
```

<figure><img src="/files/4405b478be2441583ab9ad8a04e423c0474174e4" alt=""><figcaption></figcaption></figure>

## المنفذ 80 - Pi-hole

عند فحص المنفذ 80، لا تكشف أداة Wappalyzer عن أي معلومات مهمة.

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

ومع ذلك، بعد إجراء بعض الفَزّينغ، نكتشف دليلًا "`admin`"مرتبطًا بـ Pi-hole، ويحتوي على لوحة تسجيل دخول.

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

ثم نبحث في الإنترنت عن بيانات الاعتماد الافتراضية ونجد المعلومات التالية:

* **المستخدم:** pi
* **كلمة المرور:** raspberry

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

نحاول الاتصال عبر SSH لأن المنفذ 22 مفتوح:

```bash
ssh pi@10.10.10.48
```

تم الاتصال بنجاح.

<figure><img src="/files/22c47cd015828f369dda99b4c79cce8e02969f6e" alt=""><figcaption></figcaption></figure>

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

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

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

**مجموعة sudo:** عند فحص مجموعات المستخدمين، نرى أن المستخدم "pi" ينتمي إلى مجموعة sudo. وبما أننا نعرف كلمة مروره بالفعل، يمكننا الحصول على صلاحيات root.

```bash
المعرّف
```

<figure><img src="/files/67f2d918debd4fc773670d25b8babc40143333d4" alt=""><figcaption></figcaption></figure>

بعد ذلك، ننفذ `sudo su` ونُدخل كلمة المرور للمستخدم "pi":

```bash
sudo su
```

### العلم root.txt

**استعادة ملف root.txt:** يخبرنا المهاجم أنه فقد `root.txt` الملف وأن علينا البحث عنه في نسخة احتياطية على ذاكرة USB.

<figure><img src="/files/4154d700b8ff83a3e5078d4604f5d4eab469fc8e" alt=""><figcaption></figcaption></figure>

نبحث عن أجهزة USB المتصلة ونجد `/dev/sdb` قرص

```bash
df -h 
```

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

عند محاولة قراءة هذا القرص مباشرةً، تكون البيانات غير قابلة للقراءة. ومع ذلك، بعد استخدام `strings` الأمر، نتمكن من استعادة معلومات قابلة للقراءة من الجهاز:

<figure><img src="/files/4531d099278c82dd0a74adeef762bec81e1cac1c" alt=""><figcaption></figcaption></figure>

```bash
strings /dev/sdb
```

<figure><img src="/files/43af0f7704c7dc3716301329d7cd13d81d487025" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/7e3b8c162a4d72196e6b9bba8b4fabb19696f4b3" alt="" width="530"><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/mirai-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.
