Skip to content

🚨 [security] Update preact 10.27.2 → 10.29.0 (minor)#962

Open
depfu[bot] wants to merge 1 commit intomainfrom
depfu/update/pnpm/preact-10.29.0
Open

🚨 [security] Update preact 10.27.2 → 10.29.0 (minor)#962
depfu[bot] wants to merge 1 commit intomainfrom
depfu/update/pnpm/preact-10.29.0

Conversation

@depfu
Copy link
Contributor

@depfu depfu bot commented Mar 11, 2026


🚨 Your current dependencies have known security vulnerabilities 🚨

This dependency update fixes known security vulnerabilities. Please see the details below and assess their impact carefully. We recommend to merge and deploy this as soon as possible!


Here is everything you need to know about this update. Please take a good look at what changed and the test results before merging this pull request.

What changed?

✳️ preact (10.27.2 → 10.29.0) · Repo

Security Advisories 🚨

🚨 Preact has JSON VNode Injection issue

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:

  1. Pass unmodified, unsanitized values from user-modifiable data sources (APIs, databases, local storage, etc.) directly into the render tree
  2. Assume these values are strings but the data source could return actual JavaScript objects instead of JSON strings
  3. 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.

🚨 Preact has JSON VNode Injection issue

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:

  1. Pass unmodified, unsanitized values from user-modifiable data sources (APIs, databases, local storage, etc.) directly into the render tree
  2. Assume these values are strings but the data source could return actual JavaScript objects instead of JSON strings
  3. 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.

Release Notes

10.29.0

Features

Fixes

Performance

10.28.4

Fixes

  • Fix crash where a synchronous effect render unmounts the tree (#5026, thanks @JoviDeCroock)

Performance

10.28.3

Fixes

Maintenance

10.28.2

Fixes

  • Enforce strict equality for VNode object constructors

10.28.1

Fixes

10.28.0

Types

Fixes

Performance

10.27.3

Fixes

  • Enforce strict equality for VNode object constructors

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by 32 commits:


Depfu Status

Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase.

All Depfu comment commands
@​depfu rebase
Rebases against your default branch and redoes this update
@​depfu recreate
Recreates this PR, overwriting any edits that you've made to it
@​depfu merge
Merges this PR once your tests are passing and conflicts are resolved
@​depfu cancel merge
Cancels automatic merging of this PR
@​depfu close
Closes this PR and deletes the branch
@​depfu reopen
Restores the branch and reopens this PR (if it's closed)
@​depfu pause
Ignores all future updates for this dependency and closes this PR
@​depfu pause [minor|major]
Ignores all future minor/major updates for this dependency and closes this PR
@​depfu resume
Future versions of this dependency will create PRs again (leaves this PR as is)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants