HTML Injection in preact

preact Updated 02 Oct 2025

Summary

02/09/2020
MODERATE
Yes i
Moderate
Not published

GHSA-cg48-9hh2-x6mx: HTML Injection in preact. Affects preact versions >= 10.0.0-alpha.0, < 10.0.0-beta.1. Fixed in 10.0.0-beta.1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Preact is a fast and lightweight JavaScript library for building user interfaces. It is often used as an alternative to React due to its smaller size and faster performance. Preact allows developers to create virtual DOM nodes and render them efficiently. However, versions of Preact 10.x on prerelease tags alpha and beta prior to 10.0.0-beta.1 are vulnerable to HTML Injection.

Vulnerability Detail

The vulnerability in Preact arises from insufficient input validation. Attackers can exploit this vulnerability by injecting JavaScript objects as virtual DOM nodes, which can lead to Cross-Site Scripting (XSS) attacks. This vulnerability specifically affects user input parsed with JSON.parse() that is passed directly into JSX without proper sanitization.

How To Fix

Minimum fixed version

10.0.0-beta.1

This is the first release that contains the fix.

npm install preact@10.0.0-beta.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Conclusion

The HTML Injection vulnerability in preact can lead to Cross-Site Scripting (XSS) attacks. It is crucial for developers to upgrade to version 10.0.0-beta.1 of Preact to mitigate this vulnerability. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for preact →

Share this vulnerability

FAQ

Preact is a JavaScript library for building user interfaces. It is similar to React but has a smaller size and faster performance.

HTML Injection is a type of vulnerability where an attacker can inject malicious HTML code into a web page. This can lead to Cross-Site Scripting (XSS) attacks and other security issues.

The vulnerability in Preact occurs due to insufficient input validation. Attackers can inject JavaScript objects as virtual DOM nodes, which can result in HTML Injection and potential XSS attacks.

Cross-Site Scripting (XSS) is a type of security vulnerability where attackers inject malicious scripts into web pages viewed by other users. This can lead to unauthorized access, data theft, and other malicious activities.

To protect your application from this vulnerability, it is recommended to upgrade to the fixed version of Preact (10.0.0-beta.1). Additionally, ensure that user input parsed with JSON.parse() is properly sanitized before being passed into JSX.

Related vulnerabilities

Recent vulnerabilities recorded for preact.

How To Fix

Minimum fixed version

10.0.0-beta.1

This is the first release that contains the fix.

npm install preact@10.0.0-beta.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback