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

# Abuso de escritura en /etc/passwd - Escalada de privilegios en Linux

## Qué es

La escalada de privilegios basada en permisos abusa de archivos escribibles, propiedad débil, secretos expuestos o rutas sensibles que solo deberían estar controladas por root. Pequeños errores de permisos pueden convertirse en acceso directo de root cuando afectan archivos de autenticación o rutas de ejecución privilegiadas. Esta página específica se centra en **Gestión de permisos (/etc/passwd)** y mantiene práctico el flujo de explotación: identificar la condición, validarla de forma segura y luego ejecutar la carga útil mínima necesaria para demostrar el impacto.

## Enumeración

Comienza confirmando el contexto local y la configuración incorrecta exacta antes de ejecutar la ruta de explotación.

```bash
find / -writable 2>/dev/null
ls -la /etc/passwd /etc/shadow 2>/dev/null
```

## Ejemplos

Si filtramos los archivos por la \*\*escribibilidad\*\* del sistema, entonces el /etc/passwd

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

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

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

Con **openssl**, si creamos una contraseña, la devuelve en formato SSL

```bash
openssl passwd
```

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

Pegamos esta cadena en el usuario root y el sistema la leerá de /etc/passwd antes que de /etc/shadow:

<figure><img src="/files/bce4704794beeaeb399673183c6d1a5bb3bf0bd8" 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/es/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.
