CVE-2024-37169: @jmondi/url to png Arbitrary File Read Vulnerability

MODERATE
Advisory Identifier: GHSA-665w-mwrr-77q3
CVSS 5.3
CWE-22
Published
Advisory Summary

CVE-2024-37169 is a MODERATE (CVSS 5.3) arbitrary file read vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting @jmondi/url to png libraries in the npm ecosystem. The issue involves arbitrary file read via playwright's screenshot feature exploiting file wrapper. Remediation is available by upgrading affected packages to version 2.0.3.

CVE-2024-37169 at a Glance

CVE Identifier CVE-2024-37169
GHSA Identifier GHSA-665w-mwrr-77q3
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product @jmondi/url to png
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.3

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:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-37169

To remediate this vulnerability, upgrade all affected @jmondi/url to png dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@jmondi/url-to-png fixed: 2.0.3
npm install @jmondi/url-to-png@2.0.3
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 @jmondi/url-to-png

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2024-37169, inspect your project dependencies using npm:

npm ls @jmondi/url-to-png

Analyze the terminal output to locate any version of @jmondi/url to png in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.3), your application is affected.

Note: The npm ls @jmondi/url-to-png 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-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In @jmondi/url to png, 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 All users of url-to-png. Please see https://github.com/jasonraimondi/url-to-png/issues/47 ### Patches [v2.0.3](https://github.com/jasonraimondi/url-to-png/releases/tag/v2.0.3) requires input url to be of protocol `http` or `https` ### Workarounds Requires upgrade. ### References - https://github.com/jasonraimondi/url-to-png/issues/47 - https://github.com/user-attachments/files/15536336/Arbitrary.File.Read.via.Playwright.s.Screenshot.Feature.Exploiting.File.Wrapper.pdf

CVE-2024-37169 Affected @jmondi/url to png Versions

1 component(s)
Fixed Versions:
2.0.3
Product / Package Ecosystem Affected Versions Fixed Version
@jmondi/url-to-png
npm
< 2.0.3
2.0.3

References

Frequently Asked Questions

What is CVE-2024-37169?
CVE-2024-37169 is a security vulnerability in @jmondi/url to png involving Arbitrary file read via Playwright's screenshot feature exploiting file wrapper under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which @jmondi/url to png versions are affected?
Affected versions include releases prior to 2.0.3 across affected packages: @jmondi/url-to-png.
What version fixes CVE-2024-37169?
Upgrading to 2.0.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @jmondi/url-to-png affected?
Yes, @jmondi/url-to-png is affected in releases prior to 2.0.3. Upgrade your dependency to 2.0.3 or later.
What is the CVSS score of CVE-2024-37169?
CVE-2024-37169 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2024-37169?
CVE-2024-37169 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check npm dependencies for CVE-2024-37169?
Run the dependency tree command: 'npm ls @jmondi/url-to-png'. 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-665w-mwrr-77q3",
  "modified" : "2024-06-11T18:27:37Z",
  "published" : "2024-06-05T13:29:10Z",
  "aliases" : [ "CVE-2024-37169" ],
  "summary" : "Arbitrary file read via Playwright's screenshot feature exploiting file wrapper",
  "details" : "### Impact\n\nAll users of url-to-png. Please see https://github.com/jasonraimondi/url-to-png/issues/47\n\n### Patches\n\n[v2.0.3](https://github.com/jasonraimondi/url-to-png/releases/tag/v2.0.3) requires input url to be of protocol `http` or `https` \n\n### Workarounds\n\nRequires upgrade.\n\n### References\n\n- https://github.com/jasonraimondi/url-to-png/issues/47\n- https://github.com/user-attachments/files/15536336/Arbitrary.File.Read.via.Playwright.s.Screenshot.Feature.Exploiting.File.Wrapper.pdf\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@jmondi/url-to-png"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.0.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/jasonraimondi/url-to-png/security/advisories/GHSA-665w-mwrr-77q3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-37169"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jasonraimondi/url-to-png/issues/47"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jasonraimondi/url-to-png/commit/9336020c5e603323f5cf4a2ac3bb9a7735cf61f7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jasonraimondi/url-to-png"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jasonraimondi/url-to-png/releases/tag/v2.0.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/user-attachments/files/15536336/Arbitrary.File.Read.via.Playwright.s.Screenshot.Feature.Exploiting.File.Wrapper.pdf"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-06-05T13:29:10Z",
    "nvd_published_at" : "2024-06-10T22:15:12Z"
  }
}