Summary
Preact has JSON VNode Injection issue
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
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.
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)
An object is accessed using a type that is incompatible with its actual type, causing the runtime to interpret memory incorrectly. Typical impact: memory safety violations, unexpected behavior, or code execution.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
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.
Frequently Asked Questions
- What is CVE-2026-22028? CVE-2026-22028 is a high-severity type confusion vulnerability in preact (npm), affecting versions >= 10.26.5, < 10.26.10. It is fixed in 10.26.10, 10.27.3, 10.28.2. An object is accessed using a type that is incompatible with its actual type, causing the runtime to interpret memory incorrectly.
- Which versions of preact are affected by CVE-2026-22028? preact (npm) versions >= 10.26.5, < 10.26.10 is affected.
- Is there a fix for CVE-2026-22028? Yes. CVE-2026-22028 is fixed in 10.26.10, 10.27.3, 10.28.2. Upgrade to this version or later.
- Is CVE-2026-22028 exploitable, and should I be worried? Whether CVE-2026-22028 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-22028 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-22028?
- Upgrade
preactto 10.26.10 or later - Upgrade
preactto 10.27.3 or later - Upgrade
preactto 10.28.2 or later
- Upgrade