Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

More XSS's in safe mode

Open
#726 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
security

Research direction

Start by tracing safe mode handling for HTML entities and malformed link/image syntax; reproduce the two Markdown inputs in the issue against the referenced commit. Done means both cases render as safe HTML without executable protocols or raw event-handler markup.

Written by the indexing model from the issue text.

Description

Describe the bug

After the patches of #722, I manually found a simple bypass of the HTML entity regex, and ran the fuzzer again to find another HTML corruption.

To Reproduce

  1. The browser decodes &#058 to : forming a javascript: protocol URL (entities can be prefixed with any amount of 0's).
[Click me](javascript&#058alert(origin))
<p><a href="javascript&#058alert(origin)">Click me</a></p>
  1. Weird combination of syntax again resulting in raw HTML being output:
<x![](`<a
>`)><svg onload=alert(origin)![](`<a
>`)
<p>&lt;x<img src="code&gt;&lt;a
&gt;&lt;/code" alt="" />&gt;<svg onload=alert(origin)<img src="code&gt;&lt;a
&gt;&lt;/code" alt="" /></p>

Expected behavior

Safe HTML is output. Maybe use a proper HTML entity decoder to solve the first.

Debug info
Version of library being used: https://github.com/trentm/python-markdown2/commit/ba92f30e9101f485bfd6b2a3178908ee4a82da9f (latest master at time of writing)

Dominant language
Python
Stars
2.8k
Forks
459
Avg merge
2d 19h
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from trentm/python-markdown2

All issues in trentm/python-markdown2

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.