Base · Medium

CWE-334: Small Space of Random Values

The number of possible random values is smaller than needed by the product, making it more susceptible to brute force attacks.

CWE-334 · Base Level ·4 CVEs ·1 Mitigations

Description

The number of possible random values is smaller than needed by the product, making it more susceptible to brute force attacks.

Potential Impact

Access Control, Other

Bypass Protection Mechanism, Other

Demonstrative Examples

The following XML example code is a deployment descriptor for a Java web application deployed on a Sun Java Application Server. This deployment descriptor includes a session configuration property for configuring the session ID length.
Bad
<sun-web-app>
                        ...<session-config>
                              <session-properties><property name="idLengthBytes" value="8"><description>The number of bytes in this web module's session ID.</description></property></session-properties>
                           </session-config>...
                     </sun-web-app>
This deployment descriptor has set the session ID length for this Java web application to 8 bytes (or 64 bits). The session ID length for Java web applications should be set to 16 bytes (128 bits) to prevent attackers from guessing and/or stealing a session ID and taking over a user's session.
Note for most application servers including the Sun Java Application Server the session ID length is by default set to 128 bits and should not be changed. And for many application servers the session ID length cannot be changed from this default setting. Check your application server documentation for the session ID length default setting and configuration options to ensure that the session ID length is set to 128 bits.

Mitigations & Prevention

Architecture and DesignRequirements

Use products or modules that conform to FIPS 140-2 [REF-267] to avoid obvious entropy problems. Consult FIPS 140-2 Annex C ("Approved Random Number Generators").

Real-World CVE Examples

CVE IDDescription
CVE-2002-0583Product uses 5 alphanumeric characters for filenames of expense claim reports, stored under web root.
CVE-2002-0903Product uses small number of random numbers for a code to approve an action, and also uses predictable new user IDs, allowing attackers to hijack new accounts.
CVE-2003-1230SYN cookies implementation only uses 32-bit keys, making it easier to brute force ISN.
CVE-2004-0230Complex predictability / randomness (reduced space).

Taxonomy Mappings

  • PLOVER: — Small Space of Random Values

Frequently Asked Questions

What is CWE-334?

CWE-334 (Small Space of Random Values) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Base-level weakness. The number of possible random values is smaller than needed by the product, making it more susceptible to brute force attacks.

How can CWE-334 be exploited?

Attackers can exploit CWE-334 (Small Space of Random Values) to bypass protection mechanism, other. This weakness is typically introduced during the Architecture and Design, Implementation phase of software development.

How do I prevent CWE-334?

Key mitigations include: Use products or modules that conform to FIPS 140-2 [REF-267] to avoid obvious entropy problems. Consult FIPS 140-2 Annex C ("Approved Random Number Generators").

What is the severity of CWE-334?

CWE-334 is classified as a Base-level weakness (Medium abstraction). It has been observed in 4 real-world CVEs.