Skip to content
Open redirect Disclosed report Beginner

Open Redirect at https://oauth.secure.pixiv.net

The OAuth authorisation endpoint redirected the browser to an arbitrary redirect_uri when an invalid scope value was supplied. An attacker could use this to send users to a phishing site and try to steal their credentials.

zimmer75 Follow

Originally disclosed on HackerOne

Bounty$200 Low View original
  • Triaged in under an hour
  • Fixed in 6 days
  • Paid in under an hour
  • Disclosed after 4 months

Summary:

Hello @pixiv security team, i hope you are well, i noticed you can redirect users to another domain if you send an invalided scope.

Vulnerable Url

  • https://oauth.secure.pixiv.net/v2/auth/authorize?client_id=Y1olfIApoCNuSGzx9kTgIbf5Wk4R&redirect_uri=https%3A%2F%2Fsketch.pixiv.net%2Fsession%2Fpixiv%2Fcallback&response_type=code&scope=read-email+read-x-restrict+read-birth+write-upload+read-profile+write-profile+read-favorite-users&state=security_token%3D5cb310fefea19a5cb56307af3488a816921413bc70b5b142%2Crequest_type%3Ddefault

Steps To Reproduce:

  • In the request looks for the scope parameter and change his value to ggg.

  • Looks for the redirect_uri parameter and change it for an arbitrary domain, i.e https://example.com

  • Open the link in your browser and done.

  • https://oauth.secure.pixiv.net/v2/auth/authorize?client_id=Y1olfIApoCNuSGzx9kTgIbf5Wk4R&redirect_uri=https%3A%2F%2Fexample.com%2Fsession%2Fpixiv%2Fcallback&response_type=code&scope=ggg&state=security_token%3D5cb310fefea19a5cb56307af3488a816921413bc70b5b142%2Crequest_type%3Ddefault

pixiv_open_redirect_poc.mkv From the original on HackerOne

Impact

It may lead users to a phishing site and an attacker can steals his credentials.

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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

pixiv runs an OAuth authorisation endpoint at https://oauth.secure.pixiv.net/v2/auth/authorize. This is the standard OAuth 2.0 authorisation endpoint: a client application sends the user there with its client_id, the redirect_uri it wants the user returned to, a response_type, a scope and an opaque state value. If the user is authenticated and consents, the endpoint issues a code and redirects the browser back to the redirect_uri.

The report concerns what happens when the scope value is invalid. The researcher found that with an invalid scope the endpoint still redirects, and in the crafted request it redirected to the supplied redirect_uri on example.com. The asset named in the report is accounts.pixiv.net, and the vulnerable host is oauth.secure.pixiv.net.

Setup

No accounts, roles, tools or versions are described. The only precondition shown is a browser and the ability to edit the query string of the authorisation URL. The researcher supplies a working authorisation URL containing a client_id and a state value, and modifies two parameters in it.

Finding it

The researcher noticed that sending an invalid scope value causes the endpoint to redirect the user to another domain. The starting URL given in the report is:

HTTP
https://oauth.secure.pixiv.net/v2/auth/authorize?client_id=Y1olfIApoCNuSGzx9kTgIbf5Wk4R&redirect_uri=https%3A%2F%2Fsketch.pixiv.net%2Fsession%2Fpixiv%2Fcallback&response_type=code&scope=read-email+read-x-restrict+read-birth+write-upload+read-profile+write-profile+read-favorite-users&state=security_token%[redacted]%2Crequest_type%3Ddefault

In this URL the redirect_uri is https://sketch.pixiv.net/session/pixiv/callback, a legitimate callback on a pixiv-owned host, and the scope lists a set of pixiv permissions (read-email, read-x-restrict, read-birth, write-upload, read-profile, write-profile, read-favorite-users). The state carries a security_token and a request_type.

The behaviour suggests the invalid-scope path builds its redirect from the supplied redirect_uri.

Exploitation

Step 1: break the scope

In the request, find the scope parameter and change its value to ggg. This is not a valid scope, so the authorisation request cannot succeed.

Step 2: point the redirect elsewhere

Find the redirect_uri parameter and change it to an arbitrary domain, for example https://example.com. In the crafted URL the value is percent-encoded as https%3A%2F%2Fexample.com%2Fsession%2Fpixiv%2Fcallback, keeping the original path on the new host.

