CVE-2024-39919: @jmondi/url to png @jmondi/url-to-png Enables Capture Screenshot Of Vulnerability

MODERATE
Advisory Identifier: GHSA-342q-2mc2-5gmp
CVSS 3.7
CWE-200
Published
Advisory Summary

CVE-2024-39919 is a MODERATE (CVSS 3.7) @jmondi/url-to-png enables capture screenshot of vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting @jmondi/url to png libraries in the npm ecosystem. The issue involves @jmondi/url-to-png enables capture screenshot of localhost web services (unauthenticated pages). Remediation is available by upgrading affected packages to version 2.1.2.

CVE-2024-39919 at a Glance

CVE Identifier CVE-2024-39919
GHSA Identifier GHSA-342q-2mc2-5gmp
Severity MODERATE
CVSS v3.1 Base Score 3.7
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product @jmondi/url to png
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 3.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
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-39919

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.1.2
npm install @jmondi/url-to-png@2.1.2
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-39919, 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.1.2), 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-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. 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

### Summary The maintainer been contemplating whether FTP or other protocols could serve as useful functionalities, but there may not be a practical reason for it since we are utilizing headless Chrome to capture screenshots. The argument is based on the assumption that this package can function as a service. The package includes an `ALLOW_LIST` where the host can specify which services the user is permitted to capture screenshots of. By default, capturing screenshots of web services running on localhost, 127.0.0.1, or the [::] is allowed. The maintainer is of the opinion that the package should also have a blacklist due to a potential vulnerability (or rather design oversight). If someone hosts this on a server, users could then capture screenshots of other web services running locally. Unless this is strictly for web pages. Something similar here: https://github.com/follow-redirects/follow-redirects/issues/235 (localhost is intended for end users or hosts to deny, and the package is for HTTP/HTTPS.) This is marked as a `LOW` since the maintainer is not sure if this is a vulnerability, but it's still best to highlight it. :) ### PoC Have a service like so running locally: ```js const http = require("http") const server = http.createServer((req, res) => { console.log("Received headers:", req.headers) res.writeHead(200, { "Content-Type": "text/plain" }) res.end("Something private! But Hello from Server 2 :)") }) server.listen(3001, () => { console.log("Server two running on http://localhost:3001") }) ``` Run the package in dev mode, `pnpm dev`. Feed these URLs: ``` http://localhost:3089/?url=http://[::]:3001&width=4000 http://localhost:3089/?url=http://localhost:3001&width=4000 http://localhost:3089/?url=http://127.0.01:3001&width=4000 ``` <img width="622" alt="image" src="https://github.com/jasonraimondi/url-to-png/assets/42532003/21f1c883-ba00-4a15-83b8-922484fa4c2b"> ### Impact Disclose internal web services?

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

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

References

Frequently Asked Questions

What is CVE-2024-39919?
CVE-2024-39919 is a security vulnerability in @jmondi/url to png involving @jmondi/url-to-png enables capture screenshot of localhost web services (unauthenticated pages) under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which @jmondi/url to png versions are affected?
Affected versions include releases prior to 2.1.2 across affected packages: @jmondi/url-to-png.
What version fixes CVE-2024-39919?
Upgrading to 2.1.2 (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.1.2. Upgrade your dependency to 2.1.2 or later.
What is the CVSS score of CVE-2024-39919?
CVE-2024-39919 has a CVSS v3.1 base score of 3.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2024-39919?
CVE-2024-39919 is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check npm dependencies for CVE-2024-39919?
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-342q-2mc2-5gmp",
  "modified" : "2024-11-18T16:26:52Z",
  "published" : "2024-07-15T17:47:00Z",
  "aliases" : [ "CVE-2024-39919" ],
  "summary" : "@jmondi/url-to-png enables capture screenshot of localhost web services (unauthenticated pages)",
  "details" : "### Summary\n\nThe maintainer been contemplating whether FTP or other protocols could serve as useful functionalities, but there may not be a practical reason for it since we are utilizing headless Chrome to capture screenshots. The argument is based on the assumption that this package can function as a service.\n\nThe package includes an `ALLOW_LIST` where the host can specify which services the user is permitted to capture screenshots of. By default, capturing screenshots of web services running on localhost, 127.0.0.1, or the [::] is allowed.\n\nThe maintainer is of the opinion that the package should also have a blacklist due to a potential vulnerability (or rather design oversight). If someone hosts this on a server, users could then capture screenshots of other web services running locally.\n\nUnless this is strictly for web pages. Something similar here: https://github.com/follow-redirects/follow-redirects/issues/235 (localhost is intended for end users or hosts to deny, and the package is for HTTP/HTTPS.)\n\nThis is marked as a `LOW` since the maintainer is not sure if this is a vulnerability, but it's still best to highlight it. :) \n\n### PoC\n\nHave a service like so running locally:\n\n```js\nconst http = require(\"http\")\n\nconst server = http.createServer((req, res) => {\n  console.log(\"Received headers:\", req.headers)\n  res.writeHead(200, { \"Content-Type\": \"text/plain\" })\n  res.end(\"Something private! But Hello from Server 2 :)\")\n})\n\nserver.listen(3001, () => {\n  console.log(\"Server two running on http://localhost:3001\")\n})\n```\n\nRun the package in dev mode, `pnpm dev`. Feed these URLs:\n\n```\nhttp://localhost:3089/?url=http://[::]:3001&width=4000\nhttp://localhost:3089/?url=http://localhost:3001&width=4000\nhttp://localhost:3089/?url=http://127.0.01:3001&width=4000\n```\n\n<img width=\"622\" alt=\"image\" src=\"https://github.com/jasonraimondi/url-to-png/assets/42532003/21f1c883-ba00-4a15-83b8-922484fa4c2b\">\n\n\n\n### Impact\nDisclose internal web services?\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@jmondi/url-to-png"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.1.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/jasonraimondi/url-to-png/security/advisories/GHSA-342q-2mc2-5gmp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-39919"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jasonraimondi/url-to-png/commit/f62ff40403ffa1781459d6be8d97b8035888c00c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jasonraimondi/url-to-png"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-07-15T17:47:00Z",
    "nvd_published_at" : "2024-07-15T20:15:04Z"
  }
}