Skip to content
Py Mu PDF Issues 5173

Py Mu PDF Issues 5173

github.com • November 3, 2026

The out-of-bounds stack write in JM_set_annot_callout_line() is exploitable for arbitrary code execution , not only a crash, and every released version is affected — the bounds check added in d4298ead8 is on main only and has never shipped. The latest release on PyPI, 1.28.2 (uploaded 2026-08-06) , predates that commit by a month, so pip install -U pymupdf does not remediate this.

Page.add_freetext_annot(..., callout=...) forwards len(callout) with no length validation, so a sequence longer than three points writes past the array and over the saved frame.

Stock PyPI wheel, nothing rebuilt — PyMuPDF==1.28.2 , CPython 3.14, x86-64 Linux, clean venv:

3 points returns normally. 64 points terminates with SIGSEGV (exit 139).

Why this is code execution, not just a crash

Under gdb the fault is at the ret , with the saved frame already attacker-controlled:

That is control of the saved return address. Three properties make it reachable:

No stack protector on the shipped binary. checksec against the _extra.so inside the published wheel reports No canary found , and readelf -sW … | grep -c __stack_chk_fail returns 0 . The overwrite is not detected on return.

MuPDF does not raise. pdf_set_annot_callout_line() acts only for point counts of two or three; for any other count it removes the /CL entry and returns without fz_throw , so the wrapper returns normally — through the overwritten address.

The overwritten words are chosen. JM_point_from_py 's float clamp restricts which dwords survive, which narrows gadget selection but does not prevent building a chain. I have a working chain that reaches PyRun_SimpleString in the no-PIE CPython; I am not publishing it here while no fixed release exists. Happy to it privately with the maintainers.

CVSS v3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H (8.8 High); PR:N → 9.8 Critical where the input reaching the parameter is unauthenticated. CWE-787 / CWE-121 via CWE-1284 .

Can a release be cut carrying the fix? Users currently have no remediation path at all.

Would you publish a GitHub Security Advisory for it? There is no CVE and no OSV record, so dependency scanners and SBOM tooling cannot see this at all. A GHSA assigns a CVE through GitHub's CNA and gives downstream consumers something to act on.

Happy to supply the full reproducer, the gdb transcript, or to review a draft advisory.

julian-smith-artifex-com closed this as completed on Oct 21, 2026

Extracted Entities

Attack Types (1)

Platforms (1)

Tools (1)