Failure to Handle Missing Parameter
Weakness ID: 234 (Weakness Base)Status: Incomplete
+ Description

Description Summary

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.
+ Time of Introduction
  • Architecture and Design
  • Implementation
+ Applicable Platforms

Languages

All

+ Common Consequences
ScopeEffect
Authorization

There is the potential for arbitrary code execution with privileges of the vulnerable program if function parameter list is exhausted.

Availability

Potentially a program could fail if it needs more arguments then are available.

+ Likelihood of Exploit

High

+ Demonstrative Examples

Example 1

Example Languages: C and C++ 
foo_funct(one, two);...
void foo_funct(int one, int two, int three) {

printf("1) %d\n2) %d\n3) %d\n", one, two, three);
}
Example Languages: C and C++ 
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.

+ Observed Examples
ReferenceDescription
CVE-2004-0276
CVE-2002-1488
CVE-2002-1169
CVE-2000-0521Web server allows disclosure of CGI source code via an HTTP request without the version number.
CVE-2001-0590
CVE-2003-0239
CVE-2002-1023
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).
+ Potential Mitigations

Phase: Build and Compilation

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

Phase: 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.

+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfWeakness ClassWeakness Class233Parameter Problems
Development Concepts (primary)699
Research Concepts (primary)1000
+ Taxonomy Mappings
Mapped Taxonomy NameNode IDFitMapped Node Name
PLOVERMissing Parameter Error
CLASPMissing parameter
+ Maintenance Notes

This entry will be deprecated in a future version of CWE. The term "missing parameter" was used in both PLOVER and CLASP, with completely different meanings. However, data from both taxonomies was merged into this entry. In PLOVER, it was meant to cover malformed inputs that do not contain required parameters, such as a missing parameter in a CGI request. This entry's observed examples and classification came from PLOVER. However, the description, demonstrative example, and other information are derived from CLASP. They are related to an incorrect number of function arguments, which is already covered by CWE-685.

+ Content History
Submissions
Submission DateSubmitterOrganizationSource
PLOVERExternally Mined
Modifications
Modification DateModifierOrganizationSource
2008-07-01Eric DalciCigitalExternal
updated Time of Introduction
2008-09-08CWE Content TeamMITREInternal
updated Common Consequences, Relationships, Observed Example, Other Notes, Taxonomy Mappings
2008-11-24CWE Content TeamMITREInternal
updated Observed Examples
2009-03-09
(Critical)
CWE Content TeamMITREInternal
added maintenance note: this entry will probably be deprecated
2009-03-10CWE Content TeamMITREInternal
updated Maintenance Notes, Other Notes, Potential Mitigations
Previous Entry Names
Change DatePrevious Entry Name
2008-04-11Missing Parameter Error