Uncontrolled Resource Consumption ('Resource Exhaustion')
Weakness ID: 400 (Weakness Base)Status: Incomplete
+ Description

Description Summary

The software does not properly restrict the size or amount of resources that are requested or influenced by an actor, which can be used to consume more resources than intended.

Extended Description

Limited resources include memory, file system storage, database connection pool entries, or CPU. If an attacker can trigger the allocation of these limited resources, but the number or size of the resources is not controlled, then the attacker could cause a denial of service that consumes all available resources. This would prevent valid users from accessing the software, and it could potentially have an impact on the surrounding environment. For example, a memory exhaustion attack against an application could slow down the application as well as its host operating system.

Resource exhaustion problems have at least two common causes:

  • (1) Error conditions and other exceptional circumstances

  • (2) Confusion over which part of the program is responsible for releasing the resource

+ Time of Introduction
  • Operation
  • Architecture and Design
  • Implementation
+ Applicable Platforms



+ Common Consequences

The most common result of resource exhaustion is denial of service. The software may slow down, crash due to unhandled errors, or lock out legitimate users.


In some cases it may be possible to force the software to "fail open" in the event of resource exhaustion. The state of the software -- and possibly the security functionality - may then be compromised.

+ Likelihood of Exploit

Medium to High

+ Detection Methods

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.

Effectiveness: Limited

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 software within a short time frame.

Effectiveness: Moderate


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 software 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

+ Demonstrative Examples

Example 1

