Skip to navigation

Threat reportVulnerabilityTL-2026-3367

happy-dom sandbox escape RCE: CVE-2025-61927 (VM escape) and CVE-2025-62410 (prototype pollution)

criticalPATCHED

Two code-execution flaws in the happy-dom headless browser package let untrusted JavaScript escape the Node.js vm context. CVE-2025-61927 abuses the Function constructor chain to reach process and require(); CVE-2025-62410 uses prototype pollution to defeat the --disallow-code-generation-from-strings mitigation. Public PoCs exist; no in-the-wild exploitation is reported.

By

Key facts

IdentifiersTL-2026-3367, CVE-2025-61927, CVE-2025-62410
SeverityCRITICAL
CVSS9.4 (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)
Exploitation statusPublic proof-of-concept exploit for a linked CVE
EPSSCVE-2025-61927: 0.6% (49.3th percentile); CVE-2025-62410: 0.3% (26.9th percentile)
Affected productscapricorn86 happy-dom (npm)
Weaknesses (CWE)CWE-94, CWE-1321
MITRE ATT&CK techniquesT1005 Data from Local System, T1059.007 JavaScript, T1106 Native API, T1190 Exploit Public-Facing Application, T1203 Exploitation for Client Execution, T1499.004 Application or System Exploitation
MotivationUNKNOWN
Target sectorstechnology, software-development, cloud-services
Target regionsGlobal
Detection rules9 (1 shown free)
Sources8 cited sources

Detection coverage

As of 2026-10-12, Threadlinqs Intelligence publishes 9 detection rule(s) for TL-2026-3367 across Splunk SPL, Microsoft KQL and Sigma, covering 4 indicator(s) of compromise. The whole corpus is readable without an account. Every threat comes with one complete detection in Splunk SPL, Microsoft KQL and Sigma, free for everyone; a free account adds daily TL Creds to unlock the rest. Paid plans add a larger daily allowance, correlation and the MCP server. Threadlinqs MCP server · View plans.

Free detection: happy-dom Function Constructor Sandbox Escape Payload (CVE-2025-61927) — Exploitation

Finds HTTP requests containing the constructor.constructor chain used by the CVE-2025-61927 happy-dom vm escape PoC (this.constructor.constructor('return process')()). Hits where the payload also references the host process object or process.mainModule are escalated to critical. Applies to apps (SSR, scrapers, test runners, AI-agent browsing) that pass untrusted JavaScript to happy-dom before 20.0.0.

  • Languages: Splunk SPL, Microsoft KQL, Sigma
  • ATT&CK: T1190, T1203, T1059.007
  • Data sources: web:access_combined, web:nginx:plus:access, web:modsec:audit, CommonSecurityLog, AppServiceHTTPLogs
  • Severity: critical
  • Confidence: high

Splunk SPL

```Detect happy-dom CVE-2025-61927 Function constructor sandbox escape payloads in HTTP requests```
index=web sourcetype IN ("access_combined","nginx:plus:access","modsec:audit") earliest=-24h
| eval request=coalesce(uri,uri_path,"")." ".coalesce(uri_query,"")." ".coalesce(http_request_body,form_data,"")
| eval payload=lower(replace(urldecode(request)," ",""))
| eval src=coalesce(src_ip,clientip,src)
| eval sample=substr(request,1,300)
| eval escape=if(like(payload,"%constructor.constructor%"),1,0)
| eval host_ref=if(like(payload,"%returnprocess%") OR like(payload,"%process.mainmodule%"),1,0)
| where escape=1
| eval risk=if(host_ref=1,"critical","high")
| stats count min(_time) as first_seen max(_time) as last_seen values(status) as status values(risk) as risk values(sample) as sample by src, host
| convert ctime(first_seen) ctime(last_seen)
| sort - count

Microsoft KQL

union isfuzzy=true
    (CommonSecurityLog
     | where TimeGenerated > ago(24h)
     | project TimeGenerated, SrcIp = SourceIP, Dest = DestinationHostName, Raw = strcat(RequestURL, " ", RequestContext, " ", AdditionalExtensions), Source = "CommonSecurityLog"),
    (AppServiceHTTPLogs
     | where TimeGenerated > ago(24h)
     | project TimeGenerated, SrcIp = CIp, Dest = CsHost, Raw = strcat(CsUriStem, " ", CsUriQuery), Source = "AppServiceHTTPLogs")
