Skip to content
Open redirect Disclosed report Intermediate

Open Redirection Through HTTP Response Splitting

The GitLab Package Registry download endpoint did not filter carriage return and line feed characters in the URL, allowing an attacker to inject a new Location header. This enabled an open redirect, so users could be sent to an attacker-controlled site while believing they were still on the legitimate GitLab instance.

GitLab

Originally disclosed on GitLab

  • Fixed in 4 months
  • Disclosed after 4 months

HackerOne report #1842314 by akadrian on 2023-01-20, assigned to GitLab Team:

Report | Attachments | How To Reproduce

Report

Summary

Endpoint responsible for downloading Packages from Gitlab Package Registry is vulnerable to HTTP Response splitting. By adding %0d%0a characters in URL its possible to cancel default redirection and set attacker value inside Location header. This way its possible to create open-redirection attack via HTTP Response Splitting.

Steps to reproduce
  1. Vulnerability was tested on Self-Hosted Gitlab Instance version 15.6.1:
  2. By using following URL user will be redirected to attacker website, in this case its http://example.com website:

http://gitlab.example.com/api/v4/projects/aaaa/packages/npm/%0d%0ahttp:/%2fexample.com?test

Impact

Users can be lured to malicious websites believing that its legitimate Gitlab Instance. This could lead to

What is the current bug behavior?

User is able to change Location header to his own value leading to open redirection.

What is the expected correct behavior?

When no %0d and %0a characters are provided in vulnerable endpoint, redirection occurs to https://registry.npmjs.org/ website. Characters %0d and %0a should be filtered so that they could not lead to changes in default Location header value.

Impact

User is able to change Location header to his own value leading to open redirection.

Attachments

Warning: Attachments received through HackerOne, please exercise caution!

How To Reproduce

Please add reproducibility information to this section:

  1. Have a public project ready.
  2. curl -vvv "http://gdk.test:8000/api/v4/projects/<project_id>/packages/npm/%0d%0ahttp:/%2fexample.com?test"
  3. Check the Location: header, it points to http://example.com

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 inserted user-controlled URL data into the Location response header without stripping carriage return and line feed characters, allowing header injection.

Impact

Users could be lured to malicious websites believing that they were still on the legitimate GitLab instance.

What the attacker needed

A public project; victim clicks a crafted link

How it was found

  1. Have a public project ready.
  2. Send a request to the package download endpoint with encoded carriage return and line feed characters in the URL.
  3. Observe that the Location header points to the attacker-chosen website.

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 a web server sends a redirect, it includes a Location header telling the browser where to go next. If user input containing special line-break characters is placed into that header without cleaning, an attacker can add their own header line and change the destination. Here, the package download URL accepted those characters, so the browser was sent to a different website.

What is Open redirect?

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Open redirect

The lesson behind this report.

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.