Stored-XSS in user's profile page
The user's profile page rendered the pronunciation field without sanitisation, allowing an attacker to inject HTML and script. An attacker could execute arbitrary JavaScript in a victim's browser when they viewed the profile.
GitLab
Originally disclosed on GitLab
- Fixed in 9 days
- Disclosed after 9 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 #2371126 by yvvdwf on 2024-02-12, assigned to @cmaxim:
Report | How To Reproduce
Report
Hello,
Gitlab recently reorganized user's profile page:
### https://gitlab.com/gitlab-org/gitlab/-/blob/2934d5a2a640d195cb0c8df6f3d22d373cc88799/app/views/users/show.html.haml#L115
%div= sprintf(s_("UserProfile|Pronounced as: %{div_start}%{pronunciation}%{div_end}"), { pronunciation: [@]user.pronunciation, div_start: '<div class="gl-font-sm gl-text-secondary gl-display-inline-flex">', div_end: '</div>' }).html_safe
This allows injecting any HTML tags in user' profile page via [@]user.pronunciation, thus leading to XSS.
Reproduce
- Login your account at https://gitlab.com
- Goto
Edit Profilepage at https://gitlab.com/-/user_settings/profile - Fill
Prononciation:XSS<i/class=hidden><form/class=gl-show-field-errors><input/title='<script>alert(document.domain)</script>'> - Click
Update profile settings - View user' profile, e.g.,
https://gitlab.com/YOUR_USERNAME(please replaceYOUR_USERNAMEby your username) - You should see an alert generated by
alert(document.domain)above
Note: XSS can be achieved via Pronouns.
Impact
Stored-XSS with CSP-bypass allows attackers to execute arbitrary actions on behalf of victims at the client side.
What is the current bug behavior?
Pronunciation (and Pronouns) is not sanitized
Output of checks
This bug happens on GitLab.com
Impact
Stored-XSS with CSP-bypass allows attackers to execute arbitrary actions on behalf of victims at the client side.
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 pronunciation value was inserted into an HTML string that was marked as safe without sanitisation.
Impact
Stored XSS with a CSP bypass could let an attacker perform arbitrary actions on behalf of victims in their browser.
What the attacker needed
A user account; victim views the attacker's profile
How it was found
- Log in to your account on the target site.
- Go to the Edit Profile page.
- Enter a crafted value in the Pronunciation field.
- Click Update profile settings.
- View the user's profile page to see the script execute.
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 stored cross-site scripting (XSS) flaw lets an attacker save malicious code into a website's data, so it runs in other people's browsers later. Here, the pronunciation field on a profile page was not cleaned, so a script could be saved and then run when anyone viewed that profile.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.