Skip to content
XSS Disclosed report Intermediate

Gitlab XSS through PlantUML proxy

GitLab's PlantUML proxy served user-supplied SVG files from the GitLab domain without sanitising them, so an attacker could embed a script in an SVG and have it execute in the context of gitlab.example.com. This could let an attacker steal cookies or redirect users to a malicious site.

GitLab

Originally disclosed on GitLab

  • Fixed in 6 months
  • Disclosed after 6 months

HackerOne report #1466686 by solov9ev on 2022-02-01, assigned to @mhenriksen:

Report | Attachments | How To Reproduce

Report

Hi, Security Team!

I discovered a Gitlab XSS vulnerability through PlantUML proxy

Steps to reproduce

  • First, install PlantUML (sudo docker run -d --name plantuml -p 8080:8080 plantuml/plantuml-server:tomcat)
PlantUML Server Version 1202200  
  • Next step install Gitlab (sudo docker run --detach --hostname gitlab.example.com --publish 443:443 --publish 80:80 --publish 22:22 --name gitlab gitlab/gitlab-ee:latest)
--------------------------------------------------------------------------------  
 Ruby:         ruby 2.7.5p203 (2021-11-24 revision f69aeb8314) [x86_64-linux]  
 GitLab:       14.7.0-ee (621e5984888) EE  
 GitLab Shell: 13.22.2  
 PostgreSQL:   12.7  
--------------------------------------------------------------------------------  

The result is two running containers: Gitlab, PlantUML

1.png
1.png From the original on GitLab
  • Add values to the file /etc/passwd on your local machine:
2.png
2.png From the original on GitLab
  • Let's check that everything works at the assigned addresses

http://plantuml:8080/

3.png
3.png From the original on GitLab

http://gitlab.example.com/

4.png
4.png From the original on GitLab

Install a program for editing files in the docker container: apt update && apt install nano

5.png
5.png From the original on GitLab

Now you need to edit the Nginx configuration in Gitlab docker container: nano /etc/gitlab/gitlab.rb

6.png
6.png From the original on GitLab

I specified the ip address 172.17.0.1 because it is the docker address that I found out by running the ifconfig command on my local machine

7.png
7.png From the original on GitLab

After making changes to the file /etc/gitlab/gitlab.rb, reconfigure the gitlab container: gitlab-ctl reconfigure

8.png
8.png From the original on GitLab
  • Now you need to configure proxying to the PlantUML in the settings of the Gitlab web system
9.png
9.png From the original on GitLab
  • On the local machine (http://192.168.0.10:1337/xss_svg.svg), I placed the following SVG exploit. It must contain the height and width. Although this exploit can be placed anywhere
<?xml version="1.0" standalone="no"?>  
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg version="1.1" width="200" height="200" baseProfile="full" xmlns="http://www.w3.org/2000/svg">  
   <polygon id="triangle" points="0,0 0,50 50,0" fill="#009900" stroke="#004400"/>  
   <script type="text/javascript">  
      alert(document.domain);  
   </script>  
</svg>  
  • The user can then create a wiki page with the AsciiDoc type
10.png
10.png From the original on GitLab
11.png
11.png
  • After clicking on the SVG, due to proxying, gitlab displays svg in the gitlab.example.com domain
12.png
12.png From the original on GitLab
  • I proved that this SVG works in the github domain and provided the POC in this report #1457495

Impact

With this vulnerability, an attacker can for example steal users cookies or redirect users on malicious website.

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 PlantUML proxy in GitLab served SVG content inline without sanitising or forcing a safe content type, allowing embedded scripts to execute in the GitLab origin.

Impact

An attacker could steal users' cookies or redirect them to a malicious website.

What the attacker needed

GitLab with PlantUML integration enabled; Attacker can host an SVG file; Victim clicks a link to the SVG

How it was found

  1. Install PlantUML server and GitLab in Docker containers.
  2. Configure GitLab's nginx to proxy to the PlantUML server.
  3. Configure PlantUML integration in GitLab settings.
  4. Host an SVG file containing a script on a local machine.
  5. Create a wiki page of type AsciiDoc that references the SVG.
  6. Click the SVG link; the script executes in the GitLab domain.

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 GitLab proxies PlantUML, an SVG from another source is shown on the GitLab domain. If the SVG contains a script, it runs as part of GitLab, letting an attacker run code in the victim's browser.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.