CVE-2026-133780 in stimulus-bridge
Summary
by MITRE • 11/24/2026
The @symfony/stimulus-bridge npm package includes a Webpack loader called lazy-controller-loader that supports "magic comments" placed above a Stimulus controller import, for example /* stimulusFetch: 'lazy' */, to control lazy loading behavior. To read those options, the loader extracted the raw text of any stimulus* comment and evaluated it as JavaScript using Node's vm.runInNewContext(). The Node.js node:vm module is not a security sandbox, and a crafted comment can break out of the VM context using well-known techniques to run arbitrary Node.js code within the build process.
This is a build-time vulnerability: it does not affect browsers or end users. The code executes on the developer machine or CI/build server during a Webpack or Symfony Encore build. Realistic attack vectors include a malicious Stimulus controller introduced through a compromised dependency, or a pull request that triggers an automated CI build. An attacker who can get such a file into the build can read files and environment variables available to the build process, exfiltrate CI secrets, tamper with generated build artifacts, and run commands with the permissions of the build user.
The loader no longer evaluates comment content as JavaScript. It now parses each comment as an object expression using a real JavaScript parser and extracts only plain literal values. Any non-literal value, such as a function call, an identifier, or a sequence expression, is rejected and reported as a build error instead of being executed. Legitimate option values like 'lazy' and 'eager' continue to work without any changes required on the user's side.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/25/2026
The @symfony/stimulus-bridge npm package contained a critical code injection vulnerability within its Webpack loader, specifically in the lazy-controller-loader component designed to manage Stimulus controller imports via magic comments. The core technical flaw stemmed from the loader’s method of parsing these configuration directives. Instead of using a safe parsing mechanism, the implementation extracted raw text from any comment starting with stimulus and passed it directly into Node.js's vm.runInNewContext() function for evaluation as JavaScript code. This approach fundamentally misused the node:vm module, which is explicitly documented by Node.js maintainers not to be a security sandbox capable of containing untrusted or malicious code. By treating arbitrary text input as executable JavaScript without rigorous validation, the loader created an execution environment where crafted inputs could escape the intended context and execute arbitrary commands within the build process.
This vulnerability represents a severe supply chain risk classified under CWE-94 Improper Control of Generation of Code (Code Injection). The attack vector relies on the introduction of malicious code into the project’s source tree, typically through compromised dependencies or deceptive pull requests that trigger automated builds. Because the flaw occurs during the build phase rather than at runtime in a user's browser, it is categorized as a build-time vulnerability and aligns with MITRE ATT&CK techniques related to supply chain compromise such as T1195 Supply Chain Compromise and potentially T1059 Command and Scripting Interpreter if arbitrary commands are executed. An attacker who successfully injects a malicious Stimulus controller can exploit the vm.runInNewContext() call to break out of the isolated context, gaining full access to the Node.js environment running the build process.
The operational impact of this vulnerability is significant for development teams and continuous integration pipelines. Once an attacker gains code execution within the build process, they can read sensitive files accessible to the user account executing the build, including source code repositories and configuration files. More critically, attackers can exfiltrate CI secrets, environment variables containing API keys or database credentials, and tamper with generated build artifacts before deployment. This allows for potential persistence mechanisms in deployed applications or data theft from internal systems that trust the integrity of the build output. The risk is amplified by the fact that developers often run builds locally with elevated privileges or on shared CI servers where secrets are stored as environment variables.
The vulnerability was remediated by completely removing the use of vm.runInNewContext() for parsing magic comments. The updated implementation now employs a proper JavaScript parser to interpret comment content strictly as an object expression. This ensures that only plain literal values, such strings or numbers representing valid options like lazy and eager, are accepted. Any input containing non-literal constructs, including function calls, identifiers, or sequence expressions, is rejected with a build error rather than being executed. This change effectively neutralizes the code injection vector while maintaining backward compatibility for legitimate use cases, ensuring that developers can continue to control lazy loading behavior without exposing their build environments to remote code execution risks.