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
Scope
Effect
Integrity
Confidentiality
Availability
Access Control
Technical Impact: Execute unauthorized code or
commands; Gain privileges / assume
identity
There is the potential for arbitrary code execution with privileges of
the vulnerable program if function parameter list is exhausted.
Availability
Technical Impact: DoS: crash / exit /
restart
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.
GET 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.
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.