A flaw was found in sanitize-html library. Insecure global regular expression replacement logic of HTML comment removal could lead to a regular expression Denial of Service (ReDoS), affecting the availability of the affected component.
Apostrophe Technologies sanitize-html before 2.3.1 does not properly handle internationalized domain name (IDN) which could allow an attacker to bypass hostname whitelist validation set by the "allowedIframeHostnames" option.
sanitize-html before 1.4.3 has XSS.
Affected versions of sanitize-html are vulnerable to cross-site scripting when allowedTags includes at least one nonTextTag.
Proof of Concept
js var sanitizeHtml = require('sanitize-html');
var dirty = '!<textarea></textarea><svg/onload=promptxs></textarea>!'; var clean = sanitizeHtml(dirty, { allowedTags: [ 'textarea' ] });
console.log(clean);
// !<textarea></textarea><svg/onload=promptxs></textarea>!
Recommendation
Update to version 1.11.4 or later.
Affected versions of sanitize-html are vulnerable to cross-site scripting.
Proof of Concept:
<IMG SRC= onmouseover="alert('XSS');"> produces the following:
<img src="onmouseover="alert('XSS');"" /> This is definitely invalid HTML, but would suggest that it's being interpreted incorrectly by the parser.
Recommendation
Update to version 1.2.3 or later.