GHSA-cg48-9hh2-x6mx HTML Injection in preact

Not scored Published

Attackers can inject JavaScript via unsanitized JSON input in preact, leading to Cross-Site Scripting and potential code execution.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is GHSA-cg48-9hh2-x6mx?

GHSA-cg48-9hh2-x6mx is a cross-site scripting vulnerability in preact, published on 2 Sep 2020. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official description

Versions of preact 10.x on prerelease tags alpha and beta prior to 10.0.0-beta.1 are vulnerable to HTML Injection. Due to insufficient input validation the package allows attackers to inject JavaScript objects as virtual-dom nodes, which may lead to Cross-Site Scripting. This requires user input parsed with JSON.parse() to be passed directly into JSX without sanitization.

Recommendation

Upgrade to version 10.0.0-beta.1.

Which versions are affected by GHSA-cg48-9hh2-x6mx?

2 open source packages ship an affected version, including preact.

PackageAffectedFixed in
preact npmFrom 10.0.0-alpha.010.0.0-beta.1
preact npmFrom 10.0.0-alpha.010.0.0-beta.1

How do I fix GHSA-cg48-9hh2-x6mx?

Upgrade preact to 10.0.0-beta.1 or later.

Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.

Is GHSA-cg48-9hh2-x6mx being exploited?

There is no known exploitation of GHSA-cg48-9hh2-x6mx in the wild and no public exploit code.

Sources

Is GHSA-cg48-9hh2-x6mx in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free