CWEweakness
CWE-789 Memory Allocation with Excessive Size Value
- Alternate terms
- Stack Exhaustion
- Abstraction
- Variant
- Structure
- Simple
- Status
- Draft
- Languages
- C, C++, Not Language-Specific
- CWE version
- 5.0
Description
The product allocates memory based on an untrusted, large size value, but it does not ensure that the size is within expected limits, allowing arbitrary amounts of memory to be allocated.
Common consequences
• Availability: DoS: Resource Consumption (Memory) — Not controlling memory allocation can result in a request for too much system memory, possibly leading to a crash of the application due to out-of-memory conditions, or the consumption of a large amount of memory on the system.
Potential mitigations
• [Implementation, Architecture and Design] Perform adequate input validation against any value that influences the amount of memory that is allocated. Define an appropriate strategy for handling requests that exceed the limit, and consider supporting a configuration option so that the administrator can extend the amount of memory to be used if necessary.
• [Operation] Run your program using system-provided resource limits for memory. This might still cause the program to crash or exit, but the impact to the rest of the system will be minimized.
Detection methods
• Fuzzing: Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues.
• 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.)
• Automated Dynamic Analysis: Use tools that are integrated during
compilation to insert runtime error-checking mechanisms
related to memory safety errors, such as AddressSanitizer
(ASan) for C/C++ [REF-1518].
Observed examples
• CVE-2023-2253: Query capability for API endpoint allows a large value for number of records to return, leading to allocation of a large array
• CVE-2019-19911: Chain: Python library does not limit the resources used to process images that specify a very large number of bands (CWE-1284), leading to excessive memory consumption (CWE-789) or an integer overflow (CWE-190).
• CVE-2010-3701: program uses ::alloca() for encoding messages, but large messages trigger segfault
• CVE-2008-1708: memory consumption and daemon exit by specifying a large value in a length field
• CVE-2008-0977: large value in a length field leads to memory consumption and crash when no more memory is available
• CVE-2006-3791: large key size in game program triggers crash when a resizing function cannot allocate enough memory
• CVE-2004-2589: large Content-Length HTTP header value triggers application crash in instant messaging application due to failure in memory allocation
Related
Observed example · CVE (7)
- CVE-2023-2253 A flaw was found in the `/v2/_catalog` endpoint in distribution/distribution, which accepts a parameter to control the maximum number of… vulnerability
- CVE-2019-19911 There is a DoS vulnerability in Pillow before 6.2.2 caused by FpxImagePlugin.py calling the range function on an unvalidated 32-bit integer… vulnerability
- CVE-2010-3701 lib/MessageStoreImpl.cpp in Red Hat Enterprise MRG before 1.2.2 allows remote authenticated users to cause a denial of service (stack… vulnerability
- CVE-2008-1708 IBM solidDB 06.00.1018 and earlier does not validate a certain field that specifies an amount of memory to allocate, which allows remote… vulnerability
- CVE-2008-0977 Double-Take 5.0.0.2865 and earlier, distributed under the HP StorageWorks Storage Mirroring name and other names, allows remote attackers… vulnerability
- CVE-2006-3791 The decode_stringmap function in server_transport.cpp for UFO2000 svn 1057 allows remote attackers to cause a denial of service (daemon… vulnerability
- CVE-2004-2589 Gaim before 0.82 allows remote servers to cause a denial of service (application crash) via a long HTTP Content-Length header, which causes… vulnerability
Can precede · CWE (1)
- CWE-476 NULL Pointer Dereference weakness
Child of · CWE (1)
- CWE-770 Allocation of Resources Without Limits or Throttling weakness
Referenced by CVE · weakness (323)
- CVE-2026-118589 A weakness has been identified in nschloe meshio up to 5.3.5. vulnerability
- CVE-2026-118590 A security vulnerability has been detected in nipy nibabel up to 5.4.2. vulnerability
- CVE-2026-104895 The asynchronous Smile parser (NonBlockingByteArrayParser) uses a raw-binary length prefix taken from untrusted input to allocate a byte[]… vulnerability
- CVE-2026-105613 PostgreSQL Anonymizer's range-based dummy functions dont constraint the range size. vulnerability
- CVE-2026-105614 PostgreSQL Anonymizer's `anon.image_blur()` function doesn't check the declared dimension of the provided image, allowing an attacker to… vulnerability
- CVE-2026-111108 Apache Kafka's code-generated protocol readers pre-size an array's collection from the element count declared by the sender. vulnerability
- CVE-2026-111551 Several Kafka deserialization paths read a size or count field from input data and use it directly to allocate an array, collection, or… vulnerability
- CVE-2026-114349 When a broker decodes a compressed record batch, the per-record decoder reads a declared body size from the decompressed stream and… vulnerability
- CVE-2026-118036 In Progress® Telerik® Document Processing Libraries prior to version 2026.3.1027, uncontrolled recursion, infinite loop, inefficient… vulnerability
- CVE-2026-115907 zip is a zip library for Rust that supports reading and writing simple ZIP files. vulnerability
- CVE-2026-115909 zip is a zip library for Rust that supports reading and writing simple ZIP files. vulnerability
- CVE-2026-115922 Open Neural Network Exchange (ONNX) is an open standard for machine learning interoperability. vulnerability
- CVE-2026-93849 Mattermost versions 11.9.x <= 11.9.1, 11.8.x <= 11.8.5, 11.7.x <= 11.7.10, 11.10.x <= 11.10.1 Mattermost fail to apply allocation limits to… vulnerability
- CVE-2026-115825 HTTP::Server::PSGI versions before 1.0056 for Perl allow a single request to crash the server by declaring a large Content-Length. vulnerability
- CVE-2026-116095 A vulnerability was identified in smg-project smg 1.7.0/1.8.0/1.9.0/1.10.0/1.10.1. vulnerability
- CVE-2026-114629 Web::Simple versions before 0.035 for Perl allocate a buffer sized by the Content-Length header for urlencoded body parameters. vulnerability
- CVE-2026-108359 PhpSpreadsheet is a pure PHP library for reading and writing spreadsheet files. vulnerability
- CVE-2026-115394 Ghidra through 12.2 contains an uncontrolled memory allocation vulnerability in BinaryField.read() that allows attackers to exhaust heap… vulnerability
- CVE-2026-115417 Memory allocation with excessive size value in the MQTT 3.1.1 compatibility adapter in AWS aws-c-mqtt before 0.16.2 might allow a remote… vulnerability
- CVE-2026-56387 The RTMP AMF parser in Apache bRPC accepts AMF string lengths and array counts directly from untrusted input. vulnerability
- CVE-2026-113604 Ghidra 10.2 through 12.1.4 contains a denial of service vulnerability in the ELF loader's ElfHeader class that allocates arrays sized by… vulnerability
- CVE-2026-112214 A flaw was found in the GStreamer ASF demuxer in gst-plugins-ugly. vulnerability
- CVE-2026-112283 VideoLAN libbluray through 1.5.1 contains an uncontrolled memory allocation vulnerability in _parse_extent_start_points() in clpi_parse.c… vulnerability
- CVE-2026-112399 Pillow is a Python imaging library. vulnerability
- CVE-2026-112048 libspatialite through 5.1.0 fails to validate the polygon ring count in ParseWkbPolygon, allowing attackers to trigger uncontrolled… vulnerability
- CVE-2026-102463 In Eclipse Vert.x versions [4.0.0, 4.5.34] or [5.0.0,5.0.12] or [5.1.0,5.1.9] or [5.2.0, 5.2.0], the binary array decoder in… vulnerability
- CVE-2026-102466 In Eclipse Vert.x versions [4.0.0, 4.5.34] or [5.0.0,5.0.12] or [5.1.0,5.1.9] or [5.2.0, 5.2.0], the Vert.x MySQL client… vulnerability
- CVE-2026-103223 In Eclipse Vert.x versions [4.0.0, 4.5.34] or [5.0.0,5.0.12] or [5.1.0,5.1.9] or [5.2.0, 5.2.0], the PostgreSQL message decoder reads the… vulnerability
- CVE-2026-103224 In Eclipse Vert.x versions [4.0.0, 4.5.34] or [5.0.0,5.0.12] or [5.1.0,5.1.9] or [5.2.0, 5.2.0], the MySQL message decoder aggregates… vulnerability
- CVE-2026-111279 Dragonfly through 2.0.2 contains an unbounded memory allocation vulnerability that allows unauthenticated clients to exhaust memory by… vulnerability
Referenced by CWE · can precede (2)
Referenced by CWE · peer of (1)
- CWE-1325 Improperly Controlled Sequential Memory Allocation weakness