CWEweakness

CWE-130 Improper Handling of Length Parameter Inconsistency

Official page ↗
Alternate terms
length manipulation, length tampering
Abstraction
Base
Structure
Simple
Status
Incomplete
Languages
C, C++, Not Language-Specific
CWE version
5.0

Description

The product parses a formatted message or structure, but it does not handle or incorrectly handles a length field that is inconsistent with the actual length of the associated data.

Extended description

If an attacker can manipulate the length parameter associated with an input such that it is inconsistent with the actual length of the input, this can be leveraged to cause the target application to behave in unexpected, and possibly, malicious ways. One of the possible motives for doing so is to pass in arbitrarily large input to the application. Another possible motivation is the modification of application state by including invalid data for subsequent properties of the application. Such weaknesses commonly lead to attacks such as buffer overflows and execution of arbitrary code.

Common consequences

• Confidentiality, Integrity: Read Memory, Modify Memory, Varies by Context

Potential mitigations

• [Implementation] When processing structured incoming data containing a size field followed by raw data, ensure that you identify and resolve any inconsistencies between the size field and the actual size of the data. • [Implementation] Do not let the user control the size of the buffer. • [Implementation] Validate that the length of the user-supplied data is consistent with the buffer size.

Detection methods

• 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.)

Observed examples

• CVE-2014-0160: Chain: "Heartbleed" bug receives an inconsistent length parameter (CWE-130) enabling an out-of-bounds read (CWE-126), returning memory that could include private cryptographic keys and other sensitive data. • CVE-2009-2299: Web application firewall consumes excessive memory when an HTTP request contains a large Content-Length value but no POST data. • CVE-2001-0825: Buffer overflow in internal string handling routine allows remote attackers to execute arbitrary commands via a length argument of zero or less, which disables the length check. • CVE-2001-1186: Web server allows remote attackers to cause a denial of service via an HTTP request with a content-length value that is larger than the size of the request, which prevents server from timing out the connection. • CVE-2001-0191: Service does not properly check the specified length of a cookie, which allows remote attackers to execute arbitrary commands via a buffer overflow, or brute force authentication by using a short cookie length. • CVE-2003-0429: Traffic analyzer allows remote attackers to cause a denial of service and possibly execute arbitrary code via invalid IPv4 or IPv6 prefix lengths, possibly triggering a buffer overflow. • CVE-2000-0655: Chat client allows remote attackers to cause a denial of service or execute arbitrary commands via a JPEG image containing a comment with an illegal field length of 1. • CVE-2004-0492: Server allows remote attackers to cause a denial of service and possibly execute arbitrary code via a negative Content-Length HTTP header field causing a heap-based buffer overflow. • CVE-2004-0201: Help program allows remote attackers to execute arbitrary commands via a heap-based buffer overflow caused by a .CHM file with a large length field • CVE-2003-0825: Name service does not properly validate the length of certain packets, which allows attackers to cause a denial of service and possibly execute arbitrary code. Can overlap zero-length issues • CVE-2004-0095: Policy manager allows remote attackers to cause a denial of service (memory consumption and crash) and possibly execute arbitrary code via an HTTP POST request with an invalid Content-Length value. • CVE-2004-0826: Heap-based buffer overflow in library allows remote attackers to execute arbitrary code via a modified record length field in an SSLv2 client hello message. • CVE-2004-0808: When domain logons are enabled, server allows remote attackers to cause a denial of service via a SAM_UAS_CHANGE request with a length value that is larger than the number of structures that are provided. • CVE-2002-1357: Multiple SSH2 servers and clients do not properly handle packets or data elements with incorrect length specifiers, which may allow remote attackers to cause a denial of service or possibly execute arbitrary code. • CVE-2004-0774: Server allows remote attackers to cause a denial of service (CPU and memory exhaustion) via a POST request with a Content-Length header set to -1. • CVE-2004-0989: Multiple buffer overflows in xml library that may allow remote attackers to execute arbitrary code via long URLs. • CVE-2004-0568: Application does not properly validate the length of a value that is saved in a session file, which allows remote attackers to execute arbitrary code via a malicious session file (.ht), web site, or Telnet URL contained in an e-mail message, triggering a buffer overflow. • CVE-2003-0327: Server allows remote attackers to cause a denial of service via a remote password array with an invalid length, which triggers a heap-based buffer overflow. • CVE-2003-0345: Product allows remote attackers to cause a denial of service and possibly execute arbitrary code via an SMB packet that specifies a smaller buffer length than is required. • CVE-2004-0430: Server allows remote attackers to execute arbitrary code via a LoginExt packet for a Cleartext Password User Authentication Method (UAM) request with a PathName argument that includes an AFPName type string that is longer than the associated length field. • CVE-2005-0064: PDF viewer allows remote attackers to execute arbitrary code via a PDF file with a large /Encrypt /Length keyLength value. • CVE-2004-0413: SVN client trusts the length field of SVN protocol URL strings, which allows remote attackers to cause a denial of service and possibly execute arbitrary code via an integer overflow that leads to a heap-based buffer overflow. • CVE-2004-0940: Is effectively an accidental double increment of a counter that prevents a length check conditional from exiting a loop. • CVE-2002-1235: Length field of a request not verified. • CVE-2005-3184: Buffer overflow by modifying a length value.

Related

Attack pattern · CAPEC (1)

  • CAPEC-47 Buffer Overflow via Parameter Expansion attack pattern

Observed example · CVE (25)

  • CVE-2014-0160 The (1) TLS and (2) DTLS implementations in OpenSSL 1.0.1 before 1.0.1g do not properly handle Heartbeat Extension packets, which allows… vulnerability
  • CVE-2009-2299 The Artofdefence Hyperguard Web Application Firewall (WAF) module before 2.5.5-11635, 3.0 before 3.0.3-11636, and 3.1 before 3.1.1-11637, a… vulnerability
  • CVE-2005-3184 Buffer overflow vulnerability in the unicode_to_bytes in the Service Location Protocol (srvloc) dissector (packet-srvloc.c) in Ethereal… vulnerability
  • CVE-2005-0064 Buffer overflow in the Decrypt::makeFileKey2 function in Decrypt.cc for xpdf 3.00 and earlier allows remote attackers to execute arbitrary… vulnerability
  • CVE-2004-0989 Multiple buffer overflows in libXML 2.6.12 and 2.6.13 (libxml2), and possibly other versions, may allow remote attackers to execute… vulnerability
  • CVE-2004-0940 Buffer overflow in the get_tag function in mod_include for Apache 1.3.x to 1.3.32 allows local users who can create SSI documents to… vulnerability
  • CVE-2004-0568 HyperTerminal application for Windows NT 4.0, Windows 2000, Windows XP, and Windows Server 2003 does not properly validate the length of a… vulnerability
  • CVE-2004-0808 The process_logon_packet function in the nmbd server for Samba 3.0.6 and earlier, when domain logons are enabled, allows remote attackers… vulnerability
  • CVE-2004-0826 Heap-based buffer overflow in Netscape Network Security Services (NSS) library allows remote attackers to execute arbitrary code via a… vulnerability
  • CVE-2004-0774 RealNetworks Helix Universal Server 9.0.2 for Linux and 9.0.3 for Windows allows remote attackers to cause a denial of service (CPU and… vulnerability
  • CVE-2004-0201 Heap-based buffer overflow in the HtmlHelp program (hh.exe) in HTML Help for Microsoft Windows 98, Me, NT 4.0, 2000, XP, and Server 2003… vulnerability
  • CVE-2004-0413 libsvn_ra_svn in Subversion 1.0.4 trusts the length field of (1) svn://, (2) svn+ssh://, and (3) other svn protocol URL strings, which… vulnerability
  • CVE-2004-0492 Heap-based buffer overflow in proxy_util.c for mod_proxy in Apache 1.3.25 to 1.3.31 allows remote attackers to cause a denial of service… vulnerability
  • CVE-2004-0430 Stack-based buffer overflow in AppleFileServer for Mac OS X 10.3.3 and earlier allows remote attackers to execute arbitrary code via a… vulnerability
  • CVE-2003-0825 The Windows Internet Naming Service (WINS) for Microsoft Windows Server 2003, and possibly Windows NT and Server 2000, does not properly… vulnerability
  • CVE-2004-0095 McAfee ePolicy Orchestrator agent allows remote attackers to cause a denial of service (memory consumption and crash) and possibly execute… vulnerability
  • CVE-2003-0327 Sybase Adaptive Server Enterprise (ASE) 12.5 allows remote attackers to cause a denial of service (hang) via a remote password array with… vulnerability
  • CVE-2003-0345 Buffer overflow in the SMB capability for Microsoft Windows XP, 2000, and NT allows remote attackers to cause a denial of service and… vulnerability
  • CVE-2003-0429 The OSI dissector in Ethereal 0.9.12 and earlier allows remote attackers to cause a denial of service and possibly execute arbitrary code… vulnerability
  • CVE-2002-1357 Multiple SSH2 servers and clients do not properly handle packets or data elements with incorrect length specifiers, which may allow remote… vulnerability
  • CVE-2002-1235 The kadm_ser_in function in (1) the Kerberos v4compatibility administration daemon (kadmind4) in the MIT Kerberos 5 (krb5) krb5-1.2.6 and… vulnerability
  • CVE-2001-1186 Microsoft IIS 5.0 allows remote attackers to cause a denial of service via an HTTP request with a content-length value that is larger than… vulnerability
  • CVE-2001-0825 Buffer overflow in internal string handling routines of xinetd before 2.1.8.8 allows remote attackers to execute arbitrary commands via a… vulnerability
  • CVE-2001-0191 gnuserv before 3.12, as shipped with XEmacs, does not properly check the specified length of an X Windows MIT-MAGIC-COOKIE cookie, which… vulnerability
  • CVE-2000-0655 Netscape Communicator 4.73 and earlier allows remote attackers to cause a denial of service or execute arbitrary commands via a JPEG image… vulnerability

Can precede · CWE (1)

  • CWE-805 Buffer Access with Incorrect Length Value weakness

Child of · CWE (2)

  • CWE-119 Improper Restriction of Operations within the Bounds of a Memory Buffer weakness
  • CWE-240 Improper Handling of Inconsistent Structural Elements weakness

Referenced by CAPEC · weakness (1)

  • CAPEC-47 Buffer Overflow via Parameter Expansion attack pattern

Referenced by CVE · weakness (138)

  • CVE-2026-115794 P-Net before 1.0.3 passes the application alarm callback a data length derived from the variable part length field of a received RTA alarm… vulnerability
  • CVE-2026-116531 HTTP::Body versions before 1.23_01 for Perl lose track of chunk boundaries in chunked request bodies when a read ends inside a chunk. vulnerability
  • CVE-2026-114597 In EPICS Base release 7.0.10 and prior, an insufficient validation of element or length values in a network message can cause the… vulnerability
  • CVE-2026-116013 OpenResty lua-resty-dns before 0.24 contains an improper input validation vulnerability in parse_section() and _decode_name() that fails to… vulnerability
  • CVE-2026-114646 A data-validation flaw exists in the BSON handling and binary serialization path of the MongoDB C# Driver. vulnerability
  • CVE-2026-105960 PEAK-System PCAN contains a vulnerable operation involving a variable-length receive-record copy. vulnerability
  • CVE-2026-110912 In DragonFly BSD through 6.4.2 before 4bb22ff, the ARP input handlers arpintr() and in_arpinput() (sys/netinet/if_ether.c) do not validate… vulnerability
  • CVE-2026-101942 An Improper Handling of Length Parameter Inconsistency vulnerability in the routing protocol daemon (rpd) process of Juniper Networks Junos… vulnerability
  • CVE-2026-101962 An Improper Handling of Length Parameter Inconsistency vulnerability in the routing protocol daemon (rpd) of Juniper Networks Junos OS and… vulnerability
  • CVE-2026-101991 An Improper Handling of Length Parameter Inconsistency vulnerability in the routing protocol daemon (rpd) of Juniper Networks Junos OS and… vulnerability
  • CVE-2026-101994 An Improper Handling of Length Parameter Inconsistency vulnerability in the l2ald daemon of Juniper Networks Junos OS and Junos OS Evolved… vulnerability
  • CVE-2026-102054 An Improper Handling of Length Parameter Inconsistency vulnerability in L2ALM of Juniper Networks Junos OS and Junos OS Evolved allows an… vulnerability
  • CVE-2026-92159 F´ (F Prime) is a framework that enables development and deployment of spaceflight and other embedded software applications. vulnerability
  • CVE-2026-109390 AnyDesk before 8.0.3 allows unauthenticated remote attackers to execute arbitrary code via a heap-based buffer overflow, as demonstrated on… vulnerability
  • CVE-2026-90921 IBM Maximo AI Service 9.1.0, and 9.2.0 could allow a remote attacker to cause a denial of service due to improper handling of malformed… vulnerability
  • CVE-2026-83745 Memory allocation with excessive size value, Improper handling of length parameter inconsistency vulnerability in Apache Thrift nodejs and… vulnerability
  • CVE-2026-85494 Improper handling of length parameter inconsistency, Uncaught exception, Inefficient Algorithmic Complexity, Memory allocation with… vulnerability
  • CVE-2026-94633 Memory allocation with excessive size value, Improper handling of length parameter inconsistency vulnerability in Apache Thrift Dart… vulnerability
  • CVE-2026-94635 Allocation of resources without limits or throttling, Improper handling of length parameter inconsistency vulnerability in Apache Thrift… vulnerability
  • CVE-2026-18397 This vulnerability enables unauthenticated remote code execution (RCE) on a victim's machine by exploiting a combination of cryptographic… vulnerability
  • CVE-2026-87022 Improper handling of length parameter inconsistency vulnerability in Apache Tomcat allows WebSocket message smuggling when… vulnerability
  • CVE-2026-77619 Vector is a high-performance observability data pipeline. vulnerability
  • CVE-2023-5778 Improper handling of length parameter inconsistency vulnerability in ABB Freelance Controller DCP, ABB Freelance Controller AC700, ABB… vulnerability
  • CVE-2026-73455 On affected platforms running Arista EOS with Open Shortest Path First version 3 (OSPFv3) configured, a specially crafted packet can cause… vulnerability
  • CVE-2026-90678 An issue was discovered in HAProxy 3.3.0 through 3.4.4 and in 3.5-dev1 through 3.5-dev5. vulnerability
  • CVE-2026-15418 In the silabser.sys driver for CP210x devices v11.5.0 and earlier, a local unprivileged user with a malicious device can use malformed… vulnerability
  • CVE-2026-71337 Stack-based buffer overflow in Windows Storage Management Provider allows an authorized attacker to elevate privileges locally. vulnerability
  • CVE-2026-5706 In Bluetooth Mesh SDK 6.1.4 and earlier, malformed extended advertisements can trigger out-of-bounds writes leading to stack corruption and… vulnerability
  • CVE-2026-71402 An out-of-bounds read was found in the DHCPv4 packet capture code of wicked. vulnerability
  • CVE-2026-81575 If configured as a server, CodeMeter Runtime before versions 8.41a and 9.10 accepts requests with opcode 0x5e, which contain the data… vulnerability
Show all 138 ›