Summary
Elo's programmatic AST API can place unvalidated values into generated JavaScript, Ruby, Python, or SQL, where those values may be interpreted as code rather than data. If an attacker can influence values supplied to the AST, this may enable code execution in the generated-language targets or SQL injection in the SQL target.
Elo's programmatic AST API can place unvalidated values into generated JavaScript, Ruby, Python, or SQL, where those values may be interpreted as code rather than data. If an attacker can influence values supplied to the AST, this may enable code execution in the generated-language targets or SQL injection in the SQL target.
Affected context
The issue occurs when Elo builds output from programmatic AST objects containing values from JSON-deserialized input, plugin output, or other untyped sources. Affected AST fields include literal values, variable and property names, object keys, datapath segments, lambda parameter names, and SQL let-binding names. The vulnerability concerns this AST-object path; it is distinct from the plain-string constructor-chain sandbox escape.
The issue occurs when Elo builds output from programmatic AST objects containing values from JSON-deserialized input, plugin output, or other untyped sources. Affected AST fields include literal values, variable and property names, object keys, datapath segments, lambda parameter names, and SQL let-binding names. The vulnerability concerns this AST-object path; it is distinct from the plain-string constructor-chain sandbox escape.
Exploit preconditions
- Attack surface: Programs or integrations that construct Elo AST objects from externally influenced or otherwise untyped values
- Required access: The ability to influence values assigned to affected AST fields, directly or through a plugin or data source
- Trigger point: Generation or evaluation of target-language output from the AST
- Why exploitation is possible: Values are interpolated into generated code or SQL without runtime syntax validation, so crafted values may be treated as expressions or identifiers
- Attack surface: Programs or integrations that construct Elo AST objects from externally influenced or otherwise untyped values
- Required access: The ability to influence values assigned to affected AST fields, directly or through a plugin or data source
- Trigger point: Generation or evaluation of target-language output from the AST
- Why exploitation is possible: Values are interpolated into generated code or SQL without runtime syntax validation, so crafted values may be treated as expressions or identifiers
Why this happens
The AST API accepts values without validating that they conform to the expected syntax or data type before inserting them into generated output. This is an input-validation failure (CWE-20) that can result in code injection (CWE-94) in JavaScript, Ruby, and Python, or SQL injection (CWE-89) in the SQL target. The underlying insecure pattern is treating untrusted values as code or identifiers instead of keeping them separate from executable syntax.
The AST API accepts values without validating that they conform to the expected syntax or data type before inserting them into generated output. This is an input-validation failure (CWE-20) that can result in code injection (CWE-94) in JavaScript, Ruby, and Python, or SQL injection (CWE-89) in the SQL target. The underlying insecure pattern is treating untrusted values as code or identifiers instead of keeping them separate from executable syntax.
Potential impact
- Crafted AST values may execute attacker-controlled code in generated JavaScript, Ruby, or Python contexts.
- SQL output may be altered, potentially exposing or changing data or affecting database operations.
- The impact may extend to resources and privileges available to the process or database account running the generated output.
- Crafted AST values may execute attacker-controlled code in generated JavaScript, Ruby, or Python contexts.
- SQL output may be altered, potentially exposing or changing data or affecting database operations.
- The impact may extend to resources and privileges available to the process or database account running the generated output.
General mitigation guidance
Defensive patterns focus on validating AST inputs and separating data from executable syntax:
- Use typed AST constructors and reject values that do not match the expected type or grammar.
- Apply strict allowlists and context-specific validation to identifiers, property names, keys, and path segments.
- Keep literal data separate from generated syntax, using parameterized queries for SQL values where supported.
- Prefer safe-by-default APIs that cannot interpolate arbitrary strings as expressions or identifiers.
- Reduce trust in plugin and deserialized input, and run generated code and database operations with least privilege.
Defensive patterns focus on validating AST inputs and separating data from executable syntax:
- Use typed AST constructors and reject values that do not match the expected type or grammar.
- Apply strict allowlists and context-specific validation to identifiers, property names, keys, and path segments.
- Keep literal data separate from generated syntax, using parameterized queries for SQL values where supported.
- Prefer safe-by-default APIs that cannot interpolate arbitrary strings as expressions or identifiers.
- Reduce trust in plugin and deserialized input, and run generated code and database operations with least privilege.
How teams detect issues like this
- Use static analysis to identify direct interpolation of AST fields into generated source or SQL.
- Review code paths that accept JSON, plugin output, or other untyped data and trace values through code-generation functions.
- Add tests and policy checks requiring type and grammar validation for AST values and parameterization of SQL data.
- Automated code review tools may help flag unsafe interpolation and missing validation.
- Use static analysis to identify direct interpolation of AST fields into generated source or SQL.
- Review code paths that accept JSON, plugin output, or other untyped data and trace values through code-generation functions.
- Add tests and policy checks requiring type and grammar validation for AST values and parameterization of SQL data.
- Automated code review tools may help flag unsafe interpolation and missing validation.