| extend Payload = tolower(replace_string(url_decode(Raw), " ", ""))
| where Payload contains "constructor.constructor"
| extend HostRef = Payload contains "returnprocess" or Payload contains "process.mainmodule"
| extend Signal = iff(HostRef, "CVE-2025-61927 escape reaching host process", "CVE-2025-61927 Function constructor chain")
| summarize Hits = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated), Sample = take_any(substring(Raw, 0, 300)) by SrcIp, Dest, Source, Signal
| order by Hits desc

Sigma

title: happy-dom Function Constructor Sandbox Escape Payload in Web Request (CVE-2025-61927)
id: 3b6f1c2e-7a41-4d58-9c0e-5e8a2f1d4b01
status: experimental
description: Detects HTTP requests carrying the this.constructor.constructor chain used by the CVE-2025-61927 happy-dom vm context escape PoC. Applications that feed request or fetched content to happy-dom can be driven to reach the host Node.js process object.
references:
    - https://www.endorlabs.com/learn/happier-doms-the-perils-of-running-untrusted-javascript-code-outside-of-a-web-browser
    - https://github.com/capricorn86/happy-dom/security/advisories/GHSA-37j7-fg3j-429f
    - https://github.com/capricorn86/happy-dom/security/advisories/GHSA-qpm2-6cq5-7pq5
author: Threadlinqs Team
date: 2026-10-12
tags:
    - attack.initial-access
    - attack.t1190
    - attack.execution
    - attack.t1203
    - attack.t1059.007
    - cve.2025.61927
    - cve.2025.62410
logsource:
    category: webserver
detection:
    selection_query:
        cs-uri-query|contains:
            - 'constructor.constructor'
            - 'constructor%2econstructor'
            - 'constructor%2Econstructor'
    selection_uri:
        c-uri|contains:
            - 'constructor.constructor'
            - 'constructor%2econstructor'
            - 'constructor%2Econstructor'
    condition: 1 of selection_*
falsepositives:
    - Security scanners or bug-bounty testers fuzzing JavaScript sandbox escapes
    - Documentation or code-sharing sites that legitimately echo JavaScript snippets containing constructor.constructor
level: high

Known false positives:

  • Penetration testers or scanners fuzzing sandbox escapes
  • Developer forums or code-snippet services echoing JavaScript that contains constructor.constructor

Tuning notes: Adjust the index and sourcetype list to your web or WAF logs; map request body fields (http_request_body/form_data) if your WAF logs bodies. Allow-list known scanner source IPs. Most useful on endpoints that accept HTML or script content later rendered by happy-dom; script fetched by the application from third-party sites will not appear in inbound requests, so pair with the post-exploitation detections.

8 more detection rules (Splunk SPL, Microsoft KQL, Sigma) · unlock with TL Creds. Sign up free to unlock the detection rules or query them with the Threadlinqs MCP server (Purple and Gold in full, 2 calls a day on a free account)
  • [indicator] Prototype Pollution Payload (CVE-2025-62410) — Exploitation · unlock with TL Creds
  • Node.js Child Process Harvesting Environment and Credential Files — [indicator] Post-Exploitation · unlock with TL Creds
  • Node.js Child Process Exfiltrating Data via curl/wget — [indicator] Exfiltration · unlock with TL Creds
  • [indicator] Escaped Script Host API Gadget (process.mainModule.require) — Exploitation · unlock with TL Creds
  • Node.js Child Process Downloading or Staging Payloads — [indicator] Post-Exploitation · unlock with TL Creds
  • Node.js Child Process Reverse Shell or Lateral Movement Tooling — [indicator] C2 and Lateral Movement · unlock with TL Creds
  • Node.js Host Process Spawning Shell or Discovery Utility — [indicator] Post-Exploitation · unlock with TL Creds
  • Node.js Beaconing or Non-Web Egress from [indicator] Host — C2 and Exfiltration · unlock with TL Creds

Indicators of compromise

As of 2026-10-12, Threadlinqs Intelligence tracks 4 indicators of compromise for TL-2026-3367.

4 indicators of compromise · unlock with TL Creds. Compare plans

Technical analysis

happy-dom (github.com/capricorn86/happy-dom) is a headless DOM implementation used for server-side rendering, scraping and test runners. It evaluates page JavaScript inside a Node.js vm context. Node.js documents the vm module as not a security mechanism, so any untrusted script executed this way shares the host process and its V8 isolate.

CVE-2025-61927 (CWE-94) affects happy-dom before 20.0.0, where JavaScript evaluation is enabled by default. Untrusted script walks the constructor chain (this.constructor.constructor) to reach the host-realm Function constructor, creates a function outside the vm context that returns the process object, then calls process.mainModule.require to load Node.js core modules. The Endor Labs PoC enumerates the working directory with require('fs').readdirSync. The GitHub advisory lists the impact as access to environment variables and secrets, arbitrary command execution through child processes, full file system read/write and network access for lateral movement. The reporter credited in the advisory is Mas0nShi. The fix in v20 disables JavaScript evaluation by default; the interim workaround was to run Node.js with --disallow-code-generation-from-strings.

