COMMON WEAKNESS ENUMERATIONIncomplete

CWE-1463

Insufficient Session Timeout Value

The product establishes an authenticated user session, but it does not properly set a timeout for the session. That is, the timeout is set to an excessively large value or is not set at all.

Abstraction

Base

Structure

Simple

Likelihood of Exploit

Medium

Understand the problem

What is the problem?

The product establishes an authenticated user session, but it does not properly set a timeout for the session. That is, the timeout is set to an excessively large value or is not set at all.

Extended description

There are two types of session timeouts. - Inactivity Timeout: The time window that a session will be expired if there is no user interaction within the session. - Absolute Timeout: Regardless of activity, the total lifetime of a session before it is forcefully expired.

Root cause

How and when does the problem arise?

Lifecycle phase

Implementation

Risk

What does successful exploitation lead to?

Gain Privileges or Assume Identity

Affected security scopes: Access Control, Integrity

This weakness may improve the likely success of certain attacks. For example, an attacker may intercept a session ID, possibly via a network sniffer or Cross-site Scripting attack. Although short session expiration times do not help if a stolen token is immediately used, they will protect against ongoing replaying of the session ID. In another scenario, a user might access a web site from a shared computer (such as at a library, Internet cafe, or open work environment), but forget to close the pages before leaving. A long expiration could allow an attacker to use the browser's back button to access web pages previously accessed by the victim.

Defence

How is it prevented and fixed?

Implementation

Implementation-phase defence

Detail
Ensure that user sessions have appropriate absolute timeouts set. The industry standard is between 4 and 8 hours for an absolute timeout [REF-1540].

Implementation

Implementation-phase defence

Detail
Ensure that user sessions have appropriate inactivity timeouts set. 2 to 5 minutes is recommended for high-value applications, and 15-30 minutes for low-risk applications [REF-1540].

Implementation

Implementation-phase defence

Detail
If using an authentication token for a user session, ensure that the token lifetime is configured based on the recommended best practices from the token provider [REF-1563]. There are situations using authentication tokens such as a JWT (Java Web Token) in which the server-side does not handle session timeouts and trusts the values directly from the token. In this case, it is important that the timeout value is set correctly for the token that is granted.
CWE-1463: Common Weakness Enumeration Entry CWE-1463