Skip to content
Account takeover Write-up Beginner

Broken Authentication — Bug Bounty

The session ID was not invalidated after logout, so an attacker could reuse an old session ID to access the account without credentials. The report demonstrates logging in, capturing a request, logging out, and replaying the old session ID to regain access.

Vulnerables Follow

Published on web.archive.org

Bounty$50 View original

{{media:0}}

Vulnerables, on web.archive.org

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

Context

The target is a site at www.tribeofnoise.com, and the feature in question is the authenticated profile editing page, reached at a URL of the form profile_edit.php. Normally that page should only be reachable while a valid, live session exists: once you log out, the server should reject the old session identifier and send you back to the login page. The report is about what happened instead.

The author frames the finding as Broken Authentication (Poor session management), rates it Critical, and maps it to the OWASP testing guide item OTG-AUTHN-004. The write-up also mentions that the same site was vulnerable to CSRF account takeover and file upload XSS, but those were covered in a previous write-up and are not explained here.

Vulnerables
Vulnerables From the original on web.archive.org

Setup

  • A browser, specifically Mozilla, configured to send traffic through a proxy.
  • Burpsuite as the intercepting proxy, with the Repeater tool used to hold and resend a captured request.
  • An account on the target site, so that a session can be created by logging in.
  • No special role or privilege is described; the flow is a normal logged-in user editing their own profile.

Finding it

The researcher's starting observation is a general one about bug bounty programmes: a site that is not vulnerable to XSS or CSRF may still be worth probing for other classes of bug. The specific behaviour noticed here is that the session ID does not expire after logging out. Because the identifier stays valid server-side, an attacker who holds a copy of it can replay requests with it and be logged into the account without any credentials. The report notes the bug can also be exploited with two different browsers.

From the original on web.archive.org

Exploitation

Step 1: log in and capture the session

Log in to the account. The website creates a session ID for the current login. This is the value that will later be replayed.

Step 2: configure the proxy

Configure the browser (Mozilla) to use a proxy tool (Burpsuite) so that requests can be intercepted.

Step 3: intercept the edit profile request

Click on any page to intercept the request. In the report the edit profile page request is the one intercepted, and it is sent to Repeater so that a copy of it, carrying the old session ID, is kept for later.

Request From the original on web.archive.org

Step 4: log out

Log out of the account through the normal logout function. The expectation is that this destroys the session on the server side.

Step 5: request the protected page while logged out

With interception still on, put the edit profile URL into the URL bar:

HTTP
https://www.tribeofnoise.com/profile_edit.php/ID=52763

The report notes there is no parameter IDOR here, so the ID value is not the point of the test; other bugs should be looked for separately.

Step 6: replay the old request

Press enter, and in the intercept tab replace the current request with the one kept in Repeater, the one carrying the old session ID, then forward it.

Because the account was logged out, the correct response would be an error such as Your session is expired, or a redirect to the login page. Instead, the server logs the request into the account without any authentication. The report describes this as the whole exploit: the stale session ID is still accepted.

A video proof of concept accompanies the write-up.

Root cause

The session identifier is not invalidated server-side when the user logs out. The session identifier is not invalidated server-side when the user logs out, so the token remains valid and any copy of it can still be used. The report does not describe the server-side implementation, so the exact mechanism is not stated; likely the session store is never told to destroy or rotate the ID at logout.

The expected error or redirect to login never happened: the server treated the replayed request as a legitimate authenticated session.

Impact

An attacker holding a captured session ID can log into the victim's account without any credentials, even after the victim has logged out. The report notes the same result can be achieved with two different browsers. The severity is given as Critical. The report does not describe how an attacker would obtain the session ID in the first place, so the practical reach of the bug depends on that separate step.

Fix

The report gives a timeline rather than a description of the code change:

Date Event
5 Oct 2018 Bug reported
26 Oct 2018 Bug triaged
29 Oct 2018 Bug fixed

What was changed is not stated. A fix for this class of bug would be to destroy the session server-side on logout, so that the old identifier is rejected.

Variants to test

  1. Logout then replay. Capture an authenticated request, log out, and resend the captured request with the old session cookie. A positive result is a normal authenticated response instead of an expiry error or a redirect to login.
  2. Two browsers. Log in in one browser, copy the session, log out in the other, and use the copied session. A positive result is that the copied session still works after logout.

Have a happy hunting.

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

