CVE-2025-65026: CWE-94: Improper Control of Generation of Code ('Code Injection') in esm-dev esm.sh
esm.sh is a nobuild content delivery network(CDN) for modern web development. Prior to version 136, The esm.sh CDN service contains a Template Literal Injection vulnerability (CWE-94) in its CSS-to-JavaScript module conversion feature. When a CSS file is requested with the ?module query parameter, esm.sh converts it to a JavaScript module by embedding the CSS content directly into a template literal without proper sanitization. An attacker can inject malicious JavaScript code using ${...} expressions within CSS files, which will execute when the module is imported by victim applications. This enables Cross-Site Scripting (XSS) in browsers and Remote Code Execution (RCE) in Electron applications. This issue has been patched in version 136.
AI Analysis
Technical Summary
CVE-2025-65026 is a code injection vulnerability classified under CWE-94 affecting esm.sh, a no-build CDN service widely used for modern web development. The vulnerability arises from esm.sh's CSS-to-JavaScript module conversion feature, which, prior to version 136, embeds CSS content directly into JavaScript template literals without proper sanitization. When a CSS file is requested with the ?module query parameter, esm.sh converts it into a JavaScript module by wrapping the CSS content inside a template literal. However, this process fails to neutralize embedded JavaScript expressions using the ${...} syntax, allowing attackers to inject arbitrary JavaScript code. This malicious code executes when the module is imported by victim applications, enabling Cross-Site Scripting (XSS) attacks in browsers. Furthermore, in Electron applications that import these modules, the injected code can lead to Remote Code Execution (RCE), posing a significant risk to desktop applications built on Electron. The vulnerability is exploitable remotely over the network without requiring authentication, but user interaction is necessary to import the malicious module. The issue was publicly disclosed and patched in esm.sh version 136. The CVSS 3.1 base score of 6.1 reflects a medium severity, considering the attack vector is network-based, the attack complexity is low, no privileges are required, but user interaction is needed, and the impact affects confidentiality and integrity partially but not availability. No known exploits are currently reported in the wild. This vulnerability highlights the risks of improper code generation and sanitization in dynamic module conversion services, especially those serving web and Electron application ecosystems.
Potential Impact
For European organizations, this vulnerability poses a moderate risk primarily to web applications and Electron-based desktop applications that rely on esm.sh CDN for module delivery. Successful exploitation can lead to XSS attacks in browsers, potentially allowing attackers to steal user credentials, session tokens, or perform actions on behalf of users. In Electron apps, the risk escalates to remote code execution, which can compromise the host system, leading to data theft, persistence, or lateral movement within corporate networks. Organizations in sectors with high reliance on modern web development frameworks and Electron apps—such as fintech, software development, and digital services—are particularly vulnerable. The medium severity score indicates that while the vulnerability is exploitable remotely and without privileges, it requires user interaction, somewhat limiting mass exploitation. However, targeted attacks against European enterprises using esm.sh could result in significant confidentiality and integrity breaches, impacting customer trust and regulatory compliance, especially under GDPR. The absence of known exploits in the wild suggests a window for proactive mitigation before widespread attacks occur.
Mitigation Recommendations
European organizations should immediately upgrade esm.sh dependencies to version 136 or later to apply the official patch. They should audit their use of esm.sh CDN, particularly any CSS modules imported with the ?module parameter, to identify and remove potentially malicious or untrusted CSS files. Implementing Content Security Policy (CSP) headers that restrict script execution sources can help mitigate XSS risks. For Electron applications, developers should enforce strict validation and sanitization of all imported modules and consider sandboxing techniques to limit code execution privileges. Monitoring network traffic for unusual requests to esm.sh endpoints and employing runtime application self-protection (RASP) can detect and block exploitation attempts. Additionally, educating developers about the risks of dynamic code generation and template literal injection can prevent similar vulnerabilities. Organizations should also maintain an inventory of third-party dependencies and CDN usage to quickly respond to future vulnerabilities.
Affected Countries
Germany, France, United Kingdom, Netherlands, Sweden, Ireland
CVE-2025-65026: CWE-94: Improper Control of Generation of Code ('Code Injection') in esm-dev esm.sh
Description
esm.sh is a nobuild content delivery network(CDN) for modern web development. Prior to version 136, The esm.sh CDN service contains a Template Literal Injection vulnerability (CWE-94) in its CSS-to-JavaScript module conversion feature. When a CSS file is requested with the ?module query parameter, esm.sh converts it to a JavaScript module by embedding the CSS content directly into a template literal without proper sanitization. An attacker can inject malicious JavaScript code using ${...} expressions within CSS files, which will execute when the module is imported by victim applications. This enables Cross-Site Scripting (XSS) in browsers and Remote Code Execution (RCE) in Electron applications. This issue has been patched in version 136.
AI-Powered Analysis
Technical Analysis
CVE-2025-65026 is a code injection vulnerability classified under CWE-94 affecting esm.sh, a no-build CDN service widely used for modern web development. The vulnerability arises from esm.sh's CSS-to-JavaScript module conversion feature, which, prior to version 136, embeds CSS content directly into JavaScript template literals without proper sanitization. When a CSS file is requested with the ?module query parameter, esm.sh converts it into a JavaScript module by wrapping the CSS content inside a template literal. However, this process fails to neutralize embedded JavaScript expressions using the ${...} syntax, allowing attackers to inject arbitrary JavaScript code. This malicious code executes when the module is imported by victim applications, enabling Cross-Site Scripting (XSS) attacks in browsers. Furthermore, in Electron applications that import these modules, the injected code can lead to Remote Code Execution (RCE), posing a significant risk to desktop applications built on Electron. The vulnerability is exploitable remotely over the network without requiring authentication, but user interaction is necessary to import the malicious module. The issue was publicly disclosed and patched in esm.sh version 136. The CVSS 3.1 base score of 6.1 reflects a medium severity, considering the attack vector is network-based, the attack complexity is low, no privileges are required, but user interaction is needed, and the impact affects confidentiality and integrity partially but not availability. No known exploits are currently reported in the wild. This vulnerability highlights the risks of improper code generation and sanitization in dynamic module conversion services, especially those serving web and Electron application ecosystems.
Potential Impact
For European organizations, this vulnerability poses a moderate risk primarily to web applications and Electron-based desktop applications that rely on esm.sh CDN for module delivery. Successful exploitation can lead to XSS attacks in browsers, potentially allowing attackers to steal user credentials, session tokens, or perform actions on behalf of users. In Electron apps, the risk escalates to remote code execution, which can compromise the host system, leading to data theft, persistence, or lateral movement within corporate networks. Organizations in sectors with high reliance on modern web development frameworks and Electron apps—such as fintech, software development, and digital services—are particularly vulnerable. The medium severity score indicates that while the vulnerability is exploitable remotely and without privileges, it requires user interaction, somewhat limiting mass exploitation. However, targeted attacks against European enterprises using esm.sh could result in significant confidentiality and integrity breaches, impacting customer trust and regulatory compliance, especially under GDPR. The absence of known exploits in the wild suggests a window for proactive mitigation before widespread attacks occur.
Mitigation Recommendations
European organizations should immediately upgrade esm.sh dependencies to version 136 or later to apply the official patch. They should audit their use of esm.sh CDN, particularly any CSS modules imported with the ?module parameter, to identify and remove potentially malicious or untrusted CSS files. Implementing Content Security Policy (CSP) headers that restrict script execution sources can help mitigate XSS risks. For Electron applications, developers should enforce strict validation and sanitization of all imported modules and consider sandboxing techniques to limit code execution privileges. Monitoring network traffic for unusual requests to esm.sh endpoints and employing runtime application self-protection (RASP) can detect and block exploitation attempts. Additionally, educating developers about the risks of dynamic code generation and template literal injection can prevent similar vulnerabilities. Organizations should also maintain an inventory of third-party dependencies and CDN usage to quickly respond to future vulnerabilities.
Affected Countries
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2025-11-13T15:36:51.682Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 691e026693c808727dc91d1b
Added to database: 11/19/2025, 5:46:14 PM
Last enriched: 11/26/2025, 6:55:52 PM
Last updated: 1/7/2026, 4:53:21 AM
Views: 43
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
CVE-2026-0650: CWE-306 Missing Authentication for Critical Function in OpenFlagr Flagr
CriticalCVE-2025-15474: CWE-770 Allocation of Resources Without Limits or Throttling in AuntyFey AuntyFey Smart Combination Lock
MediumCVE-2025-14468: CWE-352 Cross-Site Request Forgery (CSRF) in mohammed_kaludi AMP for WP – Accelerated Mobile Pages
MediumCVE-2025-9611: CWE-749 Exposed Dangerous Method or Function in Microsoft Playwright
HighCVE-2026-22162
LowActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.