Step 3: open the link

The resulting URL is:

HTTP
https://oauth.secure.pixiv.net/v2/auth/authorize?client_id=Y1olfIApoCNuSGzx9kTgIbf5Wk4R&redirect_uri=https%3A%2F%2Fexample.com%2Fsession%2Fpixiv%2Fcallback&response_type=code&scope=ggg&state=security_token%[redacted]%2Crequest_type%3Ddefault

Opening it in a browser is the whole test, and the video shows the redirect happening. The video shows the redirect happening in the browser.

pixiv_open_redirect_poc.mkv From the original on HackerOne

Root cause

The report does not include any server-side code or response headers, so the exact implementation is not shown. What the behaviour implies is that the authorisation endpoint handles the invalid-scope case on a separate path from the normal flow, and that this error path builds its redirect from the user-supplied redirect_uri without checking it against the client's registered callback. In a correct OAuth implementation the redirect_uri must be matched against a pre-registered value for the client_id before any redirect is issued, including on error paths. Here that check is either missing or skipped when the scope is invalid. The report does not say which.

Impact

The researcher states that the redirect may lead users to a phishing site and that an attacker can steal their credentials. The report does not demonstrate theft of an OAuth code or token, and does not describe any interaction with the state value beyond carrying it through. The severity recorded for the report is low, with a bounty of 200.00 USD.

Fix

The report does not describe a fix or a change made after disclosure. Based on the behaviour, the endpoint should validate redirect_uri against the registered callback for the given client_id on every path, including the invalid-scope error path, and refuse to redirect to any other destination.

Variants to test

  1. Invalid response_type: replace code with an unsupported value and keep an external redirect_uri. A positive result is a redirect to the external host instead of an error page.
  2. Missing required parameter: drop client_id or state while keeping the external redirect_uri. A positive result is the same off-site redirect on the validation-error path.
  3. Unknown client_id: use a value that is not registered together with an external redirect_uri. A positive result is a redirect rather than a rejection.
  4. Consent denial: where the flow offers a deny action, check whether the denial redirect also honours an unvalidated redirect_uri.
  5. Encoded and alternate forms of the callback: try the same host with different paths, and check whether the validation, if any, compares only a prefix or only the host.

Hunting notes

OAuth authorisation endpoints are worth testing parameter by parameter because success, error and denial paths are often implemented separately, and validation added to one path is easily missed on another. During recon, collect authorisation URLs from the provider's own clients and from third-party integrations, note the registered redirect_uri for each client_id, then mutate one parameter at a time: scope, response_type, state, client_id. The signal is any response that leaves the pixiv domain when the request is malformed.

To make the case convincing, show the full crafted URL and the browser following it, as this report does with a short video. Keep the payload domain obviously neutral, such as example.com, so the reviewer can see the redirect without any doubt about who controls the destination.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

pixiv is a site where people share artwork. It also lets other websites and apps log people in through pixiv, so you do not have to create a separate account everywhere. That kind of "log in with pixiv" feature is usually built on a standard called OAuth 2.0.

OAuth works a bit like a cloakroom ticket. You show your coat (your pixiv account) at the counter, the attendant gives you a ticket (a short-lived code), and you hand that ticket to the app you actually want to use. The app never sees your coat, only the ticket. For this to be safe, the counter must hand the ticket back to the right app, the one you started with, and not to whoever happens to be standing there.

In this report, the researcher found that pixiv's login endpoint could be made to redirect the browser to a completely different place. The trick was to send a deliberately broken request: a request that asks for permissions pixiv does not recognise. Instead of stopping and showing an error, pixiv still redirected the browser, and it redirected to whatever address the request asked for. That is what an open redirect is: a site that will forward visitors to any address someone puts in a link.

On its own, an open redirect looks harmless. The danger is that the link starts on the real pixiv domain, so it looks trustworthy, and it ends on a page the attacker controls. That page can be a fake pixiv login form, and the person who follows the link may type their password into it.

The report was filed on HackerOne, a platform where security researchers report bugs to companies. The researcher is credited as zimmer75, and the severity was recorded as low. The report was disclosed on 2020-12-22.

The pieces involved

Before walking through the steps, here are the parts of the system the report touches.

The authorisation endpoint. An endpoint is simply a web address that does a job when you visit it, rather than showing a normal page. The one in this report is:

Text
https://oauth.secure.pixiv.net/v2/auth/authorize

This is the address a website sends your browser to when you click "log in with pixiv". It is the cloakroom counter from the comparison above.

The query string. Everything after the ? in a web address is called the query string. It is a list of settings, written as name=value, joined together with &. You can see it in your browser's address bar, and you can edit it by hand. That is all the "tooling" this report needs.

The parameters in this request. Each setting in the query string has a job:

Parameter What it is for
client_id Identifies which app is asking pixiv to log you in.
redirect_uri The address the browser should be sent back to when the login step is finished.
response_type Says what kind of result the app wants. Here it is code, meaning a short-lived code.
scope The list of permissions the app is asking for, such as reading your email address or your profile.
state A value the app makes up and expects to get back unchanged, used to tie the reply to the request it started.

Percent-encoding. Some characters are not allowed to appear raw in a web address, so they are written in a coded form. %3A means a colon :, and %2F means a slash /. So https%3A%2F%2Fexample.com is just https://example.com in disguise. Browsers and servers translate this automatically.

The asset. The report names accounts.pixiv.net as the asset, and the vulnerable host is oauth.secure.pixiv.net. A host is one named machine on the internet, the part of the address between https:// and the first slash.

The starting URL

The researcher began from a working login link. The researcher began from this working login link:

HTTP
https://oauth.secure.pixiv.net/v2/auth/authorize?client_id=Y1olfIApoCNuSGzx9kTgIbf5Wk4R&redirect_uri=https%3A%2F%2Fsketch.pixiv.net%2Fsession%2Fpixiv%2Fcallback&response_type=code&scope=read-email+read-x-restrict+read-birth+write-upload+read-profile+write-profile+read-favorite-users&state=security_token%[redacted]%2Crequest_type%3Ddefault

Reading it piece by piece:

  1. https://oauth.secure.pixiv.net/v2/auth/authorize is the endpoint, the counter that handles logins.
  2. client_id=Y1olfIApoCNuSGzx9kTgIbf5Wk4R says which app is asking. It identifies which app is asking.
  3. redirect_uri=https%3A%2F%2Fsketch.pixiv.net%2Fsession%2Fpixiv%2Fcallback is where the browser should be sent afterwards. Decoded, it is https://sketch.pixiv.net/session/pixiv/callback, a page on a pixiv-owned host. A callback is simply the address that waits to receive the result.
  4. response_type=code asks for a short-lived code as the result.
  5. scope=read-email+read-x-restrict+read-birth+write-upload+read-profile+write-profile+read-favorite-users is the permission list. The + signs separate the individual permissions. They include reading your email address, reading your profile, uploading work and reading your favourite users.
  6. state=security_token%[redacted]%2Crequest_type%3Ddefault is the app's own note to itself. Decoded, it contains a security_token value and request_type=default. The app will check that it gets the same value back.

In a correct setup, the server checks the redirect_uri against the address that was registered for that client_id in advance. If they do not match, the server refuses. The researcher's idea was that this check might be skipped when something else in the request is wrong, specifically the scope.

Reproducing it, step by step

Step 1: break the scope

The first change is to the scope parameter. Its value is replaced with ggg, which is not a permission pixiv knows. The reason for doing this is to force the request down an error path, the branch of the server's code that deals with bad requests.

Step 2: point the redirect somewhere else

The second change is to the redirect_uri parameter. It is replaced with an arbitrary domain, using https://example.com as the example. In the crafted URL the value is written as https%3A%2F%2Fexample.com%2Fsession%2Fpixiv%2Fcallback, which is the same address with the original /session/pixiv/callback path kept on the new host.

Step 3: open the link

With both changes made, the resulting URL is:

HTTP
https://oauth.secure.pixiv.net/v2/auth/authorize?client_id=Y1olfIApoCNuSGzx9kTgIbf5Wk4R&redirect_uri=https%3A%2F%2Fexample.com%2Fsession%2Fpixiv%2Fcallback&response_type=code&scope=ggg&state=security_token%[redacted]%2Crequest_type%3Ddefault

Comparing it with the starting URL, only two things differ: scope is now ggg, and redirect_uri now points at example.com. Everything else, including the client_id, the response_type and the state, is unchanged.

Opening this address in a browser is the whole test. The expected safe behaviour would be an error page on pixiv saying the request is invalid. The video shows the browser being redirected. The video shows this happening in the browser.

