/

CVE-2026-44266

Severity:

CRITICAL RISK

(9.8)

Ruby Code Injection (CWE-94) in Elo Ruby Compiler Backend

CVE-2026-44266

Received

Vulnerability type

Category:

Code Injection

CWE:

CWE-94, CWE-116, CWE-1336

Impact:

Arbitrary Ruby code execution

Severity:

CRITICAL RISK

(9.8)

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

Elo's Ruby backend can emit attacker-controlled text inside Ruby double-quoted strings without neutralizing Ruby interpolation syntax. If the resulting Ruby is evaluated, crafted expressions may execute Ruby code, including shell commands; this issue is specific to Ruby emission.

Elo's Ruby backend can emit attacker-controlled text inside Ruby double-quoted strings without neutralizing Ruby interpolation syntax. If the resulting Ruby is evaluated, crafted expressions may execute Ruby code, including shell commands; this issue is specific to Ruby emission.

Affected context

The issue occurs in Elo's Ruby backend when it generates Ruby source from expressions containing attacker-controlled text. Relevant entry points include the /try playground when Ruby is selected, bin/eloc -t ruby -x, and defaultFormats.elo.parse() followed by Ruby emission. Risk depends on whether an attacker can supply or influence expressions and whether the generated Ruby is subsequently run. The described Ruby-specific path does not affect JavaScript, Python, or SQL emission.

The issue occurs in Elo's Ruby backend when it generates Ruby source from expressions containing attacker-controlled text. Relevant entry points include the /try playground when Ruby is selected, bin/eloc -t ruby -x, and defaultFormats.elo.parse() followed by Ruby emission. Risk depends on whether an attacker can supply or influence expressions and whether the generated Ruby is subsequently run. The described Ruby-specific path does not affect JavaScript, Python, or SQL emission.

Exploit preconditions

  • Attack surface: An Elo expression is processed through a Ruby-emission entry point.
  • Required access: Ability to submit or influence expression text; whether this is unauthenticated depends on how the entry point is exposed.
  • Trigger point: Generated Ruby is evaluated. A failing labelled subtype constraint can evaluate its message; an ordinary string literal can be evaluated when the compiled Ruby runs.
  • Why exploitation is possible: Attacker-controlled text is emitted into Ruby double-quoted strings without escaping interpolation syntax.
  • Attack surface: An Elo expression is processed through a Ruby-emission entry point.
  • Required access: Ability to submit or influence expression text; whether this is unauthenticated depends on how the entry point is exposed.
  • Trigger point: Generated Ruby is evaluated. A failing labelled subtype constraint can evaluate its message; an ordinary string literal can be evaluated when the compiled Ruby runs.
  • Why exploitation is possible: Attacker-controlled text is emitted into Ruby double-quoted strings without escaping interpolation syntax.

Why this happens

The Ruby emitter places text into double-quoted Ruby string literals without correctly escaping # and other syntax relevant to interpolation. Ruby may interpret embedded expressions when the generated code runs, turning data into executable logic. This is primarily CWE-94: Improper Control of Generation of Code, with CWE-116: Improper Encoding or Escaping of Output and CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine describing related aspects of the unsafe code-generation boundary.

The Ruby emitter places text into double-quoted Ruby string literals without correctly escaping # and other syntax relevant to interpolation. Ruby may interpret embedded expressions when the generated code runs, turning data into executable logic. This is primarily CWE-94: Improper Control of Generation of Code, with CWE-116: Improper Encoding or Escaping of Output and CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine describing related aspects of the unsafe code-generation boundary.

Potential impact

  • Attacker-controlled expressions could cause arbitrary Ruby code to run in the process executing the generated output.
  • The running process could execute shell commands with its existing privileges.
  • Application data or runtime resources could be accessed or modified, depending on the execution environment.
  • Other language targets are not affected by this Ruby-specific emission path.
  • Attacker-controlled expressions could cause arbitrary Ruby code to run in the process executing the generated output.
  • The running process could execute shell commands with its existing privileges.
  • Application data or runtime resources could be accessed or modified, depending on the execution environment.
  • Other language targets are not affected by this Ruby-specific emission path.

General mitigation guidance

Mitigation generally focuses on keeping expression data separate from generated code and ensuring generated output cannot reinterpret data as Ruby syntax.

  • Prefer code-generation approaches that avoid interpolating untrusted text into executable string literals.
  • Apply context-appropriate escaping or use safe literal-construction APIs for Ruby output.
  • Validate expression structure against a strict schema, while treating validation as a complement to safe emission.
  • Limit who can submit expressions and where generated Ruby can be executed.
  • Run generated code with least privilege and restrict its access to sensitive files, credentials, and system resources.

Mitigation generally focuses on keeping expression data separate from generated code and ensuring generated output cannot reinterpret data as Ruby syntax.

  • Prefer code-generation approaches that avoid interpolating untrusted text into executable string literals.
  • Apply context-appropriate escaping or use safe literal-construction APIs for Ruby output.
  • Validate expression structure against a strict schema, while treating validation as a complement to safe emission.
  • Limit who can submit expressions and where generated Ruby can be executed.
  • Run generated code with least privilege and restrict its access to sensitive files, credentials, and system resources.

How teams detect issues like this

  • Use static analysis to identify attacker-controlled values concatenated or interpolated into generated Ruby source.
  • Review Ruby string-literal emitters and subtype-constraint message handling for context-aware escaping.
  • Add tests that verify special characters remain inert in generated output and cannot become Ruby interpolation.
  • Enforce code-generation policies in review and CI, including checks that untrusted expression text is not emitted as executable syntax.
  • Automated code review tools may help flag unsafe source-generation patterns.
  • Use static analysis to identify attacker-controlled values concatenated or interpolated into generated Ruby source.
  • Review Ruby string-literal emitters and subtype-constraint message handling for context-aware escaping.
  • Add tests that verify special characters remain inert in generated output and cannot become Ruby interpolation.
  • Enforce code-generation policies in review and CI, including checks that untrusted expression text is not emitted as executable syntax.
  • Automated code review tools may help flag unsafe source-generation patterns.

Sources

SourceLink
github.comgithub.com/enspirit/elo/commit/51b869963fbe445c18328714a7ccfbd76b21ba38
github.comgithub.com/enspirit/elo/commit/d2a89a8db76a244eb740687524a7e8529b7554b5
github.comgithub.com/enspirit/elo/security/advisories/GHSA-7w38-ggh5-v542

Frequently asked

questions

It affects Elo's Ruby code-generation path. The described issue does not apply to JavaScript, Python, or SQL emission.

An attacker must be able to influence an Elo expression processed by a Ruby-emission entry point. Whether authentication is required depends on how that entry point is deployed.

Keep untrusted text as data rather than inserting it directly into generated Ruby, and use context-appropriate escaping or safe literal construction.

Review code generators for unsafe interpolation, test that special characters remain inert, validate accepted input structures, and restrict the privileges of processes that execute generated code.

It affects Elo's Ruby code-generation path. The described issue does not apply to JavaScript, Python, or SQL emission.

An attacker must be able to influence an Elo expression processed by a Ruby-emission entry point. Whether authentication is required depends on how that entry point is deployed.

Keep untrusted text as data rather than inserting it directly into generated Ruby, and use context-appropriate escaping or safe literal construction.

Review code generators for unsafe interpolation, test that special characters remain inert, validate accepted input structures, and restrict the privileges of processes that execute generated code.

Find out what's already
exploitable in your codebase.