CVE-2025-62410 (CWE-1321) affects happy-dom before 20.0.2 and is an incomplete fix for the first flaw. Even with code generation from strings disabled, untrusted script and the host application still share one isolate. The script can pollute built-in prototypes (the Endor Labs PoC overwrites toString on the root Object prototype via this.constructor.constructor.__proto__.__proto__) to cause denial of service, hijack critical references or control flow, or reach injection-prone APIs through gadget chains. The credited reporter is Cris Staicu of the Endor Labs research team. Node.js --frozen-intrinsics hardens the builtins but the maintainers and researchers still consider it insufficient: untrusted code can still exfiltrate data via fetch() or side channels, so real isolation (isolated-vm, a container or a VM, or Secure EcmaScript) is recommended.

Scoring differs between sources. NVD lists CVE-2025-61927 at 7.2 (CVSS 4.0) and CVE-2025-62410 at 9.4 (CVSS 4.0), while the GitHub advisories carry different severity labels; the highest sourced score and its vector are recorded here. The vendor advisories and Endor Labs report no in-the-wild exploitation, IOCs or threat actor attribution. The exposure applies to applications that run untrusted or third-party JavaScript through happy-dom, such as scrapers, SSR pipelines and AI-agent browsing tools.

MITRE ATT&CK techniques by tactic:

Collection

T1005 Data from Local System

Execution

T1059.007 JavaScript; T1106 Native API; T1203 Exploitation for Client Execution

Initial Access

T1190 Exploit Public-Facing Application

Impact

T1499.004 Application or System Exploitation

Remediation

Patches

  • happy-dom 20.0.0 (CVE-2025-61927)
  • happy-dom 20.0.2 (CVE-2025-62410)

Immediate actions

  • Upgrade happy-dom to 20.0.2 or later (v20 disables JavaScript evaluation by default; 20.0.2 fixes CVE-2025-62410)
  • Disable JavaScript evaluation in happy-dom for any content that is not fully trusted
  • Inventory applications and CI pipelines that run untrusted or third-party JavaScript through happy-dom

Workarounds

  • Start Node.js with --disallow-code-generation-from-strings (insufficient alone against prototype pollution)
  • Start Node.js with --frozen-intrinsics to block builtin alteration (still not full isolation)

Longer-term hardening

  • Run untrusted JavaScript in genuinely isolated runtimes such as isolated-vm or Secure EcmaScript instead of the Node.js vm module
  • Add container or VM isolation, least-privilege service accounts and egress filtering around workloads that render untrusted pages
  • Keep secrets out of the environment of processes that execute untrusted scripts

Affected and fixed versions

  • capricorn86 — happy-dom (npm)
    Vulnerable versions: < 20.0.0 (CVE-2025-61927); < 20.0.2 (CVE-2025-62410)
    Fixed in: 20.0.0; 20.0.2

Timeline

  • happy-dom 20.0.0 patches CVE-2025-61927 by disabling JavaScript evaluation by default; interim guidance for older versions was to disable evaluation or run Node.js with --disallow-code-generation-from-strings
  • happy-dom publishes GHSA-37j7-fg3j-429f for CVE-2025-61927 (VM context escape, reported by Mas0nShi); v20 is the patched release with JavaScript evaluation disabled by default
  • NVD publishes CVE-2025-61927 (CWE-94), affecting happy-dom before 20.0.0
  • NVD publishes CVE-2025-62410 (CWE-1321), affecting happy-dom before 20.0.2
  • happy-dom 20.0.2 fixes CVE-2025-62410, an incomplete fix for CVE-2025-61927; advisory PoC shows prototype pollution reaching the process object and spawnSync() despite eval restrictions
  • happy-dom publishes GHSA-qpm2-6cq5-7pq5 for CVE-2025-62410, showing --disallow-code-generation-from-strings is insufficient against prototype pollution; fixed in 20.0.2 (reported by Cris Staicu of Endor Labs)
  • Endor Labs publishes 'Happier DOMs', analyzing both vulnerabilities with two public PoCs and recommending isolated-vm, Secure EcmaScript, or container/VM isolation

Sources cited

Previous and next in vulnerability

AI-drafted from 8 cited sources; published ; last updated —.

Threadlinqs Intelligence — Real-Time Threat Detection Platform

// threat_feed
$ sort --newest
Showing all threats

Live intelligence console

Threat level

Latest Threats