CVE-2026-53597: Prompty Arbitrary Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-c4gh-rv8h-q9vw
CWE-94
Published
Advisory Summary

CVE-2026-53597 is a HIGH arbitrary code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Prompty libraries in the npm ecosystem. The issue involves arbitrary code execution via javascript frontmatter in typescript loader. Remediation is available by upgrading affected packages to version 2.0.0-beta.3.

CVE-2026-53597 at a Glance

CVE Identifier CVE-2026-53597
GHSA Identifier GHSA-c4gh-rv8h-q9vw
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Prompty
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2026-53597

To remediate this vulnerability, upgrade all affected Prompty dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@prompty/core fixed: 2.0.0-beta.3
npm install @prompty/core@2.0.0-beta.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls @prompty/core

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-53597, inspect your project dependencies using npm:

npm ls @prompty/core

Analyze the terminal output to locate any version of Prompty in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.0-beta.3), your application is affected.

Note: The npm ls @prompty/core command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Prompty, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary The TypeScript Prompty loader used `gray-matter` without overriding executable frontmatter engines. `gray-matter` supports JavaScript frontmatter blocks such as `---js` and evaluates them while parsing. An attacker-controlled `.prompty` file could therefore execute arbitrary JavaScript during prompt loading. ## Affected package - npm `@prompty/core` v2 prerelease line: `>= 2.0.0-alpha.1 < 2.0.0-beta.3` - Fixed in `@prompty/core@2.0.0-beta.3` The legacy v1 JavaScript runtime had a historical hardening change for this issue. During the v2 TypeScript runtime rebuild, the loader again called `gray-matter` directly and the vulnerable behavior was present in the v2 prerelease packages until `2.0.0-beta.3`. ## Impact Applications that load untrusted `.prompty` files, user-provided prompt paths, or prompt bundles from less-trusted locations could execute arbitrary JavaScript in the host Node.js process during frontmatter parsing. ## Remediation Upgrade `@prompty/core` to `2.0.0-beta.3` or later. The fix explicitly overrides the `js` and `javascript` gray-matter engines and rejects JavaScript frontmatter in `.prompty` files. Prompty frontmatter is YAML-only; executable frontmatter is unsupported. A regression test now verifies that `---js` frontmatter is rejected and not evaluated. ## Fix details Fixed by commit `c27402da2487075be577f06aa79df627fb9d6853` and released via `typescript/2.0.0-beta.3`.

CVE-2026-53597 Affected Prompty Versions

1 component(s)
Fixed Versions:
2.0.0-beta.3
Product / Package Ecosystem Affected Versions Fixed Version
@prompty/core
npm
≥ 2.0.0-alpha.1
< 2.0.0-beta.3
2.0.0-beta.3

References

Frequently Asked Questions

What is CVE-2026-53597?
CVE-2026-53597 is a security vulnerability in Prompty involving Arbitrary code execution via JavaScript frontmatter in TypeScript loader under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Prompty versions are affected?
Affected versions include releases prior to 2.0.0-beta.3 across affected packages: @prompty/core.
What version fixes CVE-2026-53597?
Upgrading to 2.0.0-beta.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @prompty/core affected?
Yes, @prompty/core is affected in releases prior to 2.0.0-beta.3. Upgrade your dependency to 2.0.0-beta.3 or later.
What CWE is associated with CVE-2026-53597?
CVE-2026-53597 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check npm dependencies for CVE-2026-53597?
Run the dependency tree command: 'npm ls @prompty/core'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-c4gh-rv8h-q9vw",
  "modified" : "2026-07-17T19:53:34Z",
  "published" : "2026-07-17T19:53:34Z",
  "aliases" : [ "CVE-2026-53597" ],
  "summary" : "Prompty: Arbitrary code execution via JavaScript frontmatter in TypeScript loader",
  "details" : "## Summary\nThe TypeScript Prompty loader used `gray-matter` without overriding executable frontmatter engines. `gray-matter` supports JavaScript frontmatter blocks such as `---js` and evaluates them while parsing. An attacker-controlled `.prompty` file could therefore execute arbitrary JavaScript during prompt loading.\n\n## Affected package\n- npm `@prompty/core` v2 prerelease line: `>= 2.0.0-alpha.1 < 2.0.0-beta.3`\n- Fixed in `@prompty/core@2.0.0-beta.3`\n\nThe legacy v1 JavaScript runtime had a historical hardening change for this issue. During the v2 TypeScript runtime rebuild, the loader again called `gray-matter` directly and the vulnerable behavior was present in the v2 prerelease packages until `2.0.0-beta.3`.\n\n## Impact\nApplications that load untrusted `.prompty` files, user-provided prompt paths, or prompt bundles from less-trusted locations could execute arbitrary JavaScript in the host Node.js process during frontmatter parsing.\n\n## Remediation\nUpgrade `@prompty/core` to `2.0.0-beta.3` or later.\n\nThe fix explicitly overrides the `js` and `javascript` gray-matter engines and rejects JavaScript frontmatter in `.prompty` files. Prompty frontmatter is YAML-only; executable frontmatter is unsupported. A regression test now verifies that `---js` frontmatter is rejected and not evaluated.\n\n## Fix details\nFixed by commit `c27402da2487075be577f06aa79df627fb9d6853` and released via `typescript/2.0.0-beta.3`.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@prompty/core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0-alpha.1"
      }, {
        "fixed" : "2.0.0-beta.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/microsoft/prompty/security/advisories/GHSA-c4gh-rv8h-q9vw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-53597"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/microsoft/prompty/commit/c27402da2487075be577f06aa79df627fb9d6853"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/microsoft/prompty"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-17T19:53:34Z",
    "nvd_published_at" : "2026-07-16T16:19:12Z"
  }
}