> 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/permissions/etc-passwd-write-abuse-linux-privilege-escalation.md).

# Abuso de escrita em /etc/passwd - Escalada de privilégios no Linux

## O que é

A escalada de privilégios baseada em permissões explora arquivos graváveis, propriedade fraca, segredos expostos ou caminhos sensíveis que deveriam ser controlados apenas pelo root. Pequenos erros de permissão podem se tornar acesso root direto quando afetam arquivos de autenticação ou caminhos de execução privilegiados. Esta página específica foca em **Gerenciamento de permissões (/etc/passwd)** 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 / -writable 2>/dev/null
ls -la /etc/passwd /etc/shadow 2>/dev/null
```

## Exemplos

Se filtrarmos os arquivos pela \*\*gravabilidade\*\* do sistema, então o /etc/passwd

```bash
find / -writable 2>/dev/null
```

<figure><img src="/files/2bfb8200a9cd85bb6a96470e272a6f5735ae85cd" alt=""><figcaption></figcaption></figure>

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

Com **openssl**, se criarmos uma senha, ele a retorna no formato SSL

```bash
openssl passwd
```

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

Colamos essa string no usuário root e o sistema a lerá de /etc/passwd antes de /etc/shadow:

<figure><img src="/files/77c8beb61f5ffc4dd0f08cabb2bbc83bb6faef59" 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/permissions/etc-passwd-write-abuse-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.
