Insecure Session Management (Weak Session Identifier)
- CWE 331
- OWASP 2025-A04
- OWASP 2025-A07
The value of a session cookie is short or has a very limited character set, so the number of possible identifiers is small enough to be tried one by one. An attacker that finds a valid identifier takes over that user's session.
Rapplex estimates the entropy from the length and character classes of the value and from how varied its characters are. Fewer than 64 bits is considered weak. The estimate is an upper bound: an identifier that looks weak here is weak, one that passes may still be predictable if it is generated badly.
Remediation
Let the framework generate session identifiers and do not build them from user data, timestamps, counters or the process' general purpose random generator.
Use at least 128 bits of cryptographic randomness, which is 16 random bytes encoded as 22 or more characters.
Rotate the identifier on login and invalidate all existing sessions after the change.
References
Search Vulnerability
You may also see
- Insecure Session Management (Missing SameSite Attribute)
- Insecure Session Management (SameSite None Without Secure)
- Insecure Session Management (Weak Session Identifier)
- Insecure Session Management (Predictable Session Identifier)
- Insecure Session Management (Session Identifier in URL)
- Insecure Session Management (Excessive Cookie Lifetime)
- Insecure JSON Web Token
- Insecure Session Management