# XSS by clicking Jira's link

Reflected XSS via unvalidated return_to param rendered as a javascript: link in Jira Connect users page, executing on click in Safari.

- Payout: $1,130
- Severity: medium
- Program: GitLab
- Found by: ooooooo_q
- Disclosed: 2022-06-08
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/1194254
- Library page: https://bugbountylibrary.com/r/h1%3A1194254
- Tags: area:web domain:web impact:integrity kind:bounty platform:hackerone sev:medium tech:ruby technique:source-review vuln:xss

**Target:** GitLab Jira Connect users endpoint /-/jira_connect/users?return_to=
**Root cause:** The return_to param is passed directly to external_link/link_to without validating the URL scheme, allowing javascript: URIs to become clickable links.
**Steps:**
1. Set up GitLab instance without CSP (e.g. localhost).
2. Log in with Safari.
3. Visit `https://localhost/-/jira_connect/users?return_to=javascript:alert(location)`.
4. Click the `Return to GitLab for Jira` button; JS executes.
**How found:** Code reading of users_controller.rb and show.html.haml revealed return_to flows unvalidated into external_link helper, which does not verify URL scheme.
**Exploitation:** Attacker crafts a URL with a javascript: payload in return_to and lures a logged-in Safari user to click the rendered external link button, executing script in the GitLab origin.
**Insight:** Audit helpers like external_link/link_to that accept user-controlled URLs; javascript: schemes execute on click in Safari even when Chrome/Firefox open a new tab, so test scheme handling per-browser and check CSP absence.

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

**Malicious return_to URL with javascript: payload**

```
https://localhost/-/jira_connect/users?return_to=javascript:alert(location)
```

