-
Notifications
You must be signed in to change notification settings - Fork 436
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
Another Filter bypass leading to XSS #348
Comments
It seems like the parser doesn't escape tags that don't match the following pattern, so everything that isn't python-markdown2/lib/markdown2.py Line 2167 in 4d2fc79
The following payload will also work: <x- onclick="alert(1)"*Click Me* |
Has been assigned CVE-2020-11888. |
I didn't see the PR from @v1dhun before I submitted mine. However, having had more time to think about it, they're both flawed. Mine can be defeated by this: The other can be defeated by this This needs a little more thought |
HI @xurble , |
👋 Hey! We've recently opened a bug bounty against this issue, so if you want to get rewarded 💰 for fixing this vulnerability 🕷, head over to https://huntr.dev! |
@v1dhun I think we've both fixed it right now. Either would be OK, or the maintainers might have a better idea altogether. |
Regex is going to be always bypassed as it assumes specific syntax while combinations for a renderable HTML are practically unlimited. This is one of the fundamental recommendations from OWASP XSS Prevention Cheat-sheet. I'd recommend running the input text through bleach which is a whitelist-based HTML sanitizer. I had a look at the |
I merged @xurble PR as it was on the main repo. LGTM, thank you! I'm a little hesitant to introduce another library like bleach to sanitize final output. But it may be a good solution. Needs investigating. |
@nicholasserra Yes, that's the classic dilemma. As developer I would probably prefer a big fat notice in the documentation stating that the main purpose of the library is not to sanitize untrusted code but to render Markdown, just to set the expectations right. |
Does this warrant a new release? |
If it sways your thinking, the library is flagged by sentry, which is how I discovered the issue. |
2.3.9 is now released |
Changelog: * Fix CVE-2020-11888 in markdown2. Additional info: * trentm/python-markdown2#348 * GHSA-fv3h-8x5j-pvgq See merge request polemarch/ce!194
On the latest release (2.3.8) a payload like this one can lead to xss and bypass safe_mode when set to true.
<lol@/ //id="pwn"//onclick="alert(1)"//**abc**
The Problem:
I think its due to just bad regex's not detecting non alphanumeric tags.
The text was updated successfully, but these errors were encountered: