CVE-2024-4367: Pdfjs dist PDF.js Vulnerable To Arbitrary JavaScript Vulnerability
HIGHCVE-2024-4367 is a HIGH (CVSS 8.8) pdf.js vulnerable to arbitrary javascript vulnerability (CWE-754: Improper Check for Unusual or Exceptional Conditions) affecting Pdfjs dist libraries in the npm ecosystem. The issue involves pdf.js vulnerable to arbitrary javascript execution upon opening a malicious pdf. Remediation is available by upgrading affected packages to version 4.2.67.
CVE-2024-4367 at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).
How to Fix CVE-2024-4367
To remediate this vulnerability, upgrade all affected Pdfjs dist dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install pdfjs-dist@4.2.67
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls pdfjs-dist
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2024-4367, inspect your project dependencies using npm:
npm ls pdfjs-dist
Analyze the terminal output to locate any version of Pdfjs dist in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.2.67), your application is affected.
Note: The npm ls pdfjs-dist command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-754: Improper Check for Unusual or Exceptional Conditions, where the product does not check or incorrectly checks for unusual or exceptional conditions that are not expected to occur frequently during day to day operation of the product. In Pdfjs dist, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2024-4367 Affected Pdfjs dist Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
pdfjs-dist
|
npm |
< 4.2.67
|
4.2.67
|
References
Frequently Asked Questions
What is CVE-2024-4367?
Which Pdfjs dist versions are affected?
What version fixes CVE-2024-4367?
Is pdfjs-dist affected?
What is the CVSS score of CVE-2024-4367?
What CWE is associated with CVE-2024-4367?
How can I check npm dependencies for CVE-2024-4367?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-wgrm-67xf-hhpq",
"modified" : "2026-05-13T15:25:01Z",
"published" : "2024-05-07T10:25:08Z",
"aliases" : [ "CVE-2024-4367" ],
"summary" : "PDF.js vulnerable to arbitrary JavaScript execution upon opening a malicious PDF",
"details" : "### Impact\nIf pdf.js is used to load a malicious PDF, and PDF.js is configured with `isEvalSupported` set to `true` (which is the default value), unrestricted attacker-controlled JavaScript will be executed in the context of the hosting domain.\n\n### Patches\nThe patch removes the use of `eval`:\nhttps://github.com/mozilla/pdf.js/pull/18015\n\n### Workarounds\nSet the option `isEvalSupported` to `false`. \n\n### References\nhttps://bugzilla.mozilla.org/show_bug.cgi?id=1893645",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "pdfjs-dist"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.2.67"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.1.392"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/mozilla/pdf.js/security/advisories/GHSA-wgrm-67xf-hhpq"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-4367"
}, {
"type" : "WEB",
"url" : "https://github.com/gogs/gogs/issues/7928"
}, {
"type" : "WEB",
"url" : "https://github.com/mozilla/pdf.js/pull/18015"
}, {
"type" : "WEB",
"url" : "https://github.com/mozilla/pdf.js/commit/85e64b5c16c9aaef738f421733c12911a441cec6"
}, {
"type" : "WEB",
"url" : "https://bugzilla.mozilla.org/show_bug.cgi?id=1893645"
}, {
"type" : "WEB",
"url" : "https://cert-portal.siemens.com/productcert/html/ssa-827383.html"
}, {
"type" : "WEB",
"url" : "https://codeanlabs.com/blog/research/cve-2024-4367-arbitrary-js-execution-in-pdf-js"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/mozilla/pdf.js"
}, {
"type" : "WEB",
"url" : "https://github.com/mozilla/pdf.js/releases/tag/v4.2.67"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2024/05/msg00010.html"
}, {
"type" : "WEB",
"url" : "https://lists.debian.org/debian-lts-announce/2024/05/msg00012.html"
}, {
"type" : "WEB",
"url" : "https://www.exploit-db.com/exploits/52273"
}, {
"type" : "WEB",
"url" : "https://www.mozilla.org/security/advisories/mfsa2024-21"
}, {
"type" : "WEB",
"url" : "https://www.mozilla.org/security/advisories/mfsa2024-22"
}, {
"type" : "WEB",
"url" : "https://www.mozilla.org/security/advisories/mfsa2024-23"
}, {
"type" : "WEB",
"url" : "http://seclists.org/fulldisclosure/2024/Aug/30"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-754" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2024-05-07T10:25:08Z",
"nvd_published_at" : "2024-05-14T18:15:12Z"
}
}