Skip to content
Info disclosure Write-up Beginner

The Hidden Risk of Non-HttpOnly Cookies — and How I Found One

An authentication cookie lacked the HttpOnly flag and had a very long lifetime, so any JavaScript running on the page could read the token. If an XSS flaw were found, an attacker could steal the token and take over accounts for months.

amitgy04 Follow

Published on medium.com

When hunting for security vulnerabilities, sometimes the most interesting issues are not the “flashy” ones, but the quiet ones — the ones that sit in the background, waiting for the right conditions to cause serious damage.

Amitishacked, 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 authentication cookie was issued without the HttpOnly attribute and with an excessively long expiry.

Impact

If an XSS vulnerability were found, an attacker could read the long-lived token and take over the victim's account for months; the report notes no XSS was found during the initial review.

What the attacker needed

A free account; an XSS vulnerability on the site; victim visits a malicious page

The fix

The text says a fix had been deployed, and recommends setting HttpOnly on authentication cookies, using Secure, and reducing token lifetimes.

How it was found

  1. Log in as a normal user.
  2. Open the browser's Developer Tools and go to the Console.
  3. Run document.cookie to list cookies.
  4. Look for authentication-related cookies such as accessToken, session, or refreshToken.
  5. Open DevTools, then Application, then Storage, then Cookies to check attributes like HttpOnly, Secure, and expiration date.

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 keep you logged in. The HttpOnly setting stops JavaScript on the page from reading that cookie. Without it, if an attacker can run their own script on the site, they can read the login token and use it to act as you.

What is Info disclosure?

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

More by amitgy04

View all

1 more disclosed report, 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.