Weakness · High

CWE-400: Uncontrolled Resource Consumption

What it is

The product does not properly control the allocation and maintenance of a limited resource.

Likelihood of exploit: High5 exploited in the wildMITRE CWE 4.19.1

Severity (our rating)
High
Likelihood of exploit
High
Introduced during
Architecture and Design, Implementation, Operation, System Configuration
Exploited in the wild
5 known exploited CVEs

What an attacker can do

  • DoS: Crash, Exit, or Restart (Availability)
  • DoS: Resource Consumption (CPU) (Availability)
  • DoS: Resource Consumption (Memory) (Availability)
  • DoS: Resource Consumption (Other) (Availability)
  • Bypass Protection Mechanism (Access Control, Other)
  • Other (Access Control, Other)

How to prevent it

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.
  • 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.
  • Ensure that protocols have specific limits of scale placed on them.

Implementation

  • Ensure that all failures in resource allocation place the system into a safe posture.

How to find it

  • Automated Static Analysis. Automated static analysis typically has limited utility in recognizing resource exhaustion problems, except for program-independent system resources such as files, sockets, and processes. For system resources, automated static analysis may be able to detect circumstances in which resources are not released after they have expired. Automated analysis of configuration files may be able to detect settings that do not specify a maximum value. Automated static analysis tools will not be appropriate for detecting exhaustion of custom resources, such as an intended security policy in which a bulletin board user is only allowed to make a limited number of posts per day.
  • Automated Dynamic Analysis. 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.
  • 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.

CWE-400 on MITRE's CWE site

Exploited in the wild: 5 CVEs

Vulnerabilities caused by CWE-400 that attackers have used, from CISA's Known Exploited Vulnerabilities catalog, newest first.

All known exploited vulnerabilities

H2 Security

Found it in your code?

We review where it appears, fix it with your team, and check it was not already used against you.

Talk to our team

T Academy

Stop writing it in the first place

Learn to build software and systems without weaknesses like this one, with practice on real hosts in your browser, every objective checked on the machine.

Start free

Source: MITRE Common Weakness Enumeration, CWE version 4.19.1. CWE is a trademark of The MITRE Corporation.