Skip to main content

Elysia CVE-2025-66457

HIGH
Code Injection (CWE-94)
2025-12-09 security-advisories@github.com
7.5
CVSS 4.0 · Vendor: github
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Gain write access to cookie config (e.g. env var)
  2. Delivery
    Inject crafted JS into cookie secret/field
  3. Exploit
    Config injected unsanitised into compiled route
  4. Execution
    Code executes server-side on request
  5. Impact
    Arbitrary code execution on host

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Requires ALL of: (1) AOT/ahead-of-time compilation enabled, which is the default; (2) a cookie schema defined on a route (i.e. 'dynamic cookies' enabled, e.g. via t.Cookie({...})); and (3) attacker-controllable cookie config - specifically the cookie secrets, domain, or related fields, such as when these are provisioned from environment variables the attacker can set. The primary limiting factor is that the attacker must have write access to the cookie config or source code; if they can write source code the flaw is moot, so realistic risk exists only where config is externally provisioned (env injection) and untrusted. Impact escalates to a full unauthenticated RCE chain only when combined with prototype-pollution GHSA-hxj9-33pp-j2cc. Affected: elysiajs/elysia versions 1.4.17 and below on Node.js/Bun.

Impact

This is a genuine but conditional RCE (CWE-94 code injection) whose real-world priority is LOW-to-MODERATE despite the 7.5 CVSS 4.0 score. The strongest signal against high priority is the privilege requirement: the vendor's own advisory and CVSS vector both indicate PR:H and attack requirements (AT:P) - exploitation needs write access to the cookie config, which the advisory concedes is 'generally low' availability because an attacker with write access to source code already has full control. EPSS is low at 0.81% (56th percentile), consistent with a config-dependent flaw that is not mass-scannable, so it is unlikely to be opportunistically exploited at scale. KEV status is NO - not listed by CISA, so there is no confirmed active exploitation. A public POC exists (sportshead/elysia-poc) and a test case in the patch demonstrates the injection, so proof of exploitability is confirmed, but POC availability is distinct from active exploitation and should not be conflated. The CVSS vector marks AV:N, yet the description and advisory make clear the true injection surface is the cookie config (e.g. provisioned via environment variables), i.e. local/config control rather than a remote network payload - verify deployment model, as AV:N overstates remote reachability for most configurations. Net: a real vulnerability worth patching, but not an emergency unless the cookie config is attacker-influenceable (e.g. env-injected) AND the prototype-pollution chain (GHSA-hxj9-33pp-j2cc) is also present to enable full unauthenticated RCE.

Exploit ScenarioDerived

In a deployment where Elysia's cookie config (e.g. the signing secret or domain) is populated from an environment variable the attacker can influence, and a cookie schema is defined on a route with AOT compilation enabled (default), the attacker sets the config value to a crafted string like ' + console.log('pwned') + ' which is injected unsanitised into the compiled route function and executed as server-side code. A public POC (sportshead/elysia-poc) and a patch test case confirm the technique; chaining with GHSA-hxj9-33pp-j2cc (prototype pollution) upgrades this to a full RCE chain.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.8% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Oct 14, 2026

Code injection in the Elysia TypeScript framework (versions 1.4.17 and below) lets an attacker who can control the cookie configuration - such as cookie secrets or domain provisioned via environment variables - inject and execute arbitrary JavaScript when a route is compiled with dynamic cookies enabled (i.e. a cookie schema is present and the default AOT compilation is active). Exploitation is conditional and privilege-gated: the attacker must already possess write access to the app source code (in which case the flaw is largely moot) or, more realistically, to externally provisioned cookie config such as environment variables; the vendor notes that chaining this with prototype-pollution issue GHSA-hxj9-33pp-j2cc escalates it to a full RCE chain. Publicly available exploit code exists (including a dedicated PoC repository), but EPSS is low at 0.81% (56th percentile) and there is no CISA KEV confirmation of active exploitation; the vendor-released fix is version 1.4.18.

RemediationAI

