CVE-2018-5158 Malicious PDF can inject JavaScript into PDF Viewer

High 8.8 Published Updated

Attackers can execute arbitrary JavaScript with PDF viewer permissions via crafted PDFs due to insufficient sanitization of PostScript functions.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2018-5158?

CVE-2018-5158 is a high-severity code injection vulnerability in Canonical Ubuntu Linux, published on 11 Jun 2018. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

The PDF viewer does not sufficiently sanitize PostScript calculator functions, allowing malicious JavaScript to be injected through a crafted PDF file. This JavaScript can then be run with the permissions of the PDF viewer by its worker. This vulnerability affects Firefox ESR < 52.8 and Firefox < 60.

Weakness: CWE-94

Which versions are affected by CVE-2018-5158?

4 open source packages ship an affected version, including pdfjs-dist. It affects 9 products.

PackageAffectedFixed in
pdfjs-dist npmAll versions1.10.100
pdfjs-dist npmAll versions1.10.100
pdfjs-dist npmFrom 2.0.02.0.550
pdfjs-dist npmFrom 2.0.02.0.550

Products include Canonical Ubuntu Linux, Debian Debian Linux, Mozilla Firefox, Redhat Enterprise Linux Desktop, Redhat Enterprise Linux Server, Redhat Enterprise Linux Server Aus and 3 more.

How do I fix CVE-2018-5158?

Upgrade pdfjs-dist to a fixed version for your release line: 1.10.100 or 2.0.550.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2018-5158 being exploited?

There is no known exploitation of CVE-2018-5158 in the wild and no public exploit code.

Public exploit code: 1 proofs of concept on GitHub.

All Canonical Ubuntu Linux vulnerabilities

Sources

Also known as DEBIAN-CVE-2018-5158, GHSA-7jg2-jgv3-fmr4, UBUNTU-CVE-2018-5158.

Is CVE-2018-5158 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free