{"answers":{"affected":"2 open source packages ship an affected version, including esbuild.","exploited":"There is no known exploitation of GHSA-67mh-4wv8-2f99 in the wild and no public exploit code.","fix":"Upgrade esbuild to 0.25.0 or later.","what":"GHSA-67mh-4wv8-2f99 is a vulnerability in esbuild, published on 10 Feb 2025. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for GHSA-67mh-4wv8-2f99 and fix it if it is affected.\n\nWhat it is: GHSA-67mh-4wv8-2f99 is a vulnerability in esbuild, published on 10 Feb 2025. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of GHSA-67mh-4wv8-2f99 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- esbuild (npm): affected all versions; fixed in 0.25.0\n- esbuild (npm): affected all versions; fixed in 0.25.0\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-67mh-4wv8-2f99/ (Markdown: https://insights.sbomify.com/GHSA-67mh-4wv8-2f99/index.md)","id":"GHSA-67mh-4wv8-2f99","markdown":"https://insights.sbomify.com/GHSA-67mh-4wv8-2f99/index.md","name":"GHSA-67mh-4wv8-2f99","record":{"aliases":[],"analysis":{"component_type":"developer_tool","fix_type":"patch","impacts":["data_read"],"network_reachable":"adjacent_or_local","non_default_config":false,"product_category":"JavaScript build tool","requires_auth":"none","summary":"Misconfigured CORS headers in esbuild's development server allow malicious websites to read local source code and assets via cross-origin requests.","user_interaction":"required","vuln_class":"misconfiguration"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"### 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 =\u003e 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 =\u003e r.text()).then(content =\u003e console.log(content))` in a different website's dev tools.\n\n![image](https://github.com/user-attachments/assets/08fc2e4d-e1ec-44ca-b0ea-78a73c3c40e9)\n\n### Impact\n\nUsers using the serve feature may get the source code stolen by malicious websites.","ecosystems":["npm"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"esbuild enables any website to send any requests to the development server and read the response","id":"GHSA-67mh-4wv8-2f99","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"npm","product":null,"products":[],"type":"misconfiguration","year":"2025"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"npm","fixed":["0.25.0"],"introduced":["0"],"last_affected":[],"package":"esbuild","purl":null,"source":"GHSA-67mh-4wv8-2f99"},{"ecosystem":"npm","fixed":["0.25.0"],"introduced":["0"],"last_affected":[],"package":"esbuild","purl":"pkg:npm/esbuild","source":"GHSA-67mh-4wv8-2f99"}],"products":null,"published":"2025-02-10","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"Misconfigured CORS headers in esbuild's development server allow malicious websites to read local source code and assets via cross-origin requests.","url":"https://insights.sbomify.com/GHSA-67mh-4wv8-2f99/"}