Stored XSS in DataDog Integration affects maintainers/owners
The Datadog integration settings page rendered the 'Datadog site' value into an HTML help link without sanitisation, allowing a stored cross-site scripting payload. An attacker with permission to edit the integration could execute script in the browser of any maintainer or owner who visited the settings page.
GitLab
Originally disclosed on GitLab
- Fixed in 41 days
- Disclosed after 41 days
HackerOne report #1257383 by shells3c on 2021-07-11, assigned to GitLab Team:
Report | How To Reproduce
Report
Summary
The code: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/models/integrations/datadog.rb
def fields
...
{
type: 'password',
name: 'api_key',
title: _('API key'),
non_empty_password_title: s_('ProjectService|Enter new API key'),
non_empty_password_help: s_('ProjectService|Leave blank to use your current API key'),
help: "<a href=\"#{api_keys_url}\" target=\"_blank\">API key</a> used for authentication with Datadog",
required: true
}
...
def api_keys_url
return URL_API_KEYS_DOCS unless datadog_site.presence
sprintf(URL_TEMPLATE_API_KEYS, datadog_site: datadog_site)
end
The api_keys_url is not sanitized before being rendered, leads to XSS, affects any maintainer/owner of the project when they visit the DataDog Integration
Steps to reproduce
- Go to DataDog Integration setting: https://gitlab.com/:user:/:project:/-/services/datadog/edit (requires permission)
- In the Datadog site field, set the value to
"><script>alert()</script>, then Save - Now XSS will be activated in https://gitlab.com/:user:/:project:/-/services/datadog/edit, send this link to victims
Impact
Stored XSS affects maintainers/owners
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
The value of the Datadog site setting was interpolated into an HTML help string without sanitisation before rendering.
Impact
Stored XSS could run script in the browser of maintainers or owners who visited the Datadog integration settings page.
What the attacker needed
Permission to edit the Datadog integration; victim visits the integration settings page
How it was found
- Open the Datadog integration settings page for a project (requires permission).
- Set the Datadog site field to a value containing an HTML script tag and save.
- The stored script executes when the settings page is loaded; send the link to victims.
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 a web page shows user-supplied text, it must escape special characters so the browser treats it as text, not code. Here the 'Datadog site' setting was inserted into a link without that escaping, so a value containing HTML tags ran as JavaScript. Anyone who could change that setting could make the script run in the browser of a project maintainer or owner who opened the page.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.