Critical Session Management Vulnerability Leading to Account Hijacking
The session storage directory was publicly accessible, exposing session files whose names matched session cookie values. An attacker could use a session identifier from these files to impersonate a user and access an employee account without a password.
Published on medium.com
During a routine security assessment, I discovered a critical vulnerability in a web application that allowed unauthorized access to user accounts. The root cause was improper session management — specifically, the session files were publicly accessible.
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 web server was misconfigured to allow public directory listing and file access to the session storage folder, and session identifiers were stored as filenames that directly matched cookie values.
Impact
An attacker could hijack user sessions and gain unauthorised access to sensitive employee and user data.
What the attacker needed
Target uses a publicly accessible session storage directory; Attacker can browse the storage directory; Session cookie value matches a session file name
The fix
The session storage directory should be made inaccessible from the web, and session identifiers should not be stored as predictable filenames.
How it was found
- Scan the target domain for directories using a tool like Dirsearch.
- Find a directory named 'storage' that returns a 200 OK status.
- Explore the 'storage' directory and locate a subdirectory named 'sessions'.
- Observe session files named with a pattern matching the session cookie prefix.
- Replace the session cookie value with a value taken from one of the session files.
- Access an employee account without providing a password.
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 session is like a temporary pass that a website gives you after you log in, so you don't have to type your password on every page. Here, the website kept these passes in a folder that anyone could browse, and the file names were the same as the pass values. By copying a pass from that folder into their browser cookie, an attacker could pretend to be that user.
What is Info disclosure?
Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.