7.2high
Preact has JSON VNode Injection issue
- Severity
- 7.2high CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.27% (higher than 20% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-36hm-qxxp-pg3m
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).
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| preactjs preact | >= 10.26.5, < 10.26.10, >= 10.27.0, < 10.27.3, >= 10.28.0, < 10.28.2, from 10.26.5 before 10.26.10, from 10.27.0 before 10.27.3, from 10.28.0 before 10.28.2 | CVE List, NVD |
| preact (npm) | from 10.26.5 before 10.26.10, from 10.27.0 before 10.27.3, from 10.28.0 before 10.28.2 | GitHub Advisory Database |
All scores
| GitHub_M | 7.2high CVSS:4.0 | 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 |
| GitHub | high CVSS:4.0 | 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 |
| NVD | 6.1medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total.
What each source says
CVE List
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).
GitHub Advisory Database
Impact
Vulnerability Type: HTML Injection via JSON Type Confusion
Affected Versions: Preact 10.26.5 through 10.28.1
Severity: Low to Medium (see below)
Who is Impacted?
Applications using affected Preact versions are vulnerable if they meet all of the following conditions:
- Pass unmodified, unsanitized values from user-modifiable data sources (APIs, databases, local storage, etc.) directly into the render tree
- Assume these values are strings but the data source could return actual JavaScript objects instead of JSON strings
- 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)
Technical Details
Preact includes 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.
Important Notes:
- This regression was never present in
preact-render-to-string - This is primarily an "expanded attack surface" issue rather than a standalone vulnerability
- Exploitation requires either insecure API design (no type validation) or a compromised data source
Patches
Patched Versions:
- 10.26.10 (for 10.26.x users)
- 10.27.3 (for 10.27.x users)
- 10.28.2 (for 10.28.x users)
Users should upgrade to the latest patch version of whatever minor version they are on, which can be done via npm update preact or by installing one of the above versions directly.
The patch versions simply restore the previous strict equality checks that prevent JSON-parsed objects from being treated as valid VNodes.
Mitigations
If you cannot upgrade immediately, implement the following mitigations:
- Validate input types: Don't accept arbitrary objects as inputs in your API and blindly store them. Enforce strict type contracts at API boundaries.
- Cast or validate network data: Don't assume strings are strings if your code got them from the network. Always cast to the expected type or validate before rendering.
- Sanitize external data: Validate that data from external sources (APIs, storage, databases) matches expected types before passing it to preact.
- Use Content Security Policy (CSP): Implement a strict CSP to prevent inline script execution as a defense-in-depth measure.
References
- Reporter: YoungGeun Choi
- Affected Versions: 10.26.5 - 10.28.1
- Patched Versions: 10.26.10, 10.27.3, 10.28.2
Credits
Preact thanks YoungGeun Choi (Xvezda) for the responsible disclosure of this vulnerability and for providing detailed reproduction steps and proof-of-concept demonstrations.
Timeline
- 2026-01-04: Initial vulnerability report received
- 2026-01-05: Clarification requested regarding network/serialization boundary
- 2026-01-06: Network PoC provided demonstrating real-world exploitatibility
- 2026-01-06: Hotfix patches released (10.26.10, 10.27.3, 10.28.2)
Recommendation: All users of Preact 10.26.5 through 10.28.1 should upgrade to the appropriate patched version (10.26.10, 10.27.3, or 10.28.2) as soon as possible, and review their applications for proper input validation and sanitization practices.
NVD (es)
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).
References
| https://github.com/preactjs/preact/security/advisories/GHSA-36hm-qxxp-pg3m | exploit, mitigation, vendor-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-22028 | advisory | |
| https://github.com/preactjs/preact | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-22028 changed 2026-01-08 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-36hm-qxxp-pg3m changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2026-22028 changed 2026-06-17 | Public domain |