Skip to content

Moderate severity vulnerability that affects league/commonmark

Moderate severity GitHub Reviewed Published Aug 26, 2019 in thephpleague/commonmark • Updated Feb 6, 2024

Package

composer league/commonmark (Composer)

Affected versions

< 0.18.3

Patched versions

0.18.3

Description

CVE-2019-10010

Impact

In league/commonmark 0.18.2 and below, malicious users can insert double-encoded HTML entities into their Markdown like this:

[XSS](javascript&amp;colon;alert%28&#039;XSS&#039;%29)

This library would (correctly) unescape the &amp; entity to & during the parsing step. However, the renderer step would fail to properly re-escape the resulting &colon; string, thus producing the following malicious HTML output:

<p><a href="javascript&colon;alert('XSS')">XSS</a></p>

Browsers would interpret &colon; as a : character and allow the JS to be executed when the link is clicked.

This vulnerability was present in the upstream library this project was forked from and therefore exists in all prior versions of league/commonmark.

Solution

The new 0.18.3 release mirrors the fix made upstream - we no longer attempt to preserve entities when rendering HTML attributes like href, src, title, etc.

The $preserveEntities parameter of Xml::escape() is therefore no longer used internally, so it has been deprecated and marked for removal in the next major release (0.19.0).

Credits

  • Mohit Fawaz for identifying the issue
  • Sebastiaan Knijnenburg and Ross Tuck for responsibly disclosing/relaying the issue
  • John MacFarlane for investigating it and implementing the upstream fix we mirrored here

References

References

@colinodell colinodell published to thephpleague/commonmark Aug 26, 2019
Published to the GitHub Advisory Database Sep 17, 2019
Reviewed Jun 16, 2020
Last updated Feb 6, 2024

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

EPSS score

0.107%
(45th percentile)

Weaknesses

CVE ID

CVE-2019-10010

GHSA ID

GHSA-3v43-877x-qgmq
Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.