Summary
A template injection vulnerability in Nuxt allows an attacker to supply a template key through the /__nuxt_island/ props path and have it processed by a dynamic component. When vue.runtimeCompiler: true is enabled, this may result in code execution within the Nitro server process.
Affected context
The issue can occur in Nuxt applications that use the affected framework releases, expose the Nuxt Island props handling path, and enable vue.runtimeCompiler: true. Risk is concentrated where attacker-controlled props can reach a dynamic component and be interpreted as a Vue template within the Nitro process.
Exploit preconditions
- Attack surface: The Nuxt Island props handling endpoint, including
/__nuxt_island/ - Required access: Ability to send requests or otherwise influence props accepted by the application
- Trigger point: Processing attacker-influenced template data through a dynamic component
- Required configuration:
vue.runtimeCompiler: true - Why exploitation is possible: User-controlled template content can reach a runtime compiler instead of being treated solely as inert data
Why this happens
The underlying bug is insufficient separation between untrusted component properties and executable template content. When a template key supplied through the Nuxt Island props path is passed to a dynamic component, the Vue runtime compiler may interpret that value as a template. This behavior maps primarily to CWE-94, Improper Control of Generation of Code, and is also related to CWE-74, Injection, because attacker-controlled input reaches an interpreter without adequate trust or context enforcement.
Potential impact
- An attacker may execute code within the Nitro server process
- The application process could be compromised
- Server-side secrets or environment data may be exposed
- The attacker could alter rendered content or application behavior
- The compromise could enable further access to connected services, depending on process privileges
General mitigation guidance
Mitigation generally focuses on preventing untrusted data from becoming
executable template content.
Common defensive patterns include:
- Avoiding runtime template compilation when it is not required
- Treating component props and template identifiers as data, not markup or code
- Allowlisting dynamic components and accepted template keys
- Enforcing strict schemas and type validation at the request boundary
- Separating trusted server-defined templates from user-controlled input
- Running the Nitro process with least privilege and limiting access to secrets
- Applying network and filesystem restrictions to reduce post-compromise impact
How teams detect issues like this
Detection approaches may include:
- Static analysis for runtime compiler activation and dynamic template construction
- Code review checks for request-derived values reaching dynamic components
- Searches for unrestricted template, component, or render-function inputs
- Runtime monitoring of unusual template-related requests to Nuxt Island endpoints
- Policy enforcement requiring allowlists for dynamic components and template keys
- Automated security review tools that flag interpreter boundaries involving user input

