CWEweakness

CWE-6 J2EE Misconfiguration: Insufficient Session-ID Length

Official page ↗
Abstraction
Variant
Structure
Simple
Status
Incomplete
Languages
Java
CWE version
5.0

Description

The J2EE application is configured to use an insufficient session ID length.

Common consequences

• Access Control: Gain Privileges or Assume Identity — A short session identifier leaves the application open to brute-force session guessing attacks. If an attacker can guess an authenticated user's session identifier, they can take over the user's session (called session hijacking).

Potential mitigations

• [Implementation] Session identifiers should have enough bits of entropy to make it more difficult to perform brute-force session guessing. The number of possible session IDs increases with increased session ID length, making it more difficult to guess or steal a session ID. • [Implementation] A lower bound on the number of valid session identifiers that are available to be guessed is the number of users that are active on a site at any given moment. However, any users that abandon their sessions without logging out will increase this number. (This is one of many good reasons to have a short inactive session timeout.) With a 64 bit session identifier, assume 32 bits of entropy. For a large web site, assume that the attacker can try 1,000 guesses per second and that there are 10,000 valid session identifiers at any given moment. Given these assumptions, the expected time for an attacker to successfully guess a valid session identifier is less than 4 minutes. Now assume a 128 bit session identifier that provides 64 bits of entropy. With a very large web site, an attacker might try 10,000 guesses per second with 100,000 valid session identifiers available to be guessed. Given these assumptions, the expected time for an attacker to successfully guess a valid session identifier is greater than 292 years.

Detection methods

• Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Related

Attack pattern · CAPEC (2)

  • CAPEC-21 Exploitation of Trusted Identifiers attack pattern
  • CAPEC-59 Session Credential Falsification through Prediction attack pattern

Child of · CWE (1)

  • CWE-334 Small Space of Random Values weakness

Referenced by CAPEC · weakness (2)

  • CAPEC-21 Exploitation of Trusted Identifiers attack pattern
  • CAPEC-59 Session Credential Falsification through Prediction attack pattern

Referenced by CVE · weakness (1)

  • CVE-2018-12538 In Eclipse Jetty versions 9.4.0 through 9.4.8, when using the optional Jetty provided FileSessionDataStore for persistent storage of… vulnerability