Skip to content
Info disclosure Write-up Beginner

Bug Bounty — Finding and Exploiting a Cookie Security Flaw:

The PHPSESSID session cookie lacked the HttpOnly flag, so client-side JavaScript could read it. The author also found that arbitrary session ID values were accepted, suggesting weak session validation, but no actual theft or hijack was demonstrated.

Mickael Benlolo Follow

Published on medium.com

As cybersecurity enthusiasts, discovering vulnerabilities in real-world applications can be an eye-opening experience. Recently, I came across an interesting security issue in a web application that involves improper handling of cookies, specifically the PHPSESSID and missing HttpOnly flags.

Mickael Benlolo, 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

Root cause

Likely the session cookie was set without the HttpOnly attribute, and the server did not properly validate session identifiers.

Impact

If an attacker could run JavaScript on the site, they could read the session cookie and potentially take over a user's session; however, the author did not demonstrate an actual cross-site scripting attack or a real hijack.

What the attacker needed

Ability to run JavaScript on the site; victim visits a malicious page or link

The fix

The session cookie should be set with the HttpOnly flag, and the server should properly validate session identifiers.

How it was found

  1. Open the browser developer tools and go to the Application tab.
  2. Look for cookies under the Storage section.
  3. Inspect the PHPSESSID or other session cookies to check if the HttpOnly flag is set.
  4. If the HttpOnly flag is missing, try injecting a simple JavaScript payload to steal the cookie.
  5. If you are able to steal the cookie, test the application further by trying to hijack a session or perform unauthorised actions.

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.

A cookie is a small piece of data a website stores in your browser, often to remember who you are. The HttpOnly setting tells the browser to hide that cookie from JavaScript, so if an attacker finds a way to run their own JavaScript on the page, they cannot read it. Here the session cookie was not hidden, so any JavaScript on the page could read it.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More by Mickael Benlolo

View all

2 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.