ReDoS in Jira prefix
The Jira integration allowed users to supply a custom regular expression for matching issue keys, and this regex was used without sanitisation. An attacker could craft a regex and a matching issue title that caused catastrophic backtracking, leading to a denial of service on the GitLab backend.
GitLab
Originally disclosed on GitLab
- Fixed in 32 days
- Disclosed after 32 days
⚠️ Please read the process on how to fix security issues before starting to work on the issue. Vulnerabilities must be fixed in a security mirror.
HackerOne report #1934802 by yvvdwf on 2023-04-05, assigned to @dcouture:
Report | Attachments | How To Reproduce
Report
Hi,
Gitlab recently add a new feature that allows specifying a regex to recognize Jira issues:
### app/models/integrations/jira.rb#L351
def jira_issue_match_regex
match_regex = (jira_issue_regex.presence || Gitlab::Regex.jira_issue_key_regex)
/\b#{jira_issue_prefix}(?<issue>#{match_regex})/
end
jira_issue_prefix and jira_issue_regex are user input which can cause ReDoS attack
Steps to reproduce
This feature is available on gitlab.com but not yet on user instance, so I tested this on gitlab.com and confirm it via Gitpod:
- In an existing project, or create a new project, enable Jira integration:
- fill the required inputs as you want but the two following allows ReDoS:
Jira issue regex:((a|b)+|c)+$Jira issue prefix:JIRA

- Open a new issue:
title:test-jiraWrite:JIRAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1- click
Save changesbutton - we can see that the
pumaserver uses100%CPU, then restarts after 5 minutes.

Error on gitlab.com:

Impact
This ReDoS issue causes deny of service at the back-end
What is the current bug behavior?
User input is not sanitized
What is the expected correct behavior?
User input should be sanitized before using in a regex
Output of checks
This bug happens on GitLab.com
Impact
This ReDoS issue causes deny of service at the back-end
Attachments
Warning: Attachments received through HackerOne, please exercise caution!
How To Reproduce
Please add reproducibility information to this section:
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the application allowed user-controlled input to be used directly in a regular expression without validation or sanitisation, enabling catastrophic backtracking.
Impact
This ReDoS issue causes deny of service at the back-end.
What the attacker needed
Access to a GitLab project; ability to enable Jira integration; ability to create issues
The fix
User input should be sanitized before using in a regex.
How it was found
- Enable Jira integration in a project and set a malicious Jira issue regex and prefix.
- Create a new issue with a title containing a long string that triggers the regex.
- Save the issue, causing the server to consume 100% CPU and eventually restart.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A regular expression (regex) is a pattern used to search text. Some patterns can take a very long time to process when given certain input, a problem called ReDoS (Regular Expression Denial of Service). Here, a user could set a dangerous pattern and then create an issue with a specially crafted title, making the server work so hard that it became unresponsive.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.