Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CVE-2019-10010: XSS Vulnerability in 0.18.2 and below #353

Closed
colinodell opened this issue Mar 21, 2019 · 2 comments
Closed

CVE-2019-10010: XSS Vulnerability in 0.18.2 and below #353

colinodell opened this issue Mar 21, 2019 · 2 comments
Assignees

Comments

@colinodell
Copy link
Member

colinodell commented Mar 21, 2019

An XSS vulnerability (CVE-2019-10010) has been identified in all previous versions of this library (0.18.2 and below).

The issue has been fixed in version 0.18.3. All users should upgrade to version 0.18.3 immediately. Additionally, if your application caches the resulting HTML, please purge and/or regenerate those caches.

Description

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
@colinodell colinodell self-assigned this Mar 21, 2019
colinodell added a commit that referenced this issue Mar 21, 2019
The upstream library we forked from had a bug where entities were
incorrectly preserved when rendering href, src, title, and info string
attributes.

This gave rise to double-encoding errors, when the original markdown is
e.g. `&amp;colon;`, since the parsers already unescape entities.

Thanks to Sebastiaan Knijnenburg for reporting this and for John
MacFarlane for providing the fix.
colinodell added a commit that referenced this issue Mar 21, 2019
…ering (#353)

This applies the previous commit's XSS fix to all custom attributes
colinodell added a commit that referenced this issue Mar 21, 2019
@colinodell
Copy link
Member Author

The issue has been fixed in version 0.18.3. All users should upgrade to version 0.18.3 immediately.

The original message above has also been updated with additional details.

@colinodell colinodell pinned this issue Mar 21, 2019
@colinodell colinodell changed the title XSS Vulnerability CVE-2019-10010: XSS Vulnerability Mar 24, 2019
@colinodell
Copy link
Member Author

This vulnerability has been assigned CVE ID CVE-2019-10010

@colinodell colinodell changed the title CVE-2019-10010: XSS Vulnerability CVE-2019-10010: XSS Vulnerability in 0.18.2 and below Apr 1, 2019
@colinodell colinodell unpinned this issue Jun 20, 2019
@thephpleague thephpleague locked and limited conversation to collaborators Jun 13, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant