Skip to content
Path traversal Disclosed report Intermediate

Arbitrary file read in project uploads controller via path traversal

The project uploads controller allowed path traversal in the filename parameter, enabling an attacker to read arbitrary files on the server. By crafting a URL with encoded directory traversal sequences, an attacker could access sensitive files like /etc/passwd.

GitLab

Originally disclosed on GitLab

Critical View original
  • Fixed in 3 days
  • Disclosed after 3 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 #1994725 by pwnie on 2023-05-20, assigned to H1 Triage:

Report | Attachments | How To Reproduce

Report

Summary

The project uploads controller is vulnerable to path traversal in the :filename parameter which leads to arbitrary file reads

Steps to reproduce
  1. Create a new group and recursively create 10 new subgroups

Example: http://gitlab.com/11/22/33/44/55/66/88/99/aa/bb/cc/dd/ notice the deeply nested subgroups and a project at the end (dd)

1.5 If you don't want to do this step you can just use mine: https://gitlab.com/11753220/22/33/44/55/66/77/88/99/10/11

  1. Go to https://gitlab.com/11753220/22/33/44/55/66/77/88/99/10/11/uploads/9079e1f1e5765d269fd80e23f0dc3441/..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2F..%2Fetc%2Fpasswd
Impact

Arbitrary file read

What is the current bug behavior?

:filename can contain path traversal characters

What is the expected correct behavior?

Sanitize :filename

Relevant logs and/or screenshots
Output of checks

The bug happens on Gitlab

Impact

Arbitrary file read

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 failed to sanitise the filename parameter, allowing directory traversal sequences to be used to access files outside the intended uploads directory.

Impact

An attacker could read arbitrary files on the server, potentially exposing sensitive information.

What the attacker needed

Ability to create groups and projects

The fix

The filename parameter should be sanitised to prevent path traversal characters.

How it was found

  1. Create a new group and recursively create 10 new subgroups, with a project at the end.
  2. Navigate to the crafted URL containing the uploads path and encoded directory traversal sequences to read /etc/passwd.

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.

This is a path traversal bug. The web server takes a filename from the URL and uses it to find a file on disk, but it doesn't check that the filename stays inside the intended folder. By using special characters like '..' (which means 'go up one folder'), an attacker can escape the uploads folder and read any file the server can access, such as system password files.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.