Skip to content
DoS Disclosed report Beginner

ESCALATED: Decompression Bomb

A decompression bomb (a small compressed file that expands to a huge size) could be uploaded via GitLab's project import feature, filling the disk and causing a denial of service. An attacker could repeatedly upload such files to make the site unavailable.

GitLab

Originally disclosed on GitLab

  • Fixed in 12 months
  • Disclosed after 12 months

HackerOne report #687730 by u3mur4 on 2019-09-04, assigned to jmatos_bgtvf:

Summary

A decompression bomb is a file designed to crash or render useless the program or system reading it, i.e. a denial of service.

An attacker can create a carefully crafted tar.gz file and upload it using the Import an exported GitLab project functionality. When the file is unpacked its contents are exploded and it fills the drive.

Steps to reproduce

  • Download the file (100MB)
  • Sign in to a GitLab instance
  • Create (Import) a New Project using the Import an exported GitLab project
  • Set the GitLab project export file form field to the previously download file
  • Click to Import Project and wait until it's finished
  • Repeat this process until the disk is full
  • When the disk is full multiple functionality becomes unavailable (See Video and Impact)

Video version:

bomb.mp4 From the original on GitLab

How to create the decompression bomb file

You can create the compressed file yourself using couples of bash commands

Bash
fallocate -l 100G 100gb.zeros  
tar cvf - 100gb.zeros | gzip -9 - > 100gb.tar.gz  

I created a short go program to create the compressed file without any intermediate file. The program also sets the modification time inside the tar file to a future date because of the following bug/behavior:

The ImportExportProjectCleanupWorker runs every hour and deletes the uncompressed files where the modification time is older than 1 day. Because we set the modification time to a future date inside the tar archive the uncompressed data will be never deleted.

Bash
stat -c '%y' big_file  
2020-09-03 21:44:51.000000000 +0200  

Impact

  • Random 500 errors
  • Unable to create/import new projects
  • Unable to create issues
  • Unable to push git changes
  • Unable to upload any file: file avatar, project avatar
  • Unable to access the whole site
  • etc...

What is the current bug behavior?

  • no size check before decompression
  • tar sets the modification time of the file

What is the expected correct behavior?

  • Limit the maximum file size (gzip -l 100gb.tar.gz to get the uncompressed size)
  • Use the -m, --touch flag to don't extract file modified time

GitLab version info

omnibus-gitlab package: GitLab Community Edition 12.2.4
gitlab-development-kit: GitLab Community Edition 12.3.0-pre gitlab-ce@f4e40c532b5582f47a0dd9bf7054112fc9ec6085
gitlab.com: not tested because of dos

Impact

  • Random 500 errors
  • Unable to create/import new projects
  • Unable to create issues
  • Unable to push git changes
  • Unable to upload any file: file avatar, project avatar
  • Unable to access the whole site
  • etc...

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

Root cause

Likely the application did not check the uncompressed size of uploaded archives before extracting them, and it preserved file modification times from the archive, preventing cleanup.

Impact

The disk fills up, causing random 500 errors and making many features unavailable, including creating projects, issues, pushing changes, uploading files, and accessing the site.

What the attacker needed

A GitLab account; ability to import projects

The fix

The application should limit the maximum uncompressed file size before extraction and use the --touch flag to avoid preserving file modification times.

How it was found

  1. Download the provided 100MB tar.gz file.
  2. Sign in to a GitLab instance.
  3. Create (Import) a New Project using the Import an exported GitLab project option.
  4. Set the GitLab project export file form field to the downloaded file.
  5. Click Import Project and wait until it's finished.
  6. Repeat this process until the disk is full.

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 decompression bomb is like a tiny box that contains a giant balloon: when you open it, the balloon expands and fills the room. Here, the attacker uploads a small file that expands to a huge size when the server unpacks it, filling the disk. This makes the website stop working for everyone.

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.