Vendor-released patch: upgrade Elysia to version 1.4.18 or later, which contains the overrideUnsafeQuote escaping and the mergeDeep prototype-key hardening delivered in PR #1564 (commits 26935bf76ebc43b4a43d48b173fc853de43bb51e and 3af978663e437dccc6c1a2a3aff4b74e1574849e); see advisories GHSA-8vch-m3f4-q8jf and GHSA-hxj9-33pp-j2cc and the PoC at github.com/sportshead/elysia-poc. If immediate upgrade is not possible, apply the vendor's documented workaround of sanitizing cookie-related environment input by escaping backticks and ${ sequences before it reaches the cookie config (e.g. a helper that replaces with \ and ${ with $\{), accepting that this is a manual control that must be applied everywhere config is sourced. Because the root prerequisite is attacker-controllable cookie configuration, the strongest compensating control is to treat all cookie secrets, sign keys, and domain values as trusted-only: restrict who can set these environment variables, do not derive them from untrusted or user-influenced input, and audit config-provisioning paths; the trade-off is operational rigidity where config is dynamic per environment. Organizations concerned about the chained RCE should also ensure their dependency tree is free of the prototype-pollution issue referenced by GHSA-hxj9-33pp-j2cc, since only the combination escalates this code-injection flaw into a full remote exploitation chain.

Affected Packages

npm elysia fix: 1.4.18

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Elysia uses ahead-of-time (AOT) route compilation, in which a route's handler and its associated cookie metadata are assembled into generated JavaScript source and then evaluated. When dynamic cookies are enabled - that is, a cookie schema such as t.Cookie({ foo: t.Any() }) is attached to a route - the framework interpolates cookie configuration values (secrets, sign keys, domain, etc.) directly into template strings in the compiled output using single quotes and unescaped backtick/${ sequences. If those values are attacker-influenced (for example, set through environment variables), the injected text breaks out of the string literal and is executed as code at compile time. This is a classic CWE-94 improper control of code generation / code injection flaw: untrusted input is treated as code rather than data. The affected package is identified by CPE cpe:2.3:a:elysiajs:elysia:*:*:*:*:*:node.js:*:*, and the fix (PR #1564, commits 26935bf76ebc43b4a43d48b173fc853de43bb51e and 3af978663e437dccc6c1a2a3aff4b74e1574849e) introduces an overrideUnsafeQuote helper that escapes backticks and ${ sequences and also hardens mergeDeep in src/utils.ts by skipping the __proto__, constructor, and prototype keys to block the associated prototype-pollution vector.

Know when Elysia gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (github) PRIMARY 7.5 HIGH
CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
vuln.today AI 6.7 MEDIUM

Exploitation requires write access to the cookie config (env/config-provisioned), so AV:L and PR:H; successful injection yields arbitrary server-side code execution, giving C/I/A High.

3.1 AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
4.0 AV:L/AC:L/AT:N/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (github).

CVSS VectorVendor: github

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
High
User Interaction
None
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

DescriptionCVE.org

Elysia is a Typescript framework for request validation, type inference, OpenAPI documentation and client-server communication. Versions 1.4.17 and below are subject to arbitrary code execution from cookie config. When dynamic cookies are enabled (e.g. there an existing cookie schema), the cookie config is injected into the compiled route without first being sanitised. Availability of this exploit is generally low, but when combined with GHSA-hxj9-33pp-j2cc, it allows for a full RCE chain. An attack requires write access to either the Elysia app's source code (in which case the vulnerability is meaningless) or write access to the cookie config (perhaps where it is assumed to be provisioned by the environment). This issue is fixed in version 1.4.18.

Executive ViewAI

Why It Matters

Elysia, a TypeScript server framework used in our application stack, contains a code injection flaw in versions 1.4.17 and below that can let an attacker execute arbitrary JavaScript when a route is compiled with dynamic cookies enabled. The practical risk is concentrated in services where cookie secrets, domains, or other configuration are provisioned through environment variables or CI/CD pipelines that attackers could reach, and the vendor notes the flaw chains with prototype-pollution issue GHSA-hxj9-33pp-j2cc to reach full remote code execution. Publicly available exploit code exists, but there is no CISA KEV confirmation of active exploitation and EPSS is low at 0.81%, so this is a patchable exposure that should be closed through standard dependency management rather than an emergency response.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.8%
Top 44% exploitable
Prevalence
Low
Niche TypeScript/Bun web framework, limited enterprise production footprint
Exploit
POC
Public exploit code exists
Data Quality
4 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC Yes
EPSS 0.8%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
Poc
System Exposure· derived
Open
Automatable· derived
No
Human Impact
High

Priority Score

59
Low Medium High Critical
KEV: 0
EPSS: +1
CVSS: +38
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Code Injection CRITICAL

Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

Affected Products (CPE)CVE.org

cpe:2.3:a:elysiajs:elysia:*:*:*:*:*:node.js:*:*

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy