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

# Альтернативные потоки данных (ADS)

> Альтернативные потоки данных (ADS) — это функция **NTFS** файловых систем Windows, которая позволяет связывать с одним файлом несколько потоков данных. Эти дополнительные потоки могут содержать скрытую информацию, не видимую при обычном просмотре файла. Мы воспользуемся этой функцией, чтобы обнаружить **флаг root**.

Злоумышленники и пентестеры могут использовать ADS, чтобы:

\***Скрывать вредоносные файлы** (например: исполняемый файл, скрытый в текстовом файле). \***Избегать обнаружения антивирусом** и некоторыми средствами безопасности. \***Обеспечивать устойчивое присутствие** на скомпрометированном компьютере.

**Пример с Блокнотом**:

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

Здесь, `secret.txt` — это скрытый файл, прикрепленный к `test.txt`.

Скрытые файлы не видны с помощью `dir`, но их можно вывести с помощью:

```sh
dir /r
```

<figure><img src="/files/482579872c63db2fc9ffa69abe6917b263d7c8ef" alt=""><figcaption></figcaption></figure>

**Еще один пример: внедрение исполняемого файла в ADS**:

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

Это вставляет `payload.exe` в альтернативный поток `winpeas.txt` прикрепленный к `windowslog.txt`.

**Выполнение скрытого файла**:

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

Это запускает `winpeas.exe`, хотя он скрыт в ADS.

**Создание символической ссылки для скрытого выполнения**

Символическую ссылку можно использовать, чтобы заставить пользователя запустить скрытый двоичный файл.

**Пример**:

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

Эта символическая ссылка `wupdate.exe` указывает на скрытый файл ADS.

```bash
wupdate 
```

Если пользователь введет `wupdate`, то `winpeas.exe` программа запустится.

<figure><img src="/files/9cc3903288ee83b80878e62338b406dc79780658" alt=""><figcaption></figcaption></figure>

### **Просмотр содержимого ADS**

<figure><img src="/files/85cf08a953b4dd58a0ac9882bc5963b584bacf71" alt=""><figcaption></figcaption></figure>

#### **1. Проверка альтернативных потоков данных (ADS)**

Проверьте, содержит ли **hm.txt** файл на **Administrator** рабочем столе альтернативные потоки данных. Используйте следующую команду:

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

Эта команда выводит все альтернативные потоки данных, связанные с **hm.txt** файлом. Если альтернативный поток данных присутствует, он будет отображен.

<figure><img src="/files/3451c24b3d1429c28241e032346424bf34e645ae" alt=""><figcaption></figcaption></figure>

#### **2. Просмотр содержимого альтернативного потока данных**

Если мы обнаружим альтернативный поток, связанный с файлом, мы можем воспользоваться следующей командой:

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

Это позволяет нам прочитать содержимое **root.txt** потока и получить **root-флаг:)**

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