VYPR
Moderate severityNVD Advisory· Published Jun 4, 2018· Updated Sep 17, 2024

CVE-2017-16017

CVE-2017-16017

Description

sanitize-html is a library for scrubbing html input for malicious values Versions 1.2.2 and below have a cross site scripting vulnerability.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

sanitize-html versions before 1.2.3 are vulnerable to cross-site scripting (XSS) via crafted HTML with empty, undelimited attributes.

Vulnerability

sanitize-html is a Node.js library for sanitizing HTML input against malicious content. Versions prior to 1.2.3 contain a cross-site scripting (XSS) vulnerability in the HTML parsing logic. When the library encounters an empty, undelimited attribute (e.g., `), it fails to properly strip the injected event handler. Instead, the generated output becomes `, which embeds the attacker's JavaScript into a valid attribute, allowing script execution [1][4].

Exploitation

An attacker only needs to craft a malicious HTML string that includes empty, undelimited attributes, such as ``. No special network position or authentication is required. The attacker must trick a victim into rendering the sanitized output (e.g., via a comment, message, or user-generated content field) in a browser. The vulnerable sanitizer does not detect the unescaped double-quotes, so the inject is preserved in the output [2][4].

Impact

Successful exploitation results in stored or reflected cross-site scripting (XSS). The attacker's JavaScript executes in the context of the victim's browser, enabling session theft, credential harvesting, defacement, or further attacks against the application. The impact is moderate, but the vulnerability can be triggered without authentication if the application accepts user-supplied HTML [3].

Mitigation

Upgrade to sanitize-html version 1.2.3 or later, which was released to fix this issue. The fix strips any unescaped double-quotes from the output (pull request #20) [2]. The vulnerability is listed in the GitHub Advisory Database as GHSA-wg96-3933-j2w5 [3]. No workaround is available for older versions; users must update the package.

AI Insight generated on May 22, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
sanitize-htmlnpm
< 1.2.31.2.3

Affected products

2

Patches

0

No patches discovered yet.

Vulnerability mechanics

AI mechanics synthesis has not run for this CVE yet.

References

6

News mentions

0

No linked articles in our index yet.