Cross-site Scripting (XSS) Affecting sanitize-html package, versions <1.11.4


Severity

Recommended
0.0
medium
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Mature
EPSS
0.08% (37th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Cross-site Scripting (XSS) vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDnpm:sanitize-html:20161026
  • published12 Apr 2017
  • disclosed26 Mar 2016
  • creditAndrew Krasichkov

Introduced: 26 Mar 2016

CVE-2017-16016  (opens in a new tab)
CWE-79  (opens in a new tab)

How to fix?

Upgrade sanitize-html to version 1.11.4 or later.

Overview

sanitize-html is a library for scrubbing html input of malicious values.

Affected versions of this package are vulnerable to Cross-site Scripting (XSS) attacks. If at least one nonTextTags tag is allowed, a malicious user may potentially conduct an XSS attack.

PoC:

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

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

console.log(clean);

// !<textarea></textarea><svg/onload=promptxs></textarea>!

Details

<>

CVSS Scores

version 3.1