Variant · Low-Medium

CWE-234: Failure to Handle Missing Parameter

If too few arguments are sent to a function, the function will still pop the expected number of arguments from the stack. Potentially, a variable number of arguments could be exhausted in a function a...

CWE-234 · Variant Level ·15 CVEs ·2 Mitigations

Description

If too few arguments are sent to a function, the function will still pop the expected number of arguments from the stack. Potentially, a variable number of arguments could be exhausted in a function as well.

Potential Impact

Integrity, Confidentiality, Availability, Access Control

Execute Unauthorized Code or Commands, Gain Privileges or Assume Identity

Availability

DoS: Crash, Exit, or Restart

Demonstrative Examples

The following example demonstrates the weakness.
Bad
foo_funct(one, two);
                     void foo_funct(int one, int two, int three) {printf("1) %d\n2) %d\n3) %d\n", one, two, three);}
Bad
void some_function(int foo, ...) {int a[3], i;va_list ap;va_start(ap, foo);for (i = 0; i < sizeof(a) / sizeof(int); i++) a[i] = va_arg(ap, int);va_end(ap);}
                     int main(int argc, char *argv[]) {some_function(17, 42);}
This can be exploited to disclose information with no work whatsoever. In fact, each time this function is run, it will print out the next 4 bytes on the stack after the two numbers sent to it.

Mitigations & Prevention

Build and Compilation

This issue can be simply combated with the use of proper build process.

Implementation

Forward declare all functions. This is the recommended solution. Properly forward declaration of all used functions will result in a compiler error if too few arguments are sent to a function.

Real-World CVE Examples

CVE IDDescription
CVE-2004-0276Server earlier allows remote attackers to cause a denial of service (crash) via an HTTP request with a sequence of "%" characters and a missing Host field.
CVE-2002-1488Chat client allows remote malicious IRC servers to cause a denial of service (crash) via a PART message with (1) a missing channel or (2) a channel that the user is not in.
CVE-2002-1169Proxy allows remote attackers to cause a denial of service (crash) via an HTTP request to helpout.exe with a missing HTTP version numbers.
CVE-2000-0521Web server allows disclosure of CGI source code via an HTTP request without the version number.
CVE-2001-0590Application server allows a remote attacker to read the source code to arbitrary 'jsp' files via a malformed URL request which does not end with an HTTP protocol specification.
CVE-2003-0239Chat software allows remote attackers to cause a denial of service via malformed GIF89a headers that do not contain a GCT (Global Color Table) or an LCT (Local Color Table) after an Image Descriptor.
CVE-2002-1023Server allows remote attackers to cause a denial of service (crash) via an HTTP GET request without a URI.
CVE-2002-1236CGI crashes when called without any arguments.
CVE-2003-0422CGI crashes when called without any arguments.
CVE-2002-1531Crash in HTTP request without a Content-Length field.
CVE-2002-1077Crash in HTTP request without a Content-Length field.
CVE-2002-1358Empty elements/strings in protocol test suite affect many SSH2 servers/clients.
CVE-2003-0477FTP server crashes in PORT command without an argument.
CVE-2002-0107Resultant infoleak in web server via GET requests without HTTP/1.0 version string.
CVE-2002-0596GET request with empty parameter leads to error message infoleak (path disclosure).

Taxonomy Mappings

  • PLOVER: — Missing Parameter Error
  • CLASP: — Missing parameter

Frequently Asked Questions

What is CWE-234?

CWE-234 (Failure to Handle Missing Parameter) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Variant-level weakness. If too few arguments are sent to a function, the function will still pop the expected number of arguments from the stack. Potentially, a variable number of arguments could be exhausted in a function a...

How can CWE-234 be exploited?

Attackers can exploit CWE-234 (Failure to Handle Missing Parameter) to execute unauthorized code or commands, gain privileges or assume identity. This weakness is typically introduced during the Implementation phase of software development.

How do I prevent CWE-234?

Key mitigations include: This issue can be simply combated with the use of proper build process.

What is the severity of CWE-234?

CWE-234 is classified as a Variant-level weakness (Low-Medium abstraction). It has been observed in 15 real-world CVEs.