Excessive Session Timeout
Sessions stay valid through long periods of inactivity or without any overall limit, extending the time a stolen or unattended session can be used.
| Severity | Low |
| CVSS 3.1 | 3.7 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N Open in the calculator |
| CVSS 4.0 | 6.3 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-613: Insufficient Session Expiration |
| OWASP Top 10 | A07:2025 Authentication Failures |
| MITRE ATT&CK | T1550.004 Web Session Cookie |
| Category | Security Misconfiguration |
Description
The application keeps authenticated sessions alive for longer than its risk justifies. This increases the time during which an unattended, signed-in device can be used by someone else, and during which a session token captured through another weakness, such as script injection, a leaked log or a shared computer, remains usable. Two limits are usually assessed: the idle timeout, after which a session with no activity should end, and the absolute timeout, after which a session should end regardless of activity.
Findings range from idle timeouts of many hours or days, through sessions that never expire on the server, to persistent cookies or tokens that keep the user signed in indefinitely without any deliberate choice to stay signed in. The weakness does not expose sessions itself, so its impact depends on the sensitivity of the application and how likely sessions are to be exposed; it matters most for administrative and financial functions and for use on shared devices. As a guide, the OWASP Session Management Cheat Sheet gives common idle timeouts of 2 to 5 minutes for high-value applications and 15 to 30 minutes for lower-risk ones, and an absolute timeout of 4 to 8 hours for an application used through a working day.
The timeouts are measured by leaving an authenticated session idle for a set period and then making a request, and by keeping a session active over a long period. Server-side behaviour matters more than the cookie's own expiry date, since a server that never expires the session will accept a replayed cookie. Client-side timers that only hide the page, while the server-side session remains valid, are a common variant.
Remediation
- Enforce an idle timeout and an absolute timeout on the server, set according to the sensitivity of the application, and invalidate the session when either is reached.
- Configure the timeouts in the platform's session settings, for example
<session-timeout>in a Javaweb.xml(in minutes),ExpireTimeSpanandSlidingExpirationin ASP.NET Core cookie authentication options, orSESSION_COOKIE_AGEin Django (in seconds), and add an absolute limit in application code where the platform does not provide one. - Keep access tokens short-lived, and limit the lifetime of refresh tokens, rotating them on use.
- Offer persistent sign-in only as a deliberate choice by the user, backed by a separate revocable token, and not for administrative accounts.
- Warn users before the session expires, so that a shorter timeout does not cause lost work, and require re-authentication for sensitive actions whatever the age of the session.
Confirm the fix by leaving a session idle beyond the configured limit, and by keeping a session active beyond the absolute limit, and confirming that the server rejects each.
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.