An overly long session timeout gives attackers more time to potentially compromise user accounts.
The longer a session stays open, the larger the window of opportunity an attacker has to compromise user accounts. While a session remains active, an attacker might be able to brute force a user's password, crack a user's wireless encryption key, or commandeer a session from an open browser. Longer session timeouts can also prevent memory from being released and eventually result in a denial of service if a sufficiently large number of sessions are created.
Example 1: If the session timeout is zero or less than zero, the session never expires. The following example shows a session timeout set to -1, which will cause the session to remain active indefinitely.
<session-config>
<session-timeout>-1</session-timeout>
</session-config>
<session-timeout>
tag defines the default session timeout interval for all sessions in the web application. If the <session-timeout>
tag is missing, it is left to the container to set the default timeout.[1] Standards Mapping - OWASP Top 10 2004 - (OWASP 2004) A3 Broken Authentication and Session Management
[2] Standards Mapping - OWASP Top 10 2010 - (OWASP 2010) A3 Broken Authentication and Session Management
[3] Standards Mapping - OWASP Top 10 2007 - (OWASP 2007) A7 Broken Authentication and Session Management
[4] Standards Mapping - Security Technical Implementation Guide Version 3 - (STIG 3) APP3415 CAT II
[5] Standards Mapping - Common Weakness Enumeration - (CWE) CWE ID 613
[6] Standards Mapping - FIPS200 - (FISMA) IA
[7] Standards Mapping - Web Application Security Consortium 24 + 2 - (WASC 24 + 2) Insufficient Session Expiration
[8] Sun Microsystems, Inc. Java Servlet Specification 2.4
[9] Standards Mapping - Payment Card Industry Data Security Standard Version 1.1 - (PCI 1.1) Requirement 6.5.3, Requirement 8.5.15
[10] Standards Mapping - Payment Card Industry Data Security Standard Version 1.2 - (PCI 1.2) Requirement 6.5.7, Requirement 8.5.15
[11] Standards Mapping - Payment Card Industry Data Security Standard Version 2.0 - (PCI 2.0) Requirement 6.5.8, Requirement 8.5.15