A website let people create an account and edit their profile. When you log in, the site gives your browser a kind of pass, called a session ID. Think of it like a cloakroom ticket: you hand in your coat, you get a ticket, and later you show the ticket to get the coat back. The ticket is only supposed to work while you are still in the building. When you leave (log out), the cloakroom should tear up its copy of the ticket so nobody can use it again.

On this site, the cloakroom never tore up its copy. The session ID kept working after logout. So if someone had a copy of your ticket, they could walk back in and get your coat, without ever showing ID. That is what this report is about: the site called www.tribeofnoise.com, and specifically its profile editing page, which lives at a URL ending in profile_edit.php.

Normally that page should only open while you have a valid, live session. Once you log out, the server should reject the old session ID and send you back to the login page. The report describes what happened instead.

The author labels the finding Broken Authentication (Poor session management), rates it Critical, and maps it to the OWASP testing guide item OTG-AUTHN-004. The write-up also mentions that the same site was vulnerable to CSRF account takeover and file upload XSS, but those were covered in a previous write-up and are not explained here.

Vulnerables
Vulnerables From the original on web.archive.org

The pieces you need

Before the steps make sense, here is what each tool and idea is, from zero.

  • A browser. The program you use to visit websites. The report uses Mozilla (Firefox).
  • A proxy. A middleman program that sits between your browser and the website. Instead of your browser talking straight to the site, it talks to the proxy, and the proxy talks to the site. This lets you look at, pause, and change the messages going back and forth. Think of it as a postal worker who opens every letter, lets you read it, and lets you rewrite it before delivering it.
  • Burpsuite. A well-known proxy tool used by security testers. It can pause a request (intercept it) so you can inspect or edit it.
  • Repeater. A part of Burpsuite that holds a copy of a request and lets you send it again and again, whenever you like. Think of it as a saved draft message you can resend at any time.
  • A request. Every time you click a link or load a page, your browser sends a message to the server asking for something. That message is a request.
  • A session ID. A long random-looking value the server gives your browser after you log in. Your browser sends it back with every request so the server knows who you are. It is like a wristband at an event: show it and you get in without showing your ticket again.
  • Logging out. Telling the site you are done. The site is supposed to throw away its record of your session ID so the wristband stops working.
  • Broken authentication. A broad name for bugs where a site's login or session handling can be bypassed. Poor session management is one kind: the site does not properly end or protect sessions.
  • OWASP. A well-known project that publishes guidance and testing checklists for web security. OTG-AUTHN-004 is one item in its testing guide, about authentication testing.
  • XSS and CSRF. Two other common web bug types. XSS is when an attacker gets their own code to run in someone else's browser. CSRF is when an attacker tricks a logged-in user's browser into sending a request the user did not intend. The report mentions the site had these too, but does not explain them here.

What you need to try it

  • A browser, specifically Mozilla, set up to send its traffic through a proxy.
  • Burpsuite as that proxy, with the Repeater tool used to hold and resend a captured request.
  • An account on the target site, so that logging in creates a session.

No special role or privilege is described. The flow is a normal logged-in user editing their own profile.

How it was found

The researcher's starting point is a general tip about bug bounty programmes: a site that is not vulnerable to XSS or CSRF may still be worth probing for other kinds of bug. Do not stop at the first two checks.

The specific behaviour noticed here is that the session ID does not expire after logging out. Because the identifier stays valid on the server, anyone holding a copy of it can resend requests with it and be logged into the account without any credentials. The report notes the bug can also be exploited with two different browsers.

From the original on web.archive.org

Step by step

Step 1: log in and capture the session

Log in to the account. The website creates a session ID for the current login. This is the value that will later be replayed. You are noting it down now because it is the thing you will try to reuse after logout.

Step 2: set up the proxy

Configure the browser (Mozilla) to use a proxy tool (Burpsuite) so that requests can be intercepted. Without this, your browser talks straight to the site and you cannot pause or copy anything.

Step 3: intercept the edit profile request

Click on any page to intercept the request. In the report the edit profile page request is the one intercepted, and it is sent to Repeater so that a copy of it, carrying the old session ID, is kept for later. You are saving a snapshot of a request that was made while you were properly logged in.

Request From the original on web.archive.org

Step 4: log out

Log out of the account through the normal logout function. The expectation is that this destroys the session on the server side, so the saved copy should become useless.

Step 5: ask for the protected page while logged out

With interception still on, put the edit profile URL into the URL bar:

HTTP
https://www.tribeofnoise.com/profile_edit.php/ID=52763

Line by line, in plain words:

  • https:// is the secure version of the web address scheme, meaning the traffic is encrypted.
  • www.tribeofnoise.com is the site being tested.
  • /profile_edit.php is the page that lets a logged-in user edit their profile. The .php ending just tells you the page is generated by a program written in the PHP language.
  • /ID=52763 is an extra piece tacked onto the address. The report notes there is no parameter IDOR here, so the ID value is not the point of the test; other bugs should be looked for separately. IDOR is a different bug type where changing an identifier lets you reach someone else's data, and the author is saying that is not what is happening here.

Step 6: replay the old request

Press enter, and in the intercept tab replace the current request with the one kept in Repeater, the one carrying the old session ID, then forward it. In other words: you are swapping the fresh, logged-out request for the saved, logged-in one, and letting it go to the server.

Because the account was logged out, the correct response would be an error such as Your session is expired, or a redirect to the login page. Instead, the server logs the request into the account without any authentication. The report describes this as the whole exploit: the stale session ID is still accepted.

A video proof of concept accompanies the write-up.

Why it works

The session identifier is not invalidated on the server when the user logs out. The session identifier is not invalidated on the server when the user logs out, so the token remains valid and any copy of it can still be used. So the token remains valid and any copy of it can still be used. The report does not describe the server-side implementation, so the exact mechanism is not stated; likely the session store is never told to destroy or rotate the ID at logout.

The expected error or redirect to login never happened: the server treated the replayed request as a legitimate authenticated session.

What an attacker could do

An attacker holding a captured session ID can log into the victim's account without any credentials, even after the victim has logged out. The report notes the same result can be achieved with two different browsers. The severity is given as Critical. The report does not describe how an attacker would obtain the session ID in the first place, so the practical reach of the bug depends on that separate step.

How it was fixed

The report gives a timeline rather than a description of the code change:

Date Event
5 Oct 2018 Bug reported
26 Oct 2018 Bug triaged
29 Oct 2018 Bug fixed

What was changed is not stated. A fix for this class of bug would be to destroy the session on the server at logout, so that the old identifier is rejected.

Other ways to test the same idea

  1. Logout then replay. Capture an authenticated request, log out, and resend the captured request with the old session cookie. A positive result is a normal authenticated response instead of an expiry error or a redirect to login.
  2. Two browsers. Log in in one browser, copy the session, log out in the other, and use the copied session. A positive result is that the copied session still works after logout.

Have a happy hunting.

Glossary

  • Browser: the program you use to visit websites, such as Mozilla Firefox.
  • Proxy: a middleman program that sits between your browser and a website so you can inspect and change the messages.
  • Burpsuite: a proxy tool used by security testers to intercept and resend web requests.
  • Repeater: the part of Burpsuite that holds a saved request and lets you send it again whenever you like.
  • Request: the message your browser sends to a server asking for a page or an action.
  • Response: the message the server sends back.
  • Session: a period during which the server remembers who you are, usually after you log in.
  • Session ID: the random value the server gives your browser to identify your session.
  • Cookie: a small piece of data a site stores in your browser, often used to carry the session ID.
  • Logout: telling the site you are done, which should end the session on the server.
  • Authentication: proving who you are, usually by logging in.
  • Broken authentication: a bug class where login or session handling can be bypassed.
  • Session management: how a site creates, tracks and ends sessions.
  • Session invalidation: destroying a session on the server so its ID stops working.
  • Session rotation: giving a new session ID at certain points, such as login, so old ones stop being useful.
  • Replay: sending a saved request again later.
  • Credentials: the details that prove your identity, such as a username and password.
  • OWASP: a project that publishes web security guidance and testing checklists.
  • OTG-AUTHN-004: an OWASP testing guide item about authentication testing.
  • XSS: a bug where an attacker gets their own code to run in someone else's browser.
  • CSRF: a bug where an attacker tricks a logged-in user's browser into sending a request the user did not intend.
  • IDOR: a bug where changing an identifier in a request lets you reach someone else's data.
  • Critical: a severity label meaning the bug is very serious.
  • PoC: proof of concept, a demonstration that the bug really works.
  • Bug bounty: a programme that pays researchers for reporting security bugs.
  • Triaged: the stage where the programme has reviewed a report and confirmed it is valid.

More by Vulnerables

View all

2 more disclosed reports, 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.