GHSA-67mh-4wv8-2f99
esbuild enables any website to send any requests to the development server and read the response
- Severity
- 5.3 / 10
- Medium · CVSS 3.1
- Exploit chance (EPSS)
- —
- No score published
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-346 Origin Validation Error
- Fix
0.25.0- Upgrade esbuild to this version or later
Description
Summary
esbuild allows any websites to send any request to the development server and read the response due to default CORS settings.
Details
esbuild 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.
https://github.com/evanw/esbuild/blob/df815ac27b84f8b34374c9182a93c94718f8a630/pkg/api/serve_other.go#L121 https://github.com/evanw/esbuild/blob/df815ac27b84f8b34374c9182a93c94718f8a630/pkg/api/serve_other.go#L363
Attack scenario:
- The attacker serves a malicious web page (
http://malicious.example.com). - The user accesses the malicious web page.
- 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. - The attacker gets the content of
http://127.0.0.1:8000/main.js.
In 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
- Fetching
/index.html: normally you have a script tag here - Fetching
/assets: it's common to have aassetsdirectory when you have JS files and CSS files in a different directory and the directory listing feature tells the attacker the list of files - Connecting
/esbuildSSE 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))) - Fetching URLs in the known file: once the attacker knows one file, the attacker can know the URLs imported from that file
The 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.
PoC
- Download reproduction.zip
- Extract it and move to that directory
- Run
npm i - Run
npm run watch - 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.
Impact
Users using the serve feature may get the source code stolen by malicious websites.
Affected versions
npm
| Package | Vulnerable | Fixed in |
|---|---|---|
| esbuild | < 0.25.0 |
0.25.0 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
esbuild npm → 0.25.0
- npm
npm install esbuild@0.25.0- yarn
yarn add esbuild@0.25.0- pnpm
pnpm add esbuild@0.25.0
Severity breakdown
CVSS 3.1 5.3
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N
- Attack vector
- Network
- Attack complexity
- High
- Privileges required
- None
- User interaction
- Required
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- None
- Availability
- None
Weakness
CWE-346: Origin Validation Error
The product does not properly verify that the source of data or communication is valid.
References
Packages
Other links
Timeline
- Published
- Last updated by the source
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-g7r4-m6w7-qqqr esbuild allows arbitrary file read when running the development server on Windows | Low | Also affects esbuild |
| GHSA-997q-gvvc-jwmx Electron: openExternal permission requests can be attributed to the wrong origin | Medium | Same weakness, CWE-346 |
| GHSA-fw47-9c62-h3vw Electron: HID and USB permission checks can be attributed to the wrong origin | Medium | Same weakness, CWE-346 |
| GHSA-x562-297c-g43g Electron: Pointer lock permission requests can be attributed to the wrong frame | Medium | Same weakness, CWE-346 |
| GHSA-xcx6-jx8p-x3h5 MSAL Node authorization code flow may disclose parameters to an attacker-controlled endpoint | Medium | Same weakness, CWE-346 |
| GHSA-4w7w-5xrc-9h26 undici vulnerable to cache poisoning and cross-user disclosure via cross-origin redirects | Critical | Same weakness, CWE-346 |
| GHSA-fq6x-pvr9-888r Microsoft Security Advisory CVE-2026-96234 - .NET and Visual Studio Information Disclosure Vulnerability | Medium | Same weakness, CWE-346 |
| GHSA-9h23-53f4-q947 Nginx UI: Bundled reverse proxy can bypass IP allowlists and enable shared login lockout | Medium | Same weakness, CWE-346 |
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor