GHSA-cg48-9hh2-x6mx: Preact HTML Injection Vulnerability
MODERATEGHSA-cg48-9hh2-x6mx is a MODERATE html injection vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Preact libraries in the npm ecosystem. The issue involves html injection in preact. Remediation is available by upgrading affected packages to version 10.0.0-beta.1.
GHSA-cg48-9hh2-x6mx at a Glance
How to Fix GHSA-cg48-9hh2-x6mx
To remediate this vulnerability, upgrade all affected Preact dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install preact@10.0.0-beta.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls preact
How to Check if You Are Affected
To determine whether your Node.js application is affected by GHSA-cg48-9hh2-x6mx, inspect your project dependencies using npm:
npm ls preact
Analyze the terminal output to locate any version of Preact in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 10.0.0-beta.1), your application is affected.
Note: The npm ls preact command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In Preact, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-cg48-9hh2-x6mx Affected Preact Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
preact
|
npm |
≥ 10.0.0-alpha.0
< 10.0.0-beta.1
|
10.0.0-beta.1
|
References
Frequently Asked Questions
What is GHSA-cg48-9hh2-x6mx?
Which Preact versions are affected?
What version fixes GHSA-cg48-9hh2-x6mx?
Is preact affected?
What CWE is associated with GHSA-cg48-9hh2-x6mx?
How can I check npm dependencies for GHSA-cg48-9hh2-x6mx?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-cg48-9hh2-x6mx",
"modified" : "2021-09-27T20:53:56Z",
"published" : "2020-09-02T18:28:58Z",
"aliases" : [ ],
"summary" : "HTML Injection in preact",
"details" : "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.\n\n\n## Recommendation\n\nUpgrade to version 10.0.0-beta.1.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "preact"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "10.0.0-alpha.0"
}, {
"fixed" : "10.0.0-beta.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 10.0.0-beta.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/developit/preact/pull/1528"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/developit/preact"
}, {
"type" : "WEB",
"url" : "https://github.com/developit/preact/releases/tag/10.0.0-beta.1"
}, {
"type" : "WEB",
"url" : "https://medium.com/dailyjs/exploiting-script-injection-flaws-in-reactjs-883fb1fe36c1"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/advisories/835"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-74" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2020-08-31T18:37:35Z",
"nvd_published_at" : null
}
}