/

CVE-2026-127109

Severity:

HIGH RISK

(8.1)

Code Injection (CWE-94) in promzard Template Loader

CVE-2026-127109

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary Code Execution

Severity:

HIGH RISK

(8.1)

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

promzard can execute attacker-supplied JavaScript when property names in its context object are inserted into a generated function without validation or escaping. An attacker who can control those names may run code with the privileges of the Node.js process, even if the template itself is trusted.

Affected context

The issue occurs in promzard's template-loading functionality, where context property names are incorporated into generated JavaScript and evaluated with vm.runInThisContext(). Deployments may be at risk when an attacker can influence property names supplied in the context object; the template file does not need to be attacker-controlled.

Exploit preconditions

  • Attack surface: The application's use of promzard's template-loading functionality
  • Required access: Ability to influence property names in the context object
  • Trigger point: Generation and evaluation of the function used to load a template
  • Why exploitation is possible: Property names are inserted into generated source without validation or escaping before evaluation

Why this happens

The library constructs executable source by inserting context property names into a function parameter list, then evaluates that source. Because those names are not validated or escaped, crafted input can alter the generated JavaScript rather than remain data. This is CWE-94: Improper Control of Generation of Code ('Code Injection').

Potential impact

  • An attacker may execute arbitrary JavaScript with the privileges of the Node.js process.
  • The attacker could access or modify data available to that process.
  • The affected application or its runtime environment may be compromised.
  • Further impact could depend on the process's permissions and accessible resources.

General mitigation guidance

Mitigation generally focuses on preventing untrusted values from becoming executable source.

  • Avoid constructing function source from context property names; use data-driven interfaces that do not require code generation.
  • Treat property names as untrusted input and constrain them to an explicit, validated set where applicable.
  • Prefer secure-by-default APIs that do not evaluate dynamically generated code.
  • Limit the Node.js process's privileges and access to sensitive resources to reduce potential impact.

How teams detect issues like this

  • Use static analysis to identify dynamic code evaluation and string construction used to generate executable source.
  • Review code paths where context keys or other user-influenced values enter function parameters or generated code.
  • Enforce policies that restrict dynamic evaluation and require validation of values crossing trust boundaries.
  • Automated code review tools may help flag code-generation and evaluation patterns for manual assessment.

Sources

SourceLink
github.comgithub.com/npm/promzard
kb.cert.orgkb.cert.org/vuls/id/685399

Frequently asked

questions

Yes. The described issue concerns context property names, so a trusted template does not prevent exploitation when an attacker can control those names.

The attacker needs a way to influence property names in the context object processed by promzard. The required access depends on how the application constructs and supplies that object.

Avoid inserting context values into generated executable source. Use a data-driven design and constrain inputs before they reach sensitive processing.

Minimize dynamic code generation and evaluation, validate untrusted inputs at trust boundaries, and apply least privilege to the Node.js process.

Find out what's already
exploitable in your codebase.