Skip to content

Can a Malicious PDF Crash Software? The pypdf and PDF.js Flaws

  • pdf
  • security
  • vulnerability
  • repair

Yes, a specially crafted PDF can crash or freeze software that reads it, and two advisories from this autumn show how. A pypdf flaw (CVE-2026-119204) can exhaust memory, and a PDF.js flaw (CVE-2026-16633) can run script in a web page. Updating the library or app is the real fix.

What is the pypdf vulnerability CVE-2026-119204?

pypdf is a widely used open-source Python library that reads and edits PDF files. Its maintainers published an advisory on 28 October 2026 for CVE-2026-119204. A PDF built with a page tree that shares many resources can make pypdf use a very large amount of memory while parsing it.

The advisory classes the problem as uncontrolled resource consumption (CWE-400) and rates it Moderate. Every pypdf release before 6.21.4 is affected, and 6.21.4 and later contain the fix. If you cannot upgrade at once, the advisory points to the changes in pull request #4290 as a workaround.

Several other pypdf advisories appeared in the same days, mostly about long run times or heavy memory use on crafted files. Third-party databases score them differently, so read the maintainers' own advisory for the exact rating and version.

Does this mean my PDF viewer or tools are at risk?

Only if they use the affected code. This is a denial-of-service issue: the worst outcome is that a program stalls, runs out of memory or crashes while opening one hostile file. The advisory does not describe stolen data or code running on your machine.

The people who need to act are developers and server operators who run pypdf on files they did not create, for example an app that accepts uploaded PDFs. An ordinary reader opening a file in a desktop viewer is not running pypdf at all.

What is the PDF.js vulnerability CVE-2026-16633?

PDF.js is the JavaScript engine that many websites use to show PDFs inside a page. The advisory for CVE-2026-16633 was published on 28 July 2026 and carries a High rating (CVSS v4 score 8.6). Versions of the pdfjs-dist package from 5.6.83 up to, but not including, 6.2.108 are affected.

If PDF.js loads a malicious file while its enableScripting option is true, which is the default, and the site has no Content Security Policy limiting scripts, the attacker's JavaScript runs in the context of the hosting site. The fix is version 6.2.108. The listed workarounds are to set enableScripting to false or to apply a Content Security Policy that restricts script-src.

How do I protect myself when opening PDFs?

You cannot judge a file by its icon, so combine a few habits:

  1. Keep your PDF viewer, browser and operating system on automatic updates.
  2. Do not open PDFs from senders you do not know, and be wary of "receipt" or "invoice" attachments you did not expect.
  3. If a file hangs or crashes your viewer, do not keep retrying it on the same machine. Treat it as suspect.
  4. If a PDF is yours but will not open, try Repair PDF to rebuild a damaged file. It runs in your browser and does not upload the document.
  5. If you only need some pages from a large file, use Split PDF to pull them out instead of passing the whole file around.

Repairing or splitting a file is not a security scan. It will not tell you whether a PDF is hostile, and a file you do not trust should be left unopened.

What should developers who handle uploaded PDFs do?

If you maintain software that parses PDFs, treat every uploaded file as untrusted input. The two advisories point to the same short list:

LayerActionWhy
DependenciesUpgrade pypdf to 6.21.4 or laterFixes CVE-2026-119204
DependenciesUpgrade pdfjs-dist to 6.2.108 or laterFixes CVE-2026-16633
Browser viewerSet enableScripting to false or add a script-restricting CSPStops script in a PDF running on your domain
Server jobsLimit memory, CPU time and file size per parseContains resource-exhaustion files
PipelineParse in a separate worker or processA crash then affects one job, not your app

Resource limits matter even after patching, because the next parser bug is likely to look similar. Limits turn a possible outage into a failed job.

How does ilovspdfs handle files?

The free tools on ilovspdfs process a file in your browser, in a Web Worker, and never upload it. Files up to 100 MB are accepted, with no account and no watermark. A bad file can still stall a browser tab, but it stays on your device rather than reaching a shared server. The Pro conversion tools send files over HTTPS, process them in memory and store nothing, with a 4 MB upload cap.

Key facts

  • CVE-2026-119204 in pypdf was published on 28 October 2026 and is rated Moderate by the maintainers.
  • pypdf versions below 6.21.4 are affected, and 6.21.4 is the first fixed release.
  • CVE-2026-16633 in PDF.js was published on 28 July 2026 with a CVSS v4 score of 8.6.
  • PDF.js (pdfjs-dist) versions 5.6.83 up to but not including 6.2.108 are affected.
  • The PDF.js risk applies when enableScripting is true, its default, and no script-restricting CSP is in place.
  • The pypdf flaw is a denial-of-service issue (CWE-400), not a code-execution flaw.

Frequently asked questions

Can opening a PDF crash my computer?

A crafted PDF can make a vulnerable program use huge amounts of memory or hang, which may freeze that program or, on a small machine, slow everything down. Closing the program normally ends the problem. Keeping your viewer updated reduces the risk.

Do I need to update pypdf if I never wrote any Python?

Probably not directly. pypdf is a library, so it only matters if software you run uses it. Check the update notes of any Python-based PDF tool you have installed, such as command-line utilities that bundle it.

Is the PDF.js flaw a risk when I view a PDF in my browser?

The advisory concerns websites that embed the pdfjs-dist package without updating it or restricting scripts. Browsers ship their own PDF viewers that update with the browser, so updating the browser is the step to take.

Does repairing a PDF make it safe?

No. Repair rebuilds the structure of a damaged file so it can open. It does not check whether the file is malicious, so a file from an untrusted source should stay unopened.

Where can I check the official details?

Read the maintainers' advisories listed in the sources below. Scores and affected versions can differ between aggregator sites, so the project's own advisory is the one to rely on.

Sources

Back to blog