/

CVE-2026-73299

Severity:

CRITICAL RISK

(10.0)

Code Injection (CWE-94) in Prompty Nunjucks Renderer

CVE-2026-73299

Deferred

Vulnerability type

Category:

Server-Side Template Injection

CWE:

CWE-94, CWE-1336

Impact:

Arbitrary Code Execution

Severity:

CRITICAL RISK

(10.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Prompty's TypeScript Nunjucks renderer evaluated untrusted .prompty template bodies with unrestricted JavaScript member access. An attacker who can supply or influence a template may traverse JavaScript constructor and prototype properties, potentially executing arbitrary JavaScript in the host Node.js process.

Affected context

The vulnerability occurs in applications that render attacker-controlled or insufficiently trusted .prompty files through the TypeScript Nunjucks renderer. Risk is highest when template content can be uploaded, modified through a repository or content-management workflow, or otherwise introduced into a Node.js process that has access to sensitive application resources.

Exploit preconditions

  • Attack surface: Prompty .prompty template rendering in a Node.js application
  • Required access: Ability to create, modify, or influence a rendered template body
  • Trigger point: Evaluation of the template by the TypeScript Nunjucks renderer
  • Why exploitation is possible: Unrestricted JavaScript member access permits traversal of constructor and prototype properties during template evaluation, allowing template expressions to reach executable host-language behavior

Why this happens

The underlying bug is a server-side template injection condition combined with insufficient sandboxing of JavaScript member access. The renderer treated template expressions as trusted while allowing access to sensitive constructor and prototype properties, enabling a template to cross the intended data-only boundary and invoke host-process capabilities. This maps primarily to CWE-94: Improper Control of Generation of Code, with CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine describing the template-injection aspect.

Potential impact

  • Arbitrary JavaScript execution in the Node.js host process may occur
  • Confidential application data could be read or altered
  • Application credentials, environment values, or service tokens could be exposed
  • The affected service could be disrupted or used for further compromise
  • Downstream systems or generated prompt workflows could be tampered with

General mitigation guidance

Mitigation generally focuses on treating .prompty bodies as untrusted code-bearing input rather than ordinary content.

Common defensive patterns include:

  • Use a renderer configuration that restricts member access and prevents traversal into constructors, prototypes, and other runtime internals
  • Prefer data-only template substitution or a constrained templating engine when dynamic logic is unnecessary
  • Apply strict allowlists for template variables, functions, filters, and object properties
  • Separate template rendering into a minimally privileged process or sandbox where practical
  • Reduce the trust and mutability of template sources through controlled repositories, review, and integrity checks
  • Keep rendered processes isolated from sensitive files, credentials, metadata services, and administrative APIs
  • Apply least-privilege permissions and restrictive runtime policies to the Node.js service

How teams detect issues like this

Detection can combine source analysis, dependency review, and runtime controls:

  • Search code and configuration for Nunjucks environments that render user-controlled template bodies or expose unrestricted JavaScript objects
  • Review template contexts for sensitive objects, functions, constructors, prototypes, and dynamic property resolution
  • Add static-analysis or pull-request rules for server-side template rendering of untrusted content
  • Monitor template uploads, repository changes, and rendering events for unexpected sources or anomalous execution behavior
  • Enforce policy requiring approved template engines, restricted environments, and explicit input-trust documentation
  • Use automated security review tools to identify template injection and unsafe member-access patterns

Sources

SourceLink
github.comgithub.com/microsoft/prompty/commit/e4a0ebf49e3a78d5d7796c8480bf9a4f0c54d19e
github.comgithub.com/microsoft/prompty/commit/f5c57c94a0990cca79d095c3daab661b4b1fb89f
github.comgithub.com/microsoft/prompty/pull/404
github.comgithub.com/microsoft/prompty/pull/405
github.comgithub.com/microsoft/prompty/security/advisories/GHSA-w28w-gp39-m4p6
github.comgithub.com/microsoft/prompty/tree/typescript/2.0.0-beta.5

Frequently asked

questions

It can be remotely exploitable when an attacker can upload, modify, or otherwise influence .prompty content that a network-accessible service renders. If templates are strictly trusted and immutable, that attack path is reduced.

Not necessarily. The required access depends on how templates enter the application; a public upload or compromised content pipeline could provide the necessary influence, while other deployments may require authenticated repository or administrative access.

Render untrusted templates with a restricted, data-only environment that blocks constructor and prototype traversal. Avoid exposing powerful host objects or executable functions to template expressions.

Classify template files as executable input, enforce source integrity and review, apply least privilege to rendering processes, and use static analysis and policy checks for unsafe template configurations.

Find out what's already
exploitable in your codebase.