966
Certain automated dynamic analysis techniques may be effective in spotting resource exhaustion
problems, especially with resources such as processes, memory, and connections. The
technique may involve generating a large number of requests to the product within a short time
frame.
Effectiveness = Moderate
Fuzzing
While fuzzing is typically geared toward finding low-level implementation bugs, it can
inadvertently find resource exhaustion problems. This can occur when the fuzzer generates a
large number of test cases but does not restart the targeted product in between test cases. If an
individual test case produces a crash, but it does not do so reliably, then an inability to handle
resource exhaustion may be the cause.
Effectiveness = Opportunistic
Potential Mitigations
Phase: Architecture and Design
Design throttling mechanisms into the system architecture. The best protection is to limit
the amount of resources that an unauthorized user can cause to be expended. A strong
authentication and access control model will help prevent such attacks from occurring in the
first place. The login application should be protected against DoS attacks as much as possible.
Limiting the database access, perhaps by caching result sets, can help minimize the resources
expended. To further limit the potential for a DoS attack, consider tracking the rate of requests
received from users and blocking requests that exceed a defined rate threshold.
Phase: Architecture and Design
Mitigation of resource exhaustion attacks requires that the target system either: recognizes
the attack and denies that user further access for a given amount of time, or uniformly throttles
all requests in order to make it more difficult to consume resources more quickly than they
can again be freed. The first of these solutions is an issue in itself though, since it may allow
attackers to prevent the use of the system by a particular valid user. If the attacker impersonates
the valid user, they may be able to prevent the user from accessing the server in question. The
second solution is simply difficult to effectively institute -- and even when properly done, it does
not provide a full solution. It simply makes the attack require more resources on the part of the
attacker.
Phase: Architecture and Design
Ensure that protocols have specific limits of scale placed on them.
Phase: Implementation
Ensure that all failures in resource allocation place the system into a safe posture.
Demonstrative Examples
Example 1:
The following example demonstrates the weakness.
Example Language: Java (Bad)
class Worker implements Executor {
...
public void execute(Runnable r) {
try {
...
}
catch (InterruptedException ie) {
// postpone response
Thread.currentThread().interrupt();
}
CWE Version 4.14
CWE-400: Uncontrolled Resource Consumption
CWE-400: Uncontrolled Resource Consumption