Gitlab.com is vulnerable to reverse tabnabbing. (#2)
GitLab's link filter failed to add rel="nofollow noreferrer" to links whose URL starts with the GitLab domain but actually point to an external site, allowing reverse tabnabbing. An attacker could craft such a link in an issue or comment so that when a victim clicks it, the opened external page can redirect the original GitLab tab to a phishing page.
Originally disclosed on HackerOne
- Triaged in 22 hours
- Fixed in 58 days
- Disclosed after 59 days
Dear GitLab bug bounty team,
Summary
Gitlab.com is vulnerable to reverse tabnabbing in issues, comments, etc. This is the same type of issue as https://hackerone.com/reports/211065, but far worse since in the previous report only a user with developer access to a project could view the "Environments" tab. In this case, the issue affects anywhere where HTML can be added.
Why does this vulnerability exist?
By creating a link with https://[email protected] the parser ignores it and does not add the usual rel="nofollow noreferrer" which is located on all other links. I discovered this, because I noticed that internal links are treated differently than external links. So in the example above the victim ends up on example.com, which is where the same scenario as https://hackerone.com/reports/211065 can be performed.
In order to demonstrate this issue the following payload can be used:
<a href="https://[email protected]" target="_blank">Reverse Tabnabbing</a>
Where does the issue lie?
The issue appears to lie in the following lines of code:
it 'skips internal links' do
internal = Gitlab.config.gitlab.url
exp = act = %Q(<a href="#{internal}/sign_in">Login</a>)
expect(filter(act).to_html).to eq exp
end
Link to source code: https://github.com/gitlabhq/gitlabhq/blob/master/spec/lib/banzai/filter/external_link_filter_spec.rb#L16-L20
If you require further information feel free to contact me.
Yours sincerely, Ed
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 external link filter treats any URL starting with the GitLab domain as internal and skips adding rel="nofollow noreferrer", even when the URL contains an @ that redirects to an external host.
Impact
An attacker could redirect a victim's original GitLab tab to a phishing page after the victim clicks a crafted link.
What the attacker needed
Ability to add HTML links in issues or comments; victim clicks the crafted link
How it was found
- Create a link in an issue or comment using a URL that starts with the GitLab domain but points to an external site.
- Add target="_blank" to the link so it opens in a new tab.
- Get a victim to click the link, which opens the external site in a new tab.
- The external site performs the reverse tabnabbing scenario to redirect the original GitLab tab.
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.
When you click a link that opens a new tab, the new page can sometimes control the old tab and change its address. This is called reverse tabnabbing. GitLab normally prevents this by adding a special attribute to external links, but it missed links that look like they belong to GitLab while actually going elsewhere.
What is Open redirect?
A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.