CVE-2024-4367: Pdfjs dist PDF.js Vulnerable To Arbitrary JavaScript Vulnerability

HIGH
Advisory Identifier: GHSA-wgrm-67xf-hhpq
CVSS 8.8
CWE-754
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2024-4367
GHSA Identifier GHSA-wgrm-67xf-hhpq
Severity HIGH
CVSS v3.1 Base Score 8.8
CWE Classification CWE-754: Improper Check for Unusual or Exceptional Conditions
Affected Product Pdfjs dist
Package Ecosystem npm
Published Date
Last Updated

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (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.

pdfjs-dist fixed: 4.2.67
npm install pdfjs-dist@4.2.67
Verify Direct and Transitive Dependencies

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

### Impact If 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. ### Patches The patch removes the use of `eval`: https://github.com/mozilla/pdf.js/pull/18015 ### Workarounds Set the option `isEvalSupported` to `false`. ### References https://bugzilla.mozilla.org/show_bug.cgi?id=1893645

CVE-2024-4367 Affected Pdfjs dist Versions

1 component(s)
Fixed Versions:
4.2.67
Product / Package Ecosystem Affected Versions Fixed Version
pdfjs-dist
npm
< 4.2.67
4.2.67

References

GitHub Advisory / Wiki ADVISORY
https://github.com/mozilla/pdf.js/security/advisories/GHSA-wgrm-67xf-hhpq
NVD — CVE-2024-4367 NVD
https://nvd.nist.gov/vuln/detail/CVE-2024-4367
Pdfjs dist Source Repository REPOSITORY
https://github.com/gogs/gogs/issues/7928
Pdfjs dist Source Repository REPOSITORY
https://github.com/mozilla/pdf.js/pull/18015
Security Fix Commit FIX COMMIT
https://github.com/mozilla/pdf.js/commit/85e64b5c16c9aaef738f421733c12911a441cec6
bugzilla.mozilla.org/show_bug.cgi WEB
https://bugzilla.mozilla.org/show_bug.cgi?id=1893645
cert-portal.siemens.com/productcert/html/ss... WEB
https://cert-portal.siemens.com/productcert/html/ssa-827383.html
codeanlabs.com/blog/research/cve-2... WEB
https://codeanlabs.com/blog/research/cve-2024-4367-arbitrary-js-execution-in-pdf-js
Pdfjs dist Source Repository REPOSITORY
https://github.com/mozilla/pdf.js
Pdfjs dist Release RELEASE
https://github.com/mozilla/pdf.js/releases/tag/v4.2.67
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2024/05/msg00010.html
lists.debian.org/debian-lts-announce... WEB
https://lists.debian.org/debian-lts-announce/2024/05/msg00012.html
www.exploit-db.com/exploits/52273 WEB
https://www.exploit-db.com/exploits/52273
Pdfjs dist Security Information SECURITY
https://www.mozilla.org/security/advisories/mfsa2024-21
Pdfjs dist Security Information SECURITY
https://www.mozilla.org/security/advisories/mfsa2024-22
Pdfjs dist Security Information SECURITY
https://www.mozilla.org/security/advisories/mfsa2024-23
seclists.org/fulldisclosure/2024... WEB
http://seclists.org/fulldisclosure/2024/Aug/30

Frequently Asked Questions

What is CVE-2024-4367?
CVE-2024-4367 is a security vulnerability in Pdfjs dist involving PDF.js vulnerable to arbitrary JavaScript execution upon opening a malicious PDF under CWE-754: Improper Check for Unusual or Exceptional Conditions.
Which Pdfjs dist versions are affected?
Affected versions include releases prior to 4.2.67 across affected packages: pdfjs-dist.
What version fixes CVE-2024-4367?
Upgrading to 4.2.67 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pdfjs-dist affected?
Yes, pdfjs-dist is affected in releases prior to 4.2.67. Upgrade your dependency to 4.2.67 or later.
What is the CVSS score of CVE-2024-4367?
CVE-2024-4367 has a CVSS v3.1 base score of 8.8 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2024-4367?
CVE-2024-4367 is classified under CWE-754: Improper Check for Unusual or Exceptional Conditions (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.).
How can I check npm dependencies for CVE-2024-4367?
Run the dependency tree command: 'npm ls pdfjs-dist'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}