Skip to content

Regular Expression DoS vulnerability in third-party script #4220

Closed

Description

@yinxiL

Describe the bug
We are working on the ReDoS problem and detected a vulnerable regex from your code.

Regex \001?\033\\]((?:.|;)*?)(\x07)\002? in link takes forever to match the string
"\u001B];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"
This is because two branches in (?:.|;) can both match the character ;, we suggest you to just remove the later one.

We didn’t create a pull request because we're not sure if these cases are possible to take place in your program, we also do not understand the functionality of the regex as you do. Thank you for your understanding.

Activity

  1. changed the title [-]Regular Expression DoS vulnerabilities in third-party scripts[/-] [+]Regular Expression DoS vulnerability in third-party scripts[/+] on May 29, 2020
  2. changed the title [-]Regular Expression DoS vulnerability in third-party scripts[/-] [+]Regular Expression DoS vulnerability in third-party script[/+] on May 29, 2020
  3. stamparm commented on May 29, 2020

    @stamparm
    Member
    1. This is a thirdparty module (as you can see, the path is thirdparty/colorama/ansitowin32.py
    2. To actually reach this piece of code, sqlmap should output the "problematic" string to the console on Win32 (highly unlikely - but I won't judge this)
    3. Out of curiosity and fun, did the example you provided:
    $ python
    >>> import re
    >>> import time
    >>> start=time.time(); re.search("\001?\033\\]((?:.|;)*?)(\x07)\002?", "\u001B];;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"); end=time.time()
    >>> print end-start
    0.000715017318726
    >>> 
    
    

    4) Closing this down as invalid. Please do a proper research before raising this kind of issues

  4. added
    FUBARF*cked Up Beyond All Recognition
    and removed on May 29, 2020
  5. locked and limited conversation to collaborators on May 29, 2020
  6. added and removed
    FUBARF*cked Up Beyond All Recognition
    on Jun 1, 2020
  7. stamparm commented on Jun 1, 2020

    @stamparm
    Member

    More info can be found here

  8. self-assigned this
    on Jun 1, 2020
  9. added a commit that references this issue on Mar 9, 2024
    2d06543
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions