Summary
Before version 1.0.1, crafted plain Elo strings can pass through member access and JavaScript compilation to execute attacker-selected code in the host runtime. Depending on where the string is processed, this may enable script execution in a browser or arbitrary code execution in a Node.js environment.
Affected context
The vulnerability affects plain-string inputs processed through Elo's defaultFormats.elo.parse(), bin/elo, or the online playground. It occurs when member access involving meta-properties such as constructor is accepted and emitted into generated JavaScript without being rejected. The auto-running playground and Node.js hosts that execute generated output have different exposure and impact; this plain-string issue is distinct from programmatic AST-object injection.
Exploit preconditions
- Attack surface: An Elo parser or execution path, including the browser playground, CLI, or a Node.js integration
- Required access: Ability to supply or influence a plain Elo string that the affected path processes
- Trigger point: Parsing and execution of the generated JavaScript; the playground may run submitted input automatically
- Why exploitation is possible: The parser accepts
constructoras an identifier, the member-access handler does not reject the relevant meta-properties, and the JavaScript compiler emits the surviving property access
Why this happens
The issue is an unsafe code-generation pattern. The parser treats constructor as an ordinary identifier, and the transformer permits a meta-property access chain to survive into JavaScript output. Because the generated code can reach JavaScript's Function constructor, attacker-controlled input can become executable code. This maps primarily to CWE-94: Improper Control of Generation of Code; related weaknesses include cross-site scripting and inadequate security control enforcement.
Potential impact
- A browser-based playground may execute attacker-controlled script in a user's session.
- Affected browser sessions could be compromised.
- A Node.js process may execute arbitrary code when it processes and runs affected input.
- CI, DevOps, or library-hosting environments could be exposed to compromise, depending on how inputs are sourced and what privileges the process has.
General mitigation guidance
Defensive patterns focus on preventing untrusted expressions from becoming executable host-language code.
- Reject or safely handle meta-properties and other member access patterns that can reach dynamic code constructors.
- Prefer a constrained interpreter or allowlisted expression model over emitting and executing general-purpose JavaScript.
- Treat expressions from users, external services, and mutable configuration as untrusted; validate them against a strict grammar before processing.
- Avoid automatically executing submitted expressions, and isolate evaluation from sensitive browser or server contexts.
- Apply least privilege and process isolation so an expression evaluator has limited access to files, credentials, and other services.
How teams detect issues like this
- Use static analysis to identify generated-code paths that preserve user-controlled member access or expose dynamic function constructors.
- During code review, trace expression input from parsing through transformation and compilation, checking whether validation occurs before code generation or execution.
- Add tests and policy checks that reject disallowed meta-properties and verify that generated output cannot invoke dynamic code construction.
- Review integrations and CI policies for execution of generated code derived from untrusted strings; automated code review tools may help flag risky patterns.

