GHSA-67mh-4wv8-2f99: Esbuild Esbuild Enables Any Website To Vulnerability
MODERATEGHSA-67mh-4wv8-2f99 is a MODERATE (CVSS 5.3) esbuild enables any website to vulnerability (CWE-346: Origin Validation Error) affecting Esbuild libraries in the npm ecosystem. The issue involves esbuild enables any website to send any requests to the development server and read the response. Remediation is available by upgrading affected packages to version 0.25.0.
GHSA-67mh-4wv8-2f99 at a Glance
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:H/PR:N/UI:R/S:U/C:H/I:N/A:N).
How to Fix GHSA-67mh-4wv8-2f99
To remediate this vulnerability, upgrade all affected Esbuild 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 esbuild@0.25.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls esbuild
How to Check if You Are Affected
To determine whether your Node.js application is affected by GHSA-67mh-4wv8-2f99, inspect your project dependencies using npm:
npm ls esbuild
Analyze the terminal output to locate any version of Esbuild in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.25.0), your application is affected.
Note: The npm ls esbuild 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-346: Origin Validation Error, where the product does not properly verify that the source of data or communication is valid. In Esbuild, 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
GHSA-67mh-4wv8-2f99 Affected Esbuild Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
esbuild
|
npm |
< 0.25.0
|
0.25.0
|
References
Frequently Asked Questions
What is GHSA-67mh-4wv8-2f99?
Which Esbuild versions are affected?
What version fixes GHSA-67mh-4wv8-2f99?
Is esbuild affected?
What is the CVSS score of GHSA-67mh-4wv8-2f99?
What CWE is associated with GHSA-67mh-4wv8-2f99?
How can I check npm dependencies for GHSA-67mh-4wv8-2f99?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-67mh-4wv8-2f99",
"modified" : "2025-02-10T17:48:08Z",
"published" : "2025-02-10T17:48:07Z",
"aliases" : [ ],
"summary" : "esbuild enables any website to send any requests to the development server and read the response",
"details" : "### Summary\n\nesbuild allows any websites to send any request to the development server and read the response due to default CORS settings.\n\n### Details\n\nesbuild sets `Access-Control-Allow-Origin: *` header to all requests, including the SSE connection, which allows any websites to send any request to the development server and read the response.\n\nhttps://github.com/evanw/esbuild/blob/df815ac27b84f8b34374c9182a93c94718f8a630/pkg/api/serve_other.go#L121\nhttps://github.com/evanw/esbuild/blob/df815ac27b84f8b34374c9182a93c94718f8a630/pkg/api/serve_other.go#L363\n\n**Attack scenario**:\n\n1. The attacker serves a malicious web page (`http://malicious.example.com`).\n1. The user accesses the malicious web page.\n1. The attacker sends a `fetch('http://127.0.0.1:8000/main.js')` request by JS in that malicious web page. This request is normally blocked by same-origin policy, but that's not the case for the reasons above.\n1. The attacker gets the content of `http://127.0.0.1:8000/main.js`.\n\nIn this scenario, I assumed that the attacker knows the URL of the bundle output file name. But the attacker can also get that information by\n\n- Fetching `/index.html`: normally you have a script tag here\n- Fetching `/assets`: it's common to have a `assets` directory when you have JS files and CSS files in a different directory and the directory listing feature tells the attacker the list of files\n- Connecting `/esbuild` SSE endpoint: the SSE endpoint sends the URL path of the changed files when the file is changed (`new EventSource('/esbuild').addEventListener('change', e => console.log(e.type, e.data))`)\n- Fetching URLs in the known file: once the attacker knows one file, the attacker can know the URLs imported from that file\n\nThe scenario above fetches the compiled content, but if the victim has the source map option enabled, the attacker can also get the non-compiled content by fetching the source map file.\n\n### PoC\n\n1. Download [reproduction.zip](https://github.com/user-attachments/files/18561484/reproduction.zip)\n2. Extract it and move to that directory\n1. Run `npm i`\n1. Run `npm run watch`\n1. Run `fetch('http://127.0.0.1:8000/app.js').then(r => r.text()).then(content => console.log(content))` in a different website's dev tools.\n\n\n\n### Impact\n\nUsers using the serve feature may get the source code stolen by malicious websites.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "esbuild"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.25.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 0.24.2"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/evanw/esbuild/security/advisories/GHSA-67mh-4wv8-2f99"
}, {
"type" : "WEB",
"url" : "https://github.com/evanw/esbuild/commit/de85afd65edec9ebc44a11e245fd9e9a2e99760d"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/evanw/esbuild"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-346" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-02-10T17:48:07Z",
"nvd_published_at" : null
}
}