Skip to content
DoS Disclosed report Intermediate

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:

Ruby
###  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:

  1. 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
jira-setting.png
jira-setting.png From the original on GitLab
  1. Open a new issue:
  • title: test-jira
  • Write: JIRAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1
  • click Save changes button
  • we can see that the puma server uses 100% CPU, then restarts after 5 minutes.
issue.png
issue.png From the original on GitLab

Error on gitlab.com:

500_Error_-_GitLab.png
500_Error_-_GitLab.png From the original on GitLab
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:

The original report as published on GitLab. Images and videos are our own copies; raw HTML is shown as text. View it on GitLab.

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

  1. Enable Jira integration in a project and set a malicious Jira issue regex and prefix.
  2. Create a new issue with a title containing a long string that triggers the regex.
  3. 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.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.