Skip to content
DoS Disclosed report Intermediate

Container registry, repository name ReDos

The container repository name validation regex in GitLab suffers from catastrophic backtracking. An attacker could cause high CPU usage by pushing a container image with a specially crafted repository name.

GitLab

Originally disclosed on GitLab

  • Fixed in 5 months
  • Disclosed after 5 months

HackerOne report #869875 by anyday on 2020-05-10, assigned to @cmaxim:

Hello,

container_repository_name_regex contains catastrophic backtracking.

Code: https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/regex.rb#L33

Steps to reproduce:

1. docker build --tag registry.gl.vm/user1/project/a_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-----------x .  
2. docker push registry.gl.vm/user1/project/a_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb-----------x  

(repository name up to 255 characters total)

Video:

reg_rep_name_redos.mp4 From the original on GitLab

Impact

regex dos via high cpu usage

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

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

Impact

An attacker could cause a denial of service by consuming excessive CPU resources on the GitLab server.

What the attacker needed

Access to a container registry; ability to push images

How it was found

  1. Build a Docker image with a repository name consisting of a long sequence of repeated characters followed by a dash and more characters, up to 255 characters.
  2. Push the image to the container registry using that repository name.

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 is a pattern used to check text. Some patterns can take a very long time to match certain inputs, especially if they have repeated parts that can match in many ways. This is called catastrophic backtracking. Here, a long repository name with many repeated characters and a dash caused the pattern to work extremely hard, using lots of CPU and slowing down the server.

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.