> 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/post-exploitation/alternate-data-streams-ads.md).

# Flujos de datos alternativos (ADS)

> Los flujos de datos alternativos (ADS) son una característica de **NTFS** sistemas de archivos en Windows que permite asociar múltiples flujos de datos a un solo archivo. Estos flujos adicionales pueden contener información oculta que no es visible durante la inspección tradicional del archivo. Aprovecharemos esta funcionalidad para descubrir el **bandera root**.

Los atacantes y pentesters pueden usar ADS para:

\***Ocultar archivos maliciosos** (por ejemplo: un ejecutable oculto en un archivo de texto). \***Evitar la detección por parte del antivirus** y de ciertas herramientas de seguridad. \***Mantener la persistencia** en una máquina comprometida.

**Ejemplo con Bloc de notas**:

```sh
notepad test.txt:secret.txt
```

Aquí, `secret.txt` es un archivo oculto adjunto a `test.txt`.

Los archivos ocultos no son visibles con `dir`, pero puedes listarlos con:

```sh
dir /r
```

<figure><img src="/files/474cd198b0dca02ea782a33e46eaf6dbaedd2b4b" alt=""><figcaption></figcaption></figure>

**Otro ejemplo: inyección de un ejecutable en un ADS**:

```bash
type payload.exe > windowslog.txt:winpeas.txt
```

Esto inserta `payload.exe` en el flujo alternativo `winpeas.txt` adjunto a `windowslog.txt`.

**Ejecución del archivo oculto**:

```sh
start windowslog.txt:winpeas.exe
```

Esto ejecuta `winpeas.exe`, aunque esté oculto en un ADS.

**Creación de un enlace simbólico para la ejecución oculta**

Se puede usar un enlace simbólico para engañar a un usuario y hacer que ejecute un binario oculto.

**Ejemplo**:

```sh
mklink wupadate.exe C:/Temp/windowslog.txt:winpeas.exe
```

Este enlace simbólico `wupdate.exe` apunta al archivo ADS oculto.

```bash
wupdate 
```

Si un usuario escribe `wupdate`, `winpeas.exe` el programa se ejecutará.

<figure><img src="/files/0893810cab1d242f260263220085d72b94b979df" alt=""><figcaption></figcaption></figure>

### **Visualización del contenido de ADS**

<figure><img src="/files/3d450383641413b5dd7cb59de08aa0f468925c12" alt=""><figcaption></figcaption></figure>

#### **1. Comprobación de flujos de datos alternativos (ADS)**

Comprueba si el **hm.txt** archivo del **Administrator** escritorio contiene flujos de datos alternativos. Usa el siguiente comando:

```bash
dir /r C:/Users/Administrator/Desktop/hm.txt
```

Este comando enumera todos los flujos de datos alternativos asociados con el **hm.txt** archivo. Si hay un flujo de datos alternativo presente, se mostrará.

<figure><img src="/files/586eb01094d1495dcc8295347f1a80d615d45d1c" alt=""><figcaption></figcaption></figure>

#### **2. Visualización del contenido de un flujo de datos alternativo**

Si encontramos un flujo de datos alternativo asociado con el archivo, nuestras opciones están contenidas en el siguiente comando:

```powershell
more < C:/Users/Administrator/Desktop/hm.txt:root.txt
```

Esto nos permite leer el contenido del **root.txt** flujo y recuperar la **bandera root :)**

<figure><img src="/files/ad5380ca1539aafd0b0dc46d5fecdc4b2765f322" 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/post-exploitation/alternate-data-streams-ads.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.
