Skip to content

Codegen can emit C++ calls and type names taken from the input script

High
luisleo526 published GHSA-5www-2x9c-mgr6 Oct 23, 2026

Package

npm @pineforge/codegen-pyodide (npm)

Affected versions

>= 0.7.0, < 1.6.3

Patched versions

1.6.3
pip pineforge-codegen (pip)
>= 0.6.4, < 1.6.3
1.6.3

Description

pineforge-codegen translates Pine v6 scripts into C++. In affected releases, two emission paths could write a name taken from the input script into the generated C++ without passing the codegen's name allocator, string escaper or a codegen-owned table: (1) a call to a function the codegen has no lowering for was written out as C++ call text instead of being refused; (2) a token in a type position was not checked against the type grammar before being written out as a C++ type name. A crafted Pine script could therefore make the generated program contain C++ calls or type names that the codegen never chose. Because the consumer chain compiles and runs the generated C++, this can affect the confidentiality, integrity and availability of the host that builds or runs it.

Affected: pineforge-codegen on PyPI, versions >= 0.6.4 and < 1.6.3, and @pineforge/codegen-pyodide on npm, versions >= 0.7.0 and < 1.6.3, which ships the same Python sources. Images of ghcr.io/pineforge-4pass/pineforge-release before 1.6.3 contain an affected codegen.

Fixed: in 1.6.3 of both packages, by commit 0418898 in pineforge-codegen-oss, released in 1.6.3. The 1.6.3 image of ghcr.io/pineforge-4pass/pineforge-release contains the fixed codegen. The generated C++ is no longer written from the script's names on these two paths.

Upgrade: install pineforge-codegen 1.6.3 or later (pip install --upgrade "pineforge-codegen>=1.6.3"), @pineforge/codegen-pyodide 1.6.3 or later, or the 1.6.3 image. Generated C++ that was produced by an affected release from a script you do not trust should be treated as untrusted: regenerate it with 1.6.3 before compiling or running it.

Mitigation if you cannot upgrade yet: do not compile or run C++ generated from a script you would not trust. From 1.6.2-rc.1 the package ships the pf-cpp-allowlist command, which flags dangerous primitives in a generated translation unit; it is a denylist with known false positives, a mitigation and not proof that a unit is safe.

This advisory deliberately contains no reproduction recipe.

Severity

High

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

CVE ID

No known CVE

Weaknesses

Improper Control of Generation of Code

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. Learn more on MITRE.