CWE-340: Generation of Predictable Numbers or Identifiers
|
Weakness ID: 340
Vulnerability Mapping:
ALLOWED
This CWE ID could be used to map to real-world vulnerabilities in limited situations requiring careful review
(with careful review of mapping notes)
Abstraction:
Class
Class - a weakness that is described in a very abstract fashion, typically independent of any specific language or technology. More specific than a Pillar Weakness, but more general than a Base Weakness. Class level weaknesses typically describe issues in terms of 1 or 2 of the following dimensions: behavior, property, and resource.
|
View customized information:
Shows the description and diagram, platforms, mitigations, consequences, relationships, memberships, and content history.
For users who are interested in more notional aspects of a weakness. Example: educators, technical writers, and project/program managers.
For users who are concerned with the practical application and details about the nature of a weakness and how to prevent it from happening. Example: tool developers, security researchers, pen-testers, incident response analysts.
For users who are mapping an issue to CWE/CAPEC IDs, i.e., finding the most appropriate CWE for a specific issue (e.g., a CVE record). Example: tool developers, security researchers.
For users who wish to see all available information for the CWE/CAPEC entry.
For users who want to customize what details are displayed.
More information is available — Please edit the custom filter or select a different filter.
Description
The product uses a scheme that generates numbers or identifiers that are more predictable than required.
Common Consequences
This table specifies different individual consequences
associated with the weakness. The Scope identifies the application security area that is
violated, while the Impact describes the negative technical impact that arises if an
adversary succeeds in exploiting this weakness. The Likelihood provides information about
how likely the specific consequence is expected to be seen relative to the other
consequences in the list. For example, there may be high likelihood that a weakness will be
exploited to achieve a certain impact, but a low likelihood that it will be exploited to
achieve a different impact.
| Impact |
Details |
|
Varies by Context
|
Scope: Other
|
Relationships
This table shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOf and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition,
relationships such as PeerOf, Overlaps, and CanAlsoBe are defined to show similar weaknesses that the user
may want to explore.
|
Relevant to the view "Complete Weakness Hierarchy" (View-1000)
|
|
Nature |
Type |
ID |
Name |
|
ChildOf |
Class - a weakness that is described in a very abstract fashion, typically independent of any specific language or technology. More specific than a Pillar Weakness, but more general than a Base Weakness. Class level weaknesses typically describe issues in terms of 1 or 2 of the following dimensions: behavior, property, and resource.
|
330
|
Use of Insufficiently Random Values
|
|
ParentOf |
Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource.
|
341
|
Predictable from Observable State
|
|
ParentOf |
Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource.
|
342
|
Predictable Exact Value from Previous Values
|
|
ParentOf |
Base - a weakness that is still mostly independent of a resource or technology, but with sufficient details to provide specific methods for detection and prevention. Base level weaknesses typically describe issues in terms of 2 or 3 of the following dimensions: behavior, property, technology, language, and resource.
|
343
|
Predictable Value Range from Previous Values
|
|
CanPrecede |
Composite - a Compound Element that consists of two or more distinct weaknesses, in which all weaknesses must be present at the same time in order for a potential vulnerability to arise. Removing any of the weaknesses eliminates or sharply reduces the risk. One weakness, X, can be "broken down" into component weaknesses Y and Z. There can be cases in which one weakness might not be essential to a composite, but changes the nature of the composite when it becomes a vulnerability.
|
384
|
Session Fixation
|
|
Modes
Of Introduction
The different Modes of Introduction provide information
about how and when this
weakness may be introduced. The Phase identifies a point in the life cycle at which
introduction
may occur, while the Note provides a typical scenario related to introduction during the
given
phase.
| Phase(s) |
Note |
|
Architecture and Design
|
|
|
Implementation
|
|
Applicable Platforms
This listing shows possible areas for which the given
weakness could appear. These
may be for specific named Languages, Operating Systems, Architectures, Paradigms,
Technologies,
or a class of such platforms. The platform is listed along with how frequently the given
weakness appears for that instance.
| Type |
Applicable Platforms |
Notes |
| Languages |
Class: Not Language-Specific
(Undetermined Prevalence)
|
|
Demonstrative Examples
Example 1
This code generates a unique random identifier for a user's session.
(bad code)
Example Language: PHP
function generateSessionID($userID){ srand($userID); return rand(); }
Because the seed for the PRNG is always the user's ID, the session ID will always be the same. An attacker could thus predict any user's session ID and potentially hijack the session.
This example also exhibits a Small Seed Space (CWE-339).
Selected Observed
Examples
Note: this is a curated list of examples for users to understand the variety of ways in which this
weakness can be introduced. It is not a complete list of all CVEs that are related to this CWE entry.
| Reference |
Description |
|
|
Product for administering PBX systems uses predictable identifiers and timestamps for filenames ( CWE-340) which allows attackers to access files via direct request ( CWE-425).
|
|
|
PRNG allows attackers to use the output of small PRNG requests to determine the internal state information, which could be used by attackers to predict future pseudo-random numbers.
|
|
|
Listening TCP ports are sequentially allocated, allowing spoofing attacks.
|
Weakness Ordinalities
| Ordinality |
Description |
|
Primary
|
(where the weakness exists independent of other weaknesses)
|
Detection
Methods
| Method |
Details |
|
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.)
|
Vulnerability Mapping Notes
|
Usage
|
ALLOWED-WITH-REVIEW
(this CWE ID could be used to map to real-world vulnerabilities in limited situations requiring careful review)
|
| Reason |
Abstraction
|
|
Rationale
|
This CWE entry is a Class and might have Base-level children that would be more appropriate
|
|
Comments
|
Examine children of this entry to see if there is a better fit
|
Notes
Maintenance
As of CWE 4.5, terminology related to randomness, entropy, and
predictability can vary widely. Within the developer and other
communities, "randomness" is used heavily. However, within
cryptography, "entropy" is distinct, typically implied as a
measurement. There are no commonly-used definitions, even within
standards documents and cryptography papers. Future versions of
CWE will attempt to define these terms and, if necessary,
distinguish between them in ways that are appropriate for
different communities but do not reduce the usability of CWE for
mapping, understanding, or other scenarios.
Taxonomy
Mappings
| Mapped Taxonomy Name |
Node ID |
Fit |
Mapped Node Name |
| PLOVER |
|
|
Predictability problems |
| WASC |
11 |
|
Brute Force |
References
| [REF-44] |
Michael Howard, David LeBlanc and John Viega. "24 Deadly Sins of Software Security". "Sin 20: Weak Random Numbers." Page 299. McGraw-Hill. 2010.
|
Content
History
| Submissions |
| Submission Date |
Submitter |
Organization |
2006-07-19
(CWE Draft 3, 2006-07-19)
|
PLOVER |
|
|
|
| Modifications |
| Modification Date |
Modifier |
Organization |
2025-12-11
(CWE 4.19, 2025-12-11)
|
CWE Content Team |
MITRE |
|
updated Applicable_Platforms, Detection_Factors, Relationships, Weakness_Ordinalities
|
2024-07-16
(CWE 4.15, 2024-07-16)
|
CWE Content Team |
MITRE |
|
updated Relationships
|
2024-02-29
(CWE 4.14, 2024-02-29)
|
CWE Content Team |
MITRE |
|
updated Demonstrative_Examples
|
2023-10-26
(CWE 4.13, 2023-10-26)
|
CWE Content Team |
MITRE |
|
updated Observed_Examples
|
2023-06-29
(CWE 4.12, 2023-06-29)
|
CWE Content Team |
MITRE |
|
updated Mapping_Notes
|
2023-04-27
(CWE 4.11, 2023-04-27)
|
CWE Content Team |
MITRE |
|
updated Relationships
|
2021-10-28
(CWE 4.6, 2021-10-28)
|
CWE Content Team |
MITRE |
|
updated Relationships
|
2021-07-20
(CWE 4.5, 2021-07-20)
|
CWE Content Team |
MITRE |
|
updated Maintenance_Notes
|
2020-02-24
(CWE 4.0, 2020-02-24)
|
CWE Content Team |
MITRE |
|
updated Description, Name, Relationships
|
2012-05-11
(CWE 2.2, 2012-05-15)
|
CWE Content Team |
MITRE |
|
updated References, Relationships
|
2011-06-27
(CWE 2.0, 2011-06-27)
|
CWE Content Team |
MITRE |
|
updated Common_Consequences
|
2011-06-01
(CWE 1.13, 2011-06-01)
|
CWE Content Team |
MITRE |
|
updated Common_Consequences
|
2010-02-16
(CWE 1.8, 2010-02-16)
|
CWE Content Team |
MITRE |
|
updated Taxonomy_Mappings
|
2008-09-08
(CWE 1.0, 2008-09-09)
|
CWE Content Team |
MITRE |
|
updated Relationships, Taxonomy_Mappings
|
2008-07-01
(CWE 1.0, 2008-09-09)
|
Eric Dalci |
Cigital |
|
updated Time_of_Introduction
|
| Previous Entry Names |
| Change Date |
Previous Entry Name |
| 2020-02-24
|
Predictability Problems |
More information is available — Please edit the custom filter or select a different filter.
|