CVE-2025-66457
JSON

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 packageVersionsReported by
elysiajs elysia< 1.4.18, before 1.4.18CVE List, NVD
elysia (npm)before 1.4.18GitHub Advisory Database

All scores

GitHub_M7.5high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
NVD8.8high CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Classification

CWE-94

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:

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

Related

Sources

SourceRecordLicence
CVE ListCVE-2025-66457 changed 2025-12-12CVE Terms of Use
GitHub Advisory DatabaseGHSA-8vch-m3f4-q8jf changed 2026-02-04CC-BY-4.0
NVDCVE-2025-66457 changed 2026-10-14Public domain