ReDoS in message formater using Slack notifications integration that can fully occupy Sidekiq utilization
HackerOne report #2428902 by joaxcar on 2024-03-21, assigned to @cmaxim:
Report | Attachments | How To Reproduce
Report
Summary
Hi team! I think this is my last ReDoS issue :) when I first found this one, I did not understand the impact, but after learning more about Sidekiq, I now see that this one also has the potential for high availability impact.
An attacker can configure Slack notifications as an integration. This is done by providing an incoming webhook to a Slack app. When a new issue is created, a message will be sent to the Slack app, and it will be posted in the designated Slack channel.
When GitLab is preparing the issue description to be sent to Slack this code will run
RELATIVE_LINK_REGEX = %r{!\[[^\]]*\]\((/uploads/[^\)]*)\)}
...
def format_relative_links(string)
string.gsub(RELATIVE_LINK_REGEX, "#{project_url}\\1")
end
Which tries to extract markdown image links ![](). This RELATIVE_LINK_REGEX is subject to polynomial complexity when evaluated against a long string of this format
"
