Skip to content
XSS Disclosed report Intermediate

HTML injection in Wiki templates allows attacker to leak autofill passwords

The wiki template dropdown did not escape template names, allowing an attacker to inject an input field that Chrome's password manager would autofill with the victim's GitLab password. When the victim submitted the form, the password became the wiki page title and was stored in the wiki git log, enabling the attacker to exfiltrate it.

GitLab

Originally disclosed on GitLab

  • Fixed in 28 hours
  • Disclosed after 28 hours

⚠️ 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 #2430261 by joaxcar on 2024-03-21, assigned to @cmaxim:

Report | How To Reproduce

Report

Summary

GitLab 16.10 shipped with Wiki Templates. Users can create wiki templates in a project that other users can select when creating a wiki page. https://docs.gitlab.com/ee/user/project/wiki/index.html#wiki-page-templates

The dropdown that lists the templates in the wiki creation page does not escape the template names. The names are sanitized, so there is not a lot an attacker can do, but I noticed that I can add an input tag looking like this <input type=password name=wiki[title]>. This will render in the template dropdown (even if the dropdown is not expanded, and it will get auto-filled by Chrome if the user is using Chrome password manager.

When the victim fills out the form as usual and submits it, the password field will overwrite the title of the wiki page and create the wiki with the user's password in plain text. This will be stored in the wiki git log, so removing it is not trivial, and the attacker can exfiltrate it.

Steps to reproduce

  1. Create a project where two users are members (minimum developers)
  2. As the attacker go to https://gitlab.com/GROUP/PROJECT/-/wikis/templates and create a new template. Name it
HTML
<input type=password name=wiki[title]>  
  1. Click create

  2. As the victim go to chrome://password-manager/passwords in chrome and make sure you add credentials for gitlab.com

  3. Now go to https://gitlab.com/GROUP/PROJECT/-/wikis and click "new page"

  4. Fill out the form, don't open the templates dropdown

  5. Click create

  6. Your password should now be the title of the created wiki page

Impact

Leaking user passwords, leading to account takeover

What is the current bug behavior?

Template names are not sanitized

What is the expected correct behavior?

Template names should be sanitized

Output of checks

This bug happens on GitLab.com

Impact

Leaking user passwords, leading to account takeover

How To Reproduce

Please add reproducibility information to this section:

The original report as published on GitLab. Images and videos are our own copies; raw HTML is shown as text. View it on GitLab.

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 template names were not HTML-escaped when rendered in the dropdown, allowing injection of an input element.

Impact

Leaking user passwords could lead to account takeover.

What the attacker needed

Attacker and victim are project members; victim uses Chrome password manager; victim has saved GitLab credentials

The fix

Template names should be sanitized.

How it was found

  1. Create a project with two users as members (minimum developers).
  2. As the attacker, go to the wiki templates page and create a new template named with an HTML input tag.
  3. Click create.
  4. As the victim, ensure Chrome has saved credentials for gitlab.com.
  5. Go to the project wiki and click 'new page'.
  6. Fill out the form without opening the templates dropdown and click create.

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 wiki template is a pre-made page layout. The dropdown listing these templates did not properly clean up the template names, so an attacker could put a fake password box in the list. Chrome's password manager would automatically fill that box with the user's saved GitLab password, and when the user created a page, the password was saved as the page title where the attacker could read it.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.