Link hijacking leads to open redirection on accounts.yoyogames.com
The logout link on the accounts page could be hijacked by appending a crafted path to the URL, causing the logout link to point to an attacker-controlled domain. An attacker could trick a victim into opening the logout link in a new tab, redirecting them to a malicious site.
Originally disclosed on Bugcrowd
- Accepted in 17 hours
- Fixed in 27 days
- Disclosed after 3 months
Summary by mohammadowais
Appending "/%2fanything.com/test/" to the host value resulted in embedding desired links to external hosts on the Opera domain.
Report details
-
Submitted
20 May 2021 07:33:36 UTC
-
Target Location
accounts.yoyogames.com -
Target category
API Testing
-
VRT
Unvalidated Redirects and Forwards > Open Redirect > GET-Based
-
Priority
P4
-
Bug URL
accounts.yoyogames.com -
Description
Hi,
I found out that a logout's link can be hijacked and could lead to open redirection.
Proof of Concept.
-
Login to https://accounts.yoyogames.com/ from mobile or if will replicate this on Desktop, minimise your window a bit (about to a half) so that you will see navigation tabs.
-
Go to the affected URL:
https://accounts.yoyogames.com//%2fevil.com/test/ -
Open "Logout" in new tab. You'll visit evil.com in new tab.
Additional Information
An endpoint like this:
https://accounts.yoyogames.com//%2fevil.com/test/; will reflect this in page source:<li><a data-controller="logout" data-action="logout#submitLogoutForm" href="//evil.com/test">Logout</a></li>This means the navigation link for logout will be set to attacker's controlled site. Mere clicking on it will not result into redirection since logout doesn't happen with the GET request on /logout; opening the logout in new tab will lead victim to attacker's controlled site.
Kind and Best Regards, -MO
-
Context
Yoyogames runs a player accounts service at accounts.yoyogames.com, and the report was filed against that host under the Opera Public Bug Bounty on Bugcrowd. The feature in question is the account navigation menu: once a user is logged in, the page renders a list of navigation links, one of which is Logout. The researcher's finding is that the href of that Logout link can be made to point at an arbitrary external host by manipulating the path of the page URL, so the link becomes an open redirect.
The report classifies the issue as Unvalidated Redirects and Forwards > Open Redirect > GET-Based in the VRT, with priority P4 and severity low. It was submitted on 20 May 2021 and disclosed on 20 August 2021, with a bounty of 100.00 USD.
Setup
No special tooling, account type or configuration is described. The only precondition stated is that the tester is logged in to https://accounts.yoyogames.com/. The proof of concept is written for a mobile browser, or for a desktop browser whose window is reduced to roughly half width so that the navigation tabs (including Logout) are visible.
Finding it
The researcher noticed that appending /%2fanything.com/test/ to the host value caused the application to embed links to external hosts in pages served from the Opera domain. The crafted value is reflected into the href of the Logout link as //evil.com/test, which browsers interpret as a protocol-relative URL pointing at another host.
Exploitation
Step 1: Log in and expose the navigation tabs
Log in to https://accounts.yoyogames.com/. On mobile, or on desktop with the window minimised to about half width, the navigation tabs including Logout are visible.
Step 2: Visit the crafted URL
https://accounts.yoyogames.com//%2fevil.com/test/
The path begins with a double slash and then %2fevil.com/test/, and the rendered link contains //evil.com/test.
Step 3: Inspect the page source
The endpoint reflects the crafted value into the page source as follows:
<li><a data-controller="logout" data-action="logout#submitLogoutForm" href="//evil.com/test">Logout</a></li>
The href is now //evil.com/test, a protocol-relative URL that resolves to evil.com over the current scheme. The navigation link for Logout is therefore set to an attacker-controlled site.
Step 4: Open Logout in a new tab
Open Logout in a new tab. The new tab navigates to evil.com.
The researcher is explicit about the limit here: merely clicking the link does not produce the redirection, because logout does not happen with the GET request on /logout. Opening the logout in a new tab is what leads the victim to the attacker-controlled site.
Root cause
The crafted URL is reflected into the href of the Logout anchor as //evil.com/test, which the browser resolves to an external origin. Because the value is emitted as //evil.com/test, the browser treats it as a protocol-relative URL and resolves it to an external origin. The report does not show the server-side code, so the exact parsing and encoding behaviour that lets %2f become a leading // in the markup is not described; the reflection shown in the page source is the evidence given.
The researcher notes that merely clicking the link does not produce the redirection, because logout does not happen with the GET request on /logout; opening the logout in a new tab leads the victim to the attacker-controlled site.
Impact
An attacker who can get a logged-in user to open a crafted accounts.yoyogames.com URL and then open the Logout link in a new tab can send that user to an attacker-controlled site. The link is displayed on the genuine Yoyogames accounts domain. The report does not describe any theft of credentials, session data or account state, and the redirection requires the new-tab interaction rather than a single click. The program rated it low severity (P4).
Fix
The fix implied by the finding is to stop reflecting the request path into the Logout href, or to validate it so that only same-origin, relative paths are accepted, rejecting values that begin with // or otherwise resolve to another host after decoding.
Variants to test
- Other navigation links. Check whether the same path reflection affects links other than Logout, for example profile or settings entries in the same menu. A positive result is any anchor whose
hrefpoints at an external host after visiting a crafted path. - Different encodings of the slash. Try encoded and double-encoded forms of
/in the path and see whether the renderedhrefstill begins with//. A positive result is the same protocol-relativehrefin the page source. - Scheme-relative and absolute payloads. Test whether a full
https://value or a backslash-based value is also accepted into thehref. A positive result is an anchor that resolves off-origin in the browser. - Other hosts in the same estate. Apply the same crafted path to sibling account or login hosts and inspect the rendered navigation. A positive result is the same reflection of the path into a link target.
Hunting notes
This kind of bug hides in account and navigation pages that build links from the current URL, especially where a path segment is echoed into an href without normalisation. During recon, the signal is a page whose links change when you alter the path, particularly when an encoded slash appears in the markup. The researcher demonstrated impact by showing the exact reflected markup and the resulting navigation to an external host, and by explaining the interaction needed (opening Logout in a new tab) so the triager could reproduce it.
What happened, in plain words
Yoyogames runs a website where players log in to their accounts, at accounts.yoyogames.com. Once you are logged in, the page shows a small menu of navigation links, and one of those links is Logout. A link on a web page is not just text: behind it there is an address (the href) that tells the browser where to go when the link is clicked.
The researcher found that the address behind the Logout link can be changed by visiting a crafted page address. If you craft a special page address, the Logout link ends up pointing at a completely different website chosen by the attacker. This is called an open redirect: a trusted site that will happily send your browser to somewhere else.
The link sits on the real Yoyogames accounts domain.
The report was filed against the Opera Public Bug Bounty on Bugcrowd, was rated low severity (priority P4), paid a bounty of 100.00 USD, was submitted on 20 May 2021 and disclosed on 20 August 2021.
The pieces you need to know
Before walking through the steps, here are the few ideas the report relies on. None of them require any tools beyond a browser.
- A URL is the address in your browser's address bar, for example
https://accounts.yoyogames.com/. It has parts: the scheme (https), the host (accounts.yoyogames.com) and the path (everything after the host, here just/). - A path is the part of the address that tells the server which page or resource you want. On many sites the path is used to build the page you see.
- An
hrefis the attribute inside a link (<a>) in the page's HTML that holds the destination address. When you click a link, the browser reads itshrefand goes there. - HTML is the language web pages are written in. You can see it in your browser with "View page source".
- Percent-encoding is a way of writing special characters in a URL using a percent sign and two hex digits. A forward slash
/can be written as%2f. Servers and browsers sometimes decode it back to/, and sometimes do not, which is exactly where bugs like this one live. - A protocol-relative URL is an address that starts with
//and no scheme, like//evil.com/test. The browser fills in the scheme from the current page, so on anhttpspage it becomeshttps://evil.com/test. In other words,//at the start of anhrefmeans "a different website", not "a folder on this website". - An API is the part of a website that responds to requests with data rather than a full page. The report files this under "API Testing", but the proof of concept is entirely about a normal web page and its links.
- A GET request is the ordinary kind of request your browser makes when you open a link or type an address. It just asks the server for something. It is not supposed to change anything on the server.
- A controller (here
logout#submitLogoutForm) is a piece of JavaScript on the page that handles what happens when you interact with an element. The Logout link is wired to one, which is why clicking it does not simply navigate away.
Setting up
The report describes no special tools, no special account and no configuration. The only precondition is that you are logged in to https://accounts.yoyogames.com/. The proof of concept is written for a mobile browser, or for a desktop browser whose window is shrunk to roughly half width, because that is when the navigation tabs, including Logout, are visible on screen.
Finding it
The researcher noticed that appending /%2fanything.com/test/ to the host value caused the application to put links to external hosts into pages served from the Opera domain. In plain terms: the crafted address is reflected into the href of the Logout link as //evil.com/test, and the browser reads that leading // as "go to another website".
Exploitation
Step 1: Log in and expose the navigation tabs
Log in to https://accounts.yoyogames.com/. On a phone, or on a desktop with the window shrunk to about half width, the navigation tabs including Logout are visible. This step is only about getting the menu on screen so you can see the Logout link and open it.
Step 2: Visit the crafted URL
https://accounts.yoyogames.com//%2fevil.com/test/
Line by line, this address is:
https://is the scheme, the normal secure web protocol.accounts.yoyogames.comis the real Yoyogames accounts host. This is the part that makes the link look trustworthy.//is a double slash right after the host. It is unusual in a path and is part of what makes the trick work.%2fis a percent-encoded forward slash, part of the crafted value that ends up reflected in the link.evil.comis the attacker's domain, standing in for any site an attacker controls./test/is just an extra path on the attacker's site, there to make the address look like a normal page.
Visiting this address results in the Logout link pointing at //evil.com/test.
Step 3: Inspect the page source
The endpoint reflects the crafted value into the page source like this:
<li><a data-controller="logout" data-action="logout#submitLogoutForm" href="//evil.com/test">Logout</a></li>
Line by line, this snippet is:
<li>opens a list item, one entry in the navigation menu.<a ...>opens a link. Everything between the angle brackets is information about the link.data-controller="logout"tells the page's JavaScript which controller is responsible for this element.data-action="logout#submitLogoutForm"says which action inside that controller runs when the element is used. This is why a plain click does not just navigate away: the page's own code handles the click.href="//evil.com/test"is the destination. It starts with//, so the browser treats it as a protocol-relative URL and resolves it toevil.comusing the current scheme. The Logout link now points at an attacker-controlled site.>Logout</a>is the visible text of the link and the closing tag.</li>closes the list item.
The reason for looking at the page source is to prove the link really has been changed, rather than guessing from what happens when you click. The page source is the evidence.
Step 4: Open Logout in a new tab
Open Logout in a new tab. The new tab goes to evil.com.
The researcher is explicit about the limit here: merely clicking the link does not produce the redirection, because logout does not happen with the GET request on /logout. Opening the logout in a new tab is what takes the victim to the attacker-controlled site. In other words, a normal click does not produce the redirection, but a new tab follows the href.
Why it works
The crafted URL is reflected into the href of the Logout link as //evil.com/test, which the browser resolves to an external site. Because the value comes out as //evil.com/test, the browser treats it as a protocol-relative URL and sends you to an external site. The report does not show the server-side code, so the exact parsing and encoding behaviour that turns %2f into a leading // in the page is not described; the reflected markup in the page source is the evidence given.
The researcher notes that merely clicking the link does not produce the redirection, because logout does not happen with the GET request on /logout; opening the logout in a new tab leads the victim to the attacker-controlled site.
What an attacker could do with it
An attacker who can get a logged-in user to open a crafted accounts.yoyogames.com address, and then open the Logout link in a new tab, can send that user to a site the attacker controls. The link is shown on the genuine Yoyogames accounts domain. The report does not describe any theft of credentials, session data or account state, and the redirection needs the new-tab interaction rather than a single click. The program rated it low severity (P4).
The fix
The fix implied by the finding is to stop copying the request path into the Logout href, or to check it so that only same-site, relative paths are accepted, rejecting values that begin with // or that otherwise resolve to another host once decoded.
Other things worth testing
- Other navigation links. Check whether the same path copying affects links other than Logout, for example profile or settings entries in the same menu. A positive result is any link whose
hrefpoints at an external host after visiting a crafted path. - Different encodings of the slash. Try encoded and double-encoded forms of
/in the path and see whether the renderedhrefstill begins with//. A positive result is the same protocol-relativehrefin the page source. - Scheme-relative and absolute payloads. Test whether a full
https://value or a backslash-based value is also accepted into thehref. A positive result is a link that resolves off-site in the browser. - Other hosts in the same estate. Apply the same crafted path to sibling account or login hosts and inspect the rendered navigation. A positive result is the same copying of the path into a link target.
Notes for someone hunting this kind of bug
This kind of bug hides in account and navigation pages that build links from the current address, especially where a path segment is echoed into an href without being cleaned up. During recon, the signal is a page whose links change when you alter the path, particularly when an encoded slash appears in the page source. The researcher showed impact by giving the exact reflected markup and the resulting navigation to an external host, and by explaining the interaction needed (opening Logout in a new tab) so the triager could reproduce it.
Glossary
- API: the part of a website that answers requests with data rather than a full page; the report files this under API Testing, though the proof of concept is about a normal page.
- Bug bounty: a programme where a company pays people for reporting security problems in its systems.
- Bugcrowd: the platform that hosted this programme.
- Controller: a piece of JavaScript on a page that handles what happens when you interact with an element, here
logout#submitLogoutForm. - CVSS: a standard scoring system for the severity of a security issue; the report gives no score.
- Domain: the name of a website, such as
accounts.yoyogames.comorevil.com. - GET request: the ordinary request a browser makes when you open a link or type an address; it asks for something and is not supposed to change anything.
- Host: the part of a URL that names the server, for example
accounts.yoyogames.com. href: the attribute of a link in HTML that holds its destination address.- HTML: the language web pages are written in.
- Open redirect: a flaw where a trusted site can be made to send your browser to a different site chosen by an attacker.
- Path: the part of a URL after the host that says which page or resource you want.
- Percent-encoding: writing a special character in a URL as a percent sign and two hex digits, for example
%2ffor/. - Phishing: tricking someone into visiting a fake site or handing over information by making the request look legitimate.
- Priority (P4): the programme's own ranking of how urgent the issue is; P4 is the lowest here.
- Protocol-relative URL: an address starting with
//and no scheme, which the browser completes using the current page's scheme, so//evil.com/testbecomeshttps://evil.com/teston anhttpspage. - Recon: the exploratory phase of looking around a target to find interesting behaviour.
- Reflection: when something you sent in a request is written back into the page you receive.
- Scheme: the first part of a URL, such as
https, that says how to talk to the server. - Severity: how serious an issue is judged to be; this one was rated low.
- Triager: the person on the programme who checks a report and decides whether it is valid.
- URL: the address of a page or resource, as shown in your browser's address bar.
- VRT: the Vulnerability Rating Taxonomy, a shared list of vulnerability types used to classify reports; this one is Unvalidated Redirects and Forwards > Open Redirect > GET-Based.