Skip to content
Account takeover Write-up Intermediate

How Changing 401 to 200 Lead to Full Account Takeover

The application trusted a client-side authentication check, so after logout the server session remained valid for 24 hours. An attacker could modify a failed login response from 401 to 200 and gain full access to the previous user's account, including changing email and password.

KhaledAhmed107 Follow

Published on medium.com

It was a normal day, me and my bro asherif1 were working on a private program when we stumbled upon something interesting. We were testing the authentication flow nothing fancy, just the usual login and logout cycle.

KhaledAhmed107, 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.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

What the attacker needed

Access to the same device after victim logs out; ability to intercept and modify HTTP responses

How it was found

  1. Log in to your account (Account A)
  2. Log out
  3. Attempt to log in with the correct email but a wrong password
  4. Intercept the response — server returns 401 Unauthorized
  5. Modify the response to 200 OK
  6. The application grants access to Account A and you can perform any action like changing name, email, or password without any verification.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

When you log in, the server gives your browser a session token. Normally the server checks that token on every request. Here, the app only checked the login response in the browser, so changing a failed login reply to look successful let the browser reuse an old session that the server still accepted. This meant someone on a shared computer could take over the previous user's account.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

More by KhaledAhmed107

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.