CVE-2019-10010
JSON

6.1medium

Moderate severity vulnerability that affects league/commonmark

Severity
6.1medium CVSS:3.0 by NVD
Exploit likelihood
1.05% (higher than 65% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mitre
Also known as
GHSA-3v43-877x-qgmq

Description

Cross-site scripting (XSS) vulnerability in the PHP League CommonMark library before 0.18.3 allows remote attackers to insert unsafe links into HTML by using double-encoded HTML entities that are not properly escaped during rendering, a different vulnerability than CVE-2018-20583.

Affected

Product or packageVersionsReported by
Unspecified productn/aCVE List
league/commonmark (Packagist)before 0.18.3GitHub Advisory Database
thephpleague commonmarkbefore 0.18.3NVD

All scores

GitHub6.1medium CVSS:3.0CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NVD6.1medium CVSS:3.0CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
NVD4.3medium CVSS:2.0AV:N/AC:M/Au:N/C:N/I:P/A:N

Classification

What each source says

CVE List

Cross-site scripting (XSS) vulnerability in the PHP League CommonMark library before 0.18.3 allows remote attackers to insert unsafe links into HTML by using double-encoded HTML entities that are not properly escaped during rendering, a different vulnerability than CVE-2018-20583.

GitHub Advisory Database

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:alert%28'XSS'%29)

This library would (correctly) unescape the & entity to & during the parsing step. However, the renderer step would fail to properly re-escape the resulting : 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
NVD (es)

Vulnerabilidad Cross-Site Scripting (XSS) en la librería PHP League CommonMark, en versiones anteriores a la 0.18.3, permite que los atacantes remotos inserten enlaces inseguros en HTML mediante el uso de entidades HTML doblemente cifradas que no se escapan correctamente durante el renderizado. Esta vulnerabilidad es diferente de CVE-2018-20583.

References

Sources

SourceRecordLicence
CVE ListCVE-2019-10010 changed 2024-08-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-3v43-877x-qgmq changed 2024-02-16CC-BY-4.0
NVDCVE-2019-10010 changed 2026-06-17Public domain