Session Fixation
The application keeps the same session identifier after login, so an attacker who plants an identifier in a victim's browser can use the session once they sign in.
| Severity | Medium |
| CVSS 3.1 | 6.8 CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N Open in the calculator |
| CVSS 4.0 | 7.4 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:A/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-384: Session Fixation |
| OWASP Top 10 | A07:2025 Authentication Failures |
| MITRE ATT&CK | T1550.004 Web Session Cookie |
| Category | Broken Access Control |
Description
The application does not issue a new session identifier when a user authenticates. The identifier the browser held before sign-in, which may have been chosen or obtained by an attacker, becomes an authenticated session once the user signs in. An attacker who can place a known identifier in the victim's browser can then use the same identifier to act as the victim, gaining the victim's authenticated session, with all of their privileges, as soon as the victim signs in and without needing their password.
The attack requires the victim to sign in after the identifier has been planted, and requires a separate means of planting it, which limits how widely it can be used. Common routes are applications that accept a session identifier from a URL parameter or path, through URL rewriting, where a crafted link is enough; applications that accept any identifier the client presents and create a session for it (permissive session management); cookie injection from a vulnerable or attacker-controlled subdomain sharing the parent domain; and script injection or response splitting elsewhere in the application.
Fixation is confirmed by noting the session identifier before sign-in, signing in, and observing that the same identifier remains valid and is now authenticated. The same weakness applies when the identifier is not renewed on other privilege changes, such as completing a second authentication factor or switching to an administrative role.
Remediation
- Generate a new session identifier immediately after successful authentication and destroy the pre-authentication session on the server, for example with
session_regenerate_id(true)in PHP,HttpServletRequest.changeSessionId()in Java servlets, or the session fixation protection built into frameworks such as Spring Security. - Renew the identifier on every other privilege change, including completion of multi-factor authentication and elevation to an administrative role.
- Accept session identifiers only from cookies, never from URL parameters or the request path, and disable URL rewriting in the application server.
- Accept only identifiers that the application itself has issued (strict session management), and reject unknown values.
- Set session cookies with the
Secure,HttpOnlyandSameSiteattributes and without a broadDomainattribute, or use the__Host-name prefix so that subdomains cannot set them.
Confirm the fix by recording the session identifier before sign-in and confirming that it is replaced, and the old value rejected, after authentication.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.