7.5high
Elysia affected by arbitrary code injection through cookie config
- Severity
- 7.5high CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.86% (higher than 59% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-8vch-m3f4-q8jf
Description
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| elysiajs elysia | < 1.4.18, before 1.4.18 | CVE List, NVD |
| elysia (npm) | before 1.4.18 | GitHub Advisory Database |
All scores
| GitHub_M | 7.5high CVSS:4.0 | 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 |
| GitHub | high CVSS:4.0 | 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 |
| NVD | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.
What each source says
CVE List
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.
GitHub Advisory Database
Arbitrary code execution from cookie config. If dynamic cookies are enabled (ie there exists a schema for cookies), the cookie config is injected into the compiled route without first being sanitised.
Availability of this exploit is generally low, as it 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).
However when combined with GHSA-hxj9-33pp-j2cc, this vulnerability allows for a full RCE chain.
Impact
- aot enabled (default)
- cookie schema passed to route
- Cookie config controllable eg. via env
Example of vulnerable code
new Elysia({
cookie: {
secrets: `' + console.log('pwned from secrets') + '`
},
})
.get("/", () => "hello world", {
cookie: t.Cookie({
foo: t.Any(),
}),
})
POC: https://github.com/sportshead/elysia-poc
Patches
Patched by 1.4.17 (https://github.com/elysiajs/elysia/pull/1564)
Reference commit:
- https://github.com/elysiajs/elysia/pull/1564/commits/26935bf76ebc43b4a43d48b173fc853de43bb51e
- https://github.com/elysiajs/elysia/pull/1564/commits/3af978663e437dccc6c1a2a3aff4b74e1574849e
Workarounds
Sanitize cookie-related env input
const overrideUnsafeQuote = (value: string) =>
// '`' + value + '`'
'`' + value.replace(/'/g, '\\`').replace(/\${/g, '$\\{') + '`'
NVD (es)
Elysia es un framework de Typescript para validación de peticiones, inferencia de tipos, documentación OpenAPI y comunicación cliente?servidor. Las versiones?1.4.17 y anteriores están sujetas a ejecución de código arbitrario a partir de la configuración de cookie. Cuando las cookies dinámicas están activadas (por ejemplo, existe un esquema de cookie), la configuración de cookie se inyecta en la ruta compilada sin antes ser depurada. La disponibilidad de este exploit es generalmente baja, pero cuando se combina con GHSA?hxj9?33pp?j2cc, permite una cadena completa de ejecución remota de código. Un ataque requiere acceso de escritura ya sea al código fuente de la aplicación Elysia (en cuyo caso la vulnerabilidad no tiene sentido) o al acceso de escritura a la configuración de cookie (quizá donde se asume que es aprovisionada por el entorno). Este problema está corregido en la versión?1.4.18.
References
| https://github.com/elysiajs/elysia/security/advisories/GHSA-8vch-m3f4-q8jf | exploit, patch, vendor-advisory, web | |
| https://github.com/elysiajs/elysia/security/advisories/GHSA-hxj9-33pp-j2cc | not-applicable, web | |
| https://github.com/elysiajs/elysia/pull/1564 | issue-tracking, patch, web | |
| https://github.com/elysiajs/elysia/commit/26935bf76ebc43b4a43d48b173fc853de43bb51e | patch, web | |
| https://github.com/elysiajs/elysia/commit/3af978663e437dccc6c1a2a3aff4b74e1574849e | patch, web | |
| https://github.com/sportshead/elysia-poc | exploit, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2025-66457 | advisory | |
| https://github.com/elysiajs/elysia | package | |
Related
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-66457 changed 2025-12-12 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-8vch-m3f4-q8jf changed 2026-02-04 | CC-BY-4.0 |
| NVD | CVE-2025-66457 changed 2026-10-14 | Public domain |