Skip to content

Regular Expression DoS vulnerability in the gedit3 plugin #191

@yinxiL

Description

@yinxiL

Regular Expression DoS vulnerability in the gedit3 plugin

We are working on the ReDoS problem and detected two vulnerable regexes from your gedit3 plugin code.

Vulnerable regex 1:
.+(<.+>)+([0-9]+)(<.+>)+.* in link
It takes forever for the regex to match the string
"\b<\b>0<\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><><\b><>\n"
We suggest you change the structure (<.+>)+.*, since "." can accept "<" and ">".

Vulnerable regex 2:
</?[\w:-]+(?:\s+[\w-:]+(?:\s*=\s*(?:(?:"[^"]")|(?:'[^\']')|[^>\s]+))?)\s(/?)>$
in link and link
This vulnerability can be triggered by
"<- -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\" -=\"\"\b"
Both \s+[\w\-:]+\s*=\s*"[^"]*" and \s+[\w\-:]+\s*=\s*[^>\s]+ can match " -=\"\"", we suggest you to change (?:"[^"]*") since this branch is mainly included in [^>\s]+.

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 these regexes as you do. Thank you for your understanding.

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