pixiv_open_redirect_poc.mkv From the original on HackerOne

Why it works

The report does not include any server-side code or response headers, so the exact implementation is not shown. What the behaviour tells us is that the login endpoint treats a bad scope on a separate path from a normal login, and that this error path builds its redirect from the address supplied in the request without checking it against the app's registered callback. In a correct OAuth implementation, the redirect_uri must be matched against a pre-registered value for the client_id before any redirect is issued, including on error paths. Here that check is either missing or skipped when the scope is invalid. The report does not say which.

Impact

The researcher states that the redirect may lead users to a phishing site and that an attacker can steal their credentials. Phishing means building a fake page that looks like the real one and persuading someone to type their password into it.

The report does not demonstrate theft of an OAuth code or token, and does not describe any interaction with the state value beyond carrying it through. The severity recorded for the report is low, with a bounty of 200.00 USD.

Fix

The report does not describe a fix or a change made after disclosure. Based on the behaviour, the endpoint should validate redirect_uri against the registered callback for the given client_id on every path, including the invalid-scope error path, and refuse to redirect to any other destination.

Variants to test

Once you know that one error path skips a check, it is worth asking whether its neighbours do too. These are variations worth trying:

  1. Invalid response_type: replace code with an unsupported value and keep an external redirect_uri. A positive result is a redirect to the external host instead of an error page.
  2. Missing required parameter: drop client_id or state while keeping the external redirect_uri. A positive result is the same off-site redirect on the validation-error path.
  3. Unknown client_id: use a value that is not registered together with an external redirect_uri. A positive result is a redirect rather than a rejection.
  4. Consent denial: where the flow offers a deny action, check whether the denial redirect also honours an unvalidated redirect_uri.
  5. Encoded and alternate forms of the callback: try the same host with different paths, and check whether the validation, if any, compares only a prefix or only the host.

Hunting notes

OAuth authorisation endpoints are worth testing parameter by parameter because success, error and denial paths are often implemented separately, and validation added to one path is easily missed on another. During recon, collect authorisation URLs from the provider's own clients and from third-party integrations, note the registered redirect_uri for each client_id, then mutate one parameter at a time: scope, response_type, state, client_id. The signal is any response that leaves the pixiv domain when the request is malformed.

To make the case convincing, show the full crafted URL and the browser following it, as this report does with a short video. Keep the payload domain obviously neutral, such as example.com, so the reviewer can see the redirect without any doubt about who controls the destination.

Glossary

  • OAuth 2.0: a standard way for one website or app to get limited access to your account on another site without you handing over your password.
  • Authorisation endpoint: a web address that performs a login or permission step when visited, rather than showing an ordinary page.
  • Client: the app or website that asks pixiv to log you in.
  • client_id: the identifier the client uses to tell pixiv which app is asking.
  • redirect_uri: the address the browser is sent back to after the login step.
  • Callback: the page at that address that waits to receive the result.
  • response_type: the parameter saying what kind of result the client wants, here a code.
  • scope: the list of permissions the client is asking for.
  • state: a value the client makes up and expects back unchanged, used to tie the reply to the request it started.
  • Code: a short-lived value issued after a successful login step, which the client exchanges for access.
  • Query string: the name=value settings after the ? in a web address, joined with &.
  • Parameter: one of those settings.
  • Percent-encoding: writing characters that are not allowed in a web address in coded form, such as %3A for : and %2F for /.
  • Host: one named machine on the internet, the part of an address between https:// and the first slash.
  • Open redirect: a site that will forward visitors to any address supplied in a link.
  • Phishing: a fake page or message that imitates a real service to trick someone into giving away credentials.
  • Credentials: the details used to prove who you are, usually a username and password.
  • Error path: the branch of a program that runs when a request is invalid, as opposed to the normal success path.
  • Validation: checking that a value in a request is acceptable before acting on it.
  • Recon: the early stage of testing where you gather addresses and parameters to try.
  • Severity: the rating given to a bug to express how serious it is.
  • Bounty: a payment made to a researcher for reporting a valid bug.
  • HackerOne: a platform where researchers report bugs to companies and companies respond.

More from pixiv

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Open redirect

The lesson behind this report.

A trusted site forwards users to any address an attacker picks; rarely paid alone, often the missing link in a chain.