> 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/zh/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/dca4f2adb7ec6044c7e0d7dd709ca2c16590196a" 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/b490205aec899876cebdfa6562f39e5c5e9830aa" alt=""><figcaption></figcaption></figure>

### **查看 ADS 内容**

<figure><img src="/files/916df840ae08c2d42766c7ea4b9e1a19596cc2f8" alt=""><figcaption></figcaption></figure>

#### **1. 检查替代数据流（ADS）**

检查 **hm.txt** 文件在 **Administrator** 桌面上是否包含替代数据流。使用以下命令：

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

此命令会列出与该 **hm.txt** 文件相关联的所有替代数据流。如果存在替代数据流，它将被显示。

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

#### **2. 查看替代数据流的内容**

如果我们找到与该文件相关联的替代资源流，可以使用以下命令查看其内容：

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

这使我们能够读取 **root.txt** 该流的内容并获取 **root flag：)**

<figure><img src="/files/48d55a6638521ca9ffc4fc31ceb61c1b2d122c27" 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/zh/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.
