GitHub Advisoryadvisory · Packagist
GHSA-3v43-877x-qgmq Moderate severity vulnerability that affects league/commonmark
MEDIUM
Official page ↗
- Aliases
- CVE-2019-10010
- Ecosystem
- Packagist
- Packages
- league/commonmark
- Severity
- Moderate
- CVSS vector
- CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- Weaknesses
- CWE-79
- Reviewed
- 2020-06-16
Affected packages
• Packagist league/commonmark: < 0.18.3 → fixed in 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:
```md
XSS
```
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:
```html
XSS
```
Browsers would interpret `:` 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
Related
Alias · CVE (1)
- CVE-2019-10010 Cross-site scripting (XSS) vulnerability in the PHP League CommonMark library before 0.18.3 allows remote attackers to insert unsafe links… vulnerability
Weakness · CWE (1)
- CWE-79 Improper Neutralization of Input During Web Page Generation weakness
References
- https://github.com/thephpleague/commonmark/security/advisories/GHSA-3v43-877x-qgmq web
- https://nvd.nist.gov/vuln/detail/CVE-2019-10010 advisory
- https://github.com/thephpleague/commonmark/issues/353 web
- https://github.com/FriendsOfPHP/security-advisories/blob/master/league/commonmark/CVE-2019-10010.yaml web
- https://github.com/advisories/GHSA-3v43-877x-qgmq advisory
- https://github.com/thephpleague/commonmark web
- https://github.com/thephpleague/commonmark/releases/tag/0.18.3 web