GHSA-3v43-877x-qgmq

Suggest an improvement
Source
https://github.com/advisories/GHSA-3v43-877x-qgmq
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2019/09/GHSA-3v43-877x-qgmq/GHSA-3v43-877x-qgmq.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-3v43-877x-qgmq
Aliases
Published
2019-09-17T22:47:47Z
Modified
2024-02-16T08:15:08.451853Z
Severity
  • 6.1 (Medium) CVSS_V3 - CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N CVSS Calculator
Summary
Moderate severity vulnerability that affects league/commonmark
Details

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

  • https://nvd.nist.gov/vuln/detail/CVE-2019-10010
  • https://github.com/thephpleague/commonmark/releases/tag/0.18.3
  • https://github.com/thephpleague/commonmark/issues/353
    • https://github.com/FriendsOfPHP/security-advisories/blob/master/league/commonmark/CVE-2019-10010.yaml
Database specific
{
    "nvd_published_at": null,
    "cwe_ids": [
        "CWE-79"
    ],
    "severity": "MODERATE",
    "github_reviewed": true,
    "github_reviewed_at": "2020-06-16T20:56:22Z"
}
References

Affected packages

Packagist / league/commonmark

Package

Name
league/commonmark
Purl
pkg:composer/league/commonmark

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
0.18.3

Affected versions

0.*

0.1.0
0.1.1
0.1.2
0.2.0
0.2.1
0.3.0
0.4.0
0.5.0
0.5.1
0.6.0
0.6.1
0.7.0
0.7.1
0.7.2
0.8.0
0.9.0
0.10.0
0.11.0
0.11.1
0.11.2
0.11.3
0.12.0
0.13.0
0.13.1
0.13.2
0.13.3
0.13.4
0.14.0
0.15.0
0.15.1
0.15.2
0.15.3
0.15.4
0.15.5
0.15.6
0.15.7
0.16.0
0.17.0
0.17.1
0.17.2
0.17.3
0.17.4
0.17.5
0.18.0
0.18.1
0.18.2