941
Likelihood Of Exploit
Medium
Common Consequences
Scope Impact Likelihood
Confidentiality
Other
Read Application Data
Other
Information exposure.
Potential Mitigations
Phase: Architecture and Design
Whenever possible, specify implementation strategies that do not introduce time variances in
operations.
Phase: Implementation
Often one can artificially manipulate the time which operations take or -- when operations occur
-- can remove information from the attacker.
Phase: Implementation
It is reasonable to add artificial or random delays so that the amount of CPU time consumed is
independent of the action being taken by the application.
Demonstrative Examples
Example 1:
In this example, the attacker observes how long an authentication takes when the user types in the
correct password.
When the attacker tries their own values, they can first try strings of various length. When they
find a string of the right length, the computation will take a bit longer, because the for loop will
run at least once. Additionally, with this code, the attacker can possibly learn one character of the
password at a time, because when they guess the first character right, the computation will take
longer than a wrong guesses. Such an attack can break even the most sophisticated password with
a few hundred guesses.
Example Language: Python (Bad)
def validate_password(actual_pw, typed_pw):
if len(actual_pw) <> len(typed_pw):
return 0
for i in len(actual_pw):
if actual_pw[i] <> typed_pw[i]:
return 0
return 1
Note that in this example, the actual password must be handled in constant time as far as the
attacker is concerned, even if the actual password is of an unusual length. This is one reason why
it is good to use an algorithm that, among other things, stores a seeded cryptographic one-way
hash of the password, then compare the hashes, which will always be of the same length.
MemberOf Relationships
This MemberOf relationships table shows additional CWE Catgeories and Views that reference this
weakness as a member. This information is often useful in understanding where a weakness fits
within the context of external information sources.
Nature Type ID Name Page
MemberOf 968 SFP Secondary Cluster: Covert Channel 888 2404
MemberOf 1415 Comprehensive Categorization: Resource Control 1400 2544
CWE Version 4.14
CWE-386: Symbolic Name not Mapping to Correct Object
CWE-386: Symbolic Name not Mapping to Correct Object