[reStructuredText] XSS in project README files
A stored cross-site scripting vulnerability existed in GitLab's rendering of reStructuredText README files, allowing an attacker to inject JavaScript that executes when a victim views the file. An attacker could run arbitrary script in the context of the GitLab domain.
- Triaged in 5 hours
- Fixed in 4 days
- Disclosed after 4 days
Summary by the researcher
Persistent XSS vulnerabilities were identified by way of the RubyDoc, reStructuredText, and Textile markup formats. Thanks again to the GitLab team. I've published a blogpost discussing my findings and the recent Security Release.
The report
Hi,
While experimenting with parser bypass techniques, I discovered that reStructuredText markup can be used to inject a stored JavaScript payload into a project README.rst file.
Steps to Reproduce
- Create a new GitLab project
- Initialise the project by creating a
READMEfile - Set the file title to
README.rst - Paste the below Payload into the file
- Commit the file to the project and click on the link
Proof of Concept Payload
`Security test link`__.
__ javascript:alert(document.domain)
Thanks!
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 reStructuredText renderer allowed javascript: URLs in links without sanitising them, so user-supplied markup could execute script.
Impact
An attacker could execute JavaScript in the context of the GitLab domain when a victim views the crafted README.
What the attacker needed
A GitLab account; ability to create a project; victim views the README file
The fix
The report references a recent GitLab Security Release discussing the findings.
How it was found
- Create a new GitLab project
- Initialise the project by creating a README file
- Set the file title to README.rst
- Paste the payload into the file
- Commit the file to the project and click on the link
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.
This is a stored cross-site scripting (XSS) bug. A file format used for documentation (reStructuredText) let someone hide a small script inside a link. When another user opened the file, their browser ran that script as if it came from the GitLab website, which could let the attacker act as the victim.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.