Skip to content
DoS Disclosed report Beginner

Denial of Service Attack on gitlab-shell

gitlab-shell reads the user's confirmation response for the 2fa_recovery_codes command without any size limit, so an attacker can send an endless stream of data. This keeps gitlab-shell busy, consuming CPU and memory, and can cause a denial of service.

GitLab

Originally disclosed on GitLab

  • Fixed in 6 months
  • Disclosed after 6 months

HackerOne report #953444 by yvvdwf on 2020-08-07, assigned to @ngeorge1:

Report | How To Reproduce

Report

Hi,

I found that gitlab-shell allows to generate 2F keys by executing 2fa_recovery_codes command.
Before generating the key, it reads directly confirmation from user twofactorrecover.go#L36

Go
       ....  
	var answer string  
	fmt.Fscanln(c.ReadWriter.In, &answer)

	return answer == "yes"  
       ....  

The user's response will be loaded into answer variable. Attackers may provide a huge data to make gitlab-shell busy.

Steps to reproduce
  1. Open terminal to execute the following command (please replace gl.local by your gitlab url): cat /dev/random | base64 | ssh [email protected] '2fa_recovery_codes'
  2. While the command is being executed, you should see that gitlab-shell use 100% cpu (of one core?) and its memory increases time by time.
Impact

Attacker may cause denial of service for gitlab-shell

What is the current bug behavior?

As presentation above, gitlab-shell reads directly user's response from client's stream. It loads data from the client's stream into answer variable until the end of the stream.

What is the expected correct behavior?

Gitlab-shell should limit the size of user's response

Output of checks
Results of GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:env:info)

System information  
System:		Ubuntu 18.04  
Proxy:		no  
Current User:	git  
Using RVM:	no  
Ruby Version:	2.6.6p146  
Gem Version:	2.7.10  
Bundler Version:1.17.3  
Rake Version:	12.3.3  
Redis Version:	5.0.9  
Git Version:	2.27.0  
Sidekiq Version:5.2.9  
Go Version:	unknown

GitLab information  
Version:	13.2.3-ee  
Revision:	640e2695514  
Directory:	/opt/gitlab/embedded/service/gitlab-rails  
DB Adapter:	PostgreSQL  
DB Version:	11.7  
URL:		http://gl.local  
HTTP Clone URL:	http://gl.local/some-group/some-project.git  
SSH Clone URL:	[email protected]:some-group/some-project.git  
Elasticsearch:	no  
Geo:		no  
Using LDAP:	no  
Using Omniauth:	yes  
Omniauth Providers: 

GitLab Shell  
Version:	13.3.0  
Repository storage paths:  
- default: 	/var/opt/gitlab/git-data/repositories  
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell  
Git:		/opt/gitlab/embedded/bin/git  

Impact

Attacker may cause denial of service for gitlab-shell, thus gitlab server

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

Impact

An attacker may cause a denial of service for gitlab-shell and thus the GitLab server.

What the attacker needed

SSH access to the GitLab server

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.

When it asks for a yes/no confirmation, it reads whatever the user sends without stopping, so a malicious user can send an endless stream of data. This makes the program use a full CPU core and growing memory, which may slow the service.

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.