Skip to content
Access control Write-up Intermediate

Blackbox Cookie Testing — How I Cracked The Admin’s Cookie

The session cookie stored the username in a weakly encoded form, and by changing the cookie's username field and a flag byte, the tester could impersonate the admin user. This allowed full control of the web application as the admin.

Saeed Balquizi Follow

Published on web.archive.org

{{media:0}}

Saeed Balquizi, 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.

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 not integrity-protected and encoded the username directly, allowing tampering to impersonate another user.

Impact

An attacker could impersonate the admin user and gain full control of the web application.

What the attacker needed

Ability to create accounts; ability to modify cookies

How it was found

  1. Create multiple user accounts and compare their session cookies.
  2. Notice that the username appears in the cookie as repeated 4-digit codes.
  3. Create an account with a known username to map characters to codes.
  4. Modify a test account's cookie to replace the username with 'admin'.
  5. Change the beginning of the cookie from 0102 to 0100.
  6. Refresh the page and access the application as admin.

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 to remember who you are. Here, the cookie contained the username in a simple encoded form, so by editing it to say 'admin' and changing one other part, the tester could pretend to be the admin without knowing the password.

What is Access control?

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.

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.