Adding Custom URLs in slack messages
The Slack integration in GitLab allowed a user to include custom links in issue descriptions, which were then posted to Slack. An attacker with developer access could craft a link to a malicious site and trick other users into clicking it.
GitLab
Originally disclosed on GitLab
- Fixed in 6 months
- Disclosed after 6 months
HackerOne report #1814720 by akadrian on 2022-12-21, assigned to @fvpotvin:
Report | Attachments | How To Reproduce
Report
Summary
Hi,
This issue is directly related to the following one:
https://gitlab.com/gitlab-org/gitlab/-/issues/340176
I think that the fix is incomplete. It fixes issue of altering links in first line of Slack Messages but leaves door open to add them later.
Attacker still can create malicious links. Only difference is the position of such link in final message in slack channel. Please let me know if you find that adding any URL to the slack messages is valid issue. I think that the functionality should restrict urls to be either from Gitlab domain itself or custom issue tracker domain so that attacker could not direct other users to his own malicious site.
Steps to reproduce
(Step-by-step guide to reproduce the issue, including:)
1 Create Project called victim-project
2 Create another user called "Attacker" and add him as developer to the victim-project
3 Set up Slack Integration in Gitlab and Toggle "Issue" Trigger
4 Log in as Attacker
5 Click New Issue and set Title field to any value- it can be for example: Very Important Issue
6 Set Description to: <http://customurlhere.com|CLICK HERE>
Impact
Possibility to direct user to malicious site through Slack integration
What is the current bug behavior?
Any custom links can be added to Slack channel using Gitlab integration.
What is the expected correct behavior?
Users should be allowed only to add links to Slack channels that are from gitlab domain or external issue tracker domain so that attacker could not direct other users to malicious links in slack channel.
Impact
Attacker could direct users to malicious sites in slack channel.
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 Slack integration did not properly sanitise or restrict URLs in issue descriptions before posting them to Slack.
Impact
An attacker could direct users to a malicious site through a link posted in a Slack channel.
What the attacker needed
GitLab project with Slack integration enabled; Attacker has developer access to the project
The fix
The Slack integration should restrict URLs to the GitLab domain or a custom issue tracker domain.
How it was found
- Create a project called victim-project.
- Create a user called Attacker and add them as a developer to the project.
- Set up Slack integration and enable the Issue trigger.
- Log in as Attacker.
- Create a new issue with any title.
- Set the description to a custom link with text 'CLICK HERE'.
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 sends a message to Slack about a new issue, it includes the issue description. The bug is that it also includes any links in that description, even if they point to a bad website. So an attacker could put a link to a fake site in the description, and people in Slack might click it, thinking it's safe.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.