GHSA-3v43-877x-qgmq

    Dashboard / Vulnerabilities / GHSA-3v43-877x-qgmq

    GHSA-3v43-877x-qgmq

    Published: 17 Sept 2019Last Modified: 16 Feb 2024

    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: ```md [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: ```html <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](https://github.com/thephpleague/commonmark/releases/tag/0.18.3) release mirrors [the fix made upstream](https://github.com/commonmark/commonmark.js/commit/c89b35c5fc99bdf1d2181f7f0c9fcb8a1abc27c8) - 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

    Affected packages

    Package

    Name: league/commonmark

    Purl: pkg:composer/league/commonmark

    Affected ranges

    Type: ECOSYSTEM

    Events:

    Introduced- 0
    Fixed -0.18.3

    Affected versions

    0.1.0
    0.1.1
    0.1.2

    Common Vulnerability Scoring System

    Attack Vector
    Network
    Adjacent
    Local
    Physical
    Privileges Required
    None
    Low
    High
    User Interaction
    None
    Required
    Scope
    Unchanged
    Changed
    Confidentiality
    None
    Low
    High
    Integrity
    None
    Low
    High
    Availability
    None
    Low
    High