(Bad Code)
Example Language: Java 
class Worker implements Executor {
public void execute(Runnable r) {

try {
catch (InterruptedException ie) {

// postpone response
public Worker(Channel ch, int nworkers) {
protected void activate() {

Runnable loop = new Runnable() {

public void run() {

try {
for (;;) {

Runnable r = ... r.run();
catch (InterruptedException ie) {
new Thread(loop).start();

There are no limits to runnables. Potentially an attacker could cause resource problems very quickly.

Example 2

This code allocates a socket and forks each time it receives a new connection.

(Bad Code)
Example Languages: C and C++ 
sock=socket(AF_INET, SOCK_STREAM, 0);
while (1) {

newsock=accept(sock, ...);
printf("A connection has been accepted\n");
pid = fork();

The program does not track how many connections have been made, and it does not limit the number of connections. Because forking is a relatively expensive operation, an attacker would be able to cause the system to run out of CPU, processes, or memory by making a large number of connections.

+ Observed Examples
CVE-2009-2874Product allows attackers to cause a crash via a large number of connections.
CVE-2009-1928Malformed request triggers uncontrolled recursion, leading to stack exhaustion.
CVE-2009-2858Chain: memory leak (CWE-404) leads to resource exhaustion.
CVE-2009-2726Driver does not use a maximum width when invoking sscanf style functions, causing stack consumption.
CVE-2009-2540Large integer value for a length property in an object causes a large amount of memory allocation.
CVE-2009-2299Web application firewall consumes excessive memory when an HTTP request contains a large Content-Length value but no POST data.
CVE-2009-2054Product allows exhaustion of file descriptors when processing a large number of TCP packets.
CVE-2008-5180Communication product allows memory consumption with a large number of SIP requests, which cause many sessions to be created.
CVE-2008-2121TCP implementation allows attackers to consume CPU and prevent new connections using a TCP SYN flood attack.
CVE-2008-2122Port scan triggers CPU consumption with processes that attempt to read data from closed sockets.
CVE-2008-1700Product allows attackers to cause a denial of service via a large number of directives, each of which opens a separate window.
CVE-2007-4103Product allows resource exhaustion via a large number of calls that do not complete a 3-way handshake.
CVE-2006-1173Mail server does not properly handle deeply nested multipart MIME messages, leading to stack exhaustion.
CVE-2007-0897Chain: anti-virus product encounters a malformed file but returns from a function without closing a file descriptor (CWE-775) leading to file descriptor consumption (CWE-400) and failed scans.
+ 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, he 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.

+ Other Notes

Database queries that take a long time to process are good DoS targets. An attacker would have to write a few lines of Perl code to generate enough traffic to exceed the site's ability to keep up. This would effectively prevent authorized users from using the site at all. Resources can be exploited simply by ensuring that the target machine must do much more work and consume more resources in order to service a request than the attacker must do to initiate a request.

A prime example of this can be found in old switches that were vulnerable to "macof" attacks (so named for a tool developed by Dugsong). These attacks flooded a switch with random IP and MAC address combinations, therefore exhausting the switch's cache, which held the information of which port corresponded to which MAC addresses. Once this cache was exhausted, the switch would fail in an insecure way and would begin to act simply as a hub, broadcasting all traffic on all ports and allowing for basic sniffing attacks.

+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfCategoryCategory399Resource Management Errors
Development Concepts (primary)699
ChildOfWeakness ClassWeakness Class664Improper Control of a Resource Through its Lifetime
Research Concepts (primary)1000
ChildOfCategoryCategory730OWASP Top Ten 2004 Category A9 - Denial of Service
Weaknesses in OWASP Top Ten (2004) (primary)711
ParentOfCategoryCategory769File Descriptor Exhaustion
Development Concepts (primary)699
ParentOfWeakness BaseWeakness Base770Allocation of Resources Without Limits or Throttling
Development Concepts (primary)699
Research Concepts1000
ParentOfWeakness BaseWeakness Base771Missing Reference to Active Allocated Resource
Research Concepts (primary)1000
ParentOfWeakness BaseWeakness Base772Missing Release of Resource after Effective Lifetime
Research Concepts1000
ParentOfWeakness BaseWeakness Base779Logging of Excessive Data
Development Concepts (primary)699
Research Concepts (primary)1000
CanFollowWeakness BaseWeakness Base410Insufficient Resource Pool
Development Concepts699
Research Concepts1000
+ Taxonomy Mappings
Mapped Taxonomy NameNode IDFitMapped Node Name
CLASPResource exhaustion (file descriptor, disk space, sockets, ...)
OWASP Top Ten 2004A9CWE More SpecificDenial of Service
WASC10Denial of Service
WASC41XML Attribute Blowup
+ Related Attack Patterns
CAPEC-IDAttack Pattern Name
(CAPEC Version: 1.4)
2Inducing Account Lockout
82Violating Implicit Assumptions Regarding XML Content (aka XML Denial of Service (XDoS))
+ References
Joao Antunes, Nuno Ferreira Neves and Paulo Verissimo. "Detection and Prediction of Resource-Exhaustion Vulnerabilities". Proceedings of the IEEE International Symposium on Software Reliability Engineering (ISSRE). November 2008. <http://homepages.di.fc.ul.pt/~nuno/PAPERS/ISSRE08.pdf>.
D.J. Bernstein. "Resource exhaustion". <http://cr.yp.to/docs/resources.html>.
Pascal Meunier. "Resource exhaustion". Secure Programming Educational Material. 2004. <http://homes.cerias.purdue.edu/~pmeunier/secprog/sanitized/class1/6.resource%20exhaustion.ppt>.
[REF-11] M. Howard and D. LeBlanc. "Writing Secure Code". Chapter 17, "Protecting Against Denial of Service Attacks" Page 517. 2nd Edition. Microsoft. 2002.
+ Content History
Submission DateSubmitterOrganizationSource
CLASPExternally Mined
Modification DateModifierOrganizationSource
2008-07-01Eric DalciCigitalExternal
updated Time of Introduction
Suggested OWASP Top Ten 2004 mapping
2008-09-08CWE Content TeamMITREInternal
updated Common Consequences, Relationships, Other Notes, Taxonomy Mappings
2008-10-14CWE Content TeamMITREInternal
updated Description, Name, Relationships
2009-01-12CWE Content TeamMITREInternal
updated Description
2009-05-27CWE Content TeamMITREInternal
updated Name, Relationships
2009-07-27CWE Content TeamMITREInternal
updated Description, Relationships
2009-10-29CWE Content TeamMITREInternal
updated Relationships
2009-12-28CWE Content TeamMITREInternal
updated Common Consequences, Demonstrative Examples, Detection Factors, Likelihood of Exploit, Observed Examples, Other Notes, Potential Mitigations, References
Previous Entry Names
Change DatePrevious Entry Name
2008-10-14Resource Exhaustion
2009-05-27Uncontrolled Resource Consumption (aka 'Resource Exhaustion')