You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_hash_html_spans assumes the first token is never html (is_html_markup = False) and that succeeding tokens alternate between normal text and html markup (is_html_markup = not is_html_markup)
thus, the entire first token <img onerror=alert("hi") does not get run through sanitize_html
instead, that token gets run through _encode_incomplete_tags
but since that token fails the regex _incomplete_tags_re it also doesn't get < escaped with <
markdown2.__version__ == '2.4.13'
The text was updated successfully, but these errors were encountered:
Running
<img onerror=alert("hi")<a> src=a
through markdown2 with
--safe replace
results in an XSS:From what I could tell, this is because:
_hash_html_spans
assumes the first token is never html (is_html_markup = False
) and that succeeding tokens alternate between normal text and html markup (is_html_markup = not is_html_markup
)<img onerror=alert("hi")
does not get run throughsanitize_html
_encode_incomplete_tags
_incomplete_tags_re
it also doesn't get<
escaped with<
markdown2.__version__ == '2.4.13'
The text was updated successfully, but these errors were encountered: