What it is: Function Call with Incorrectly Specified Arguments (CWE-628) is a type of vulnerability that occurs when a function or routine is called with incorrectly specified arguments.
Why it matters: This weakness can lead to unintended behavior and resultant security issues, such as allowing attackers to gain access to system resources.
How to fix it: Use code inspection tools and validate function calls during the build phase to ensure correct argument specification.
TL;DR: Function Call with Incorrectly Specified Arguments (CWE-628) is a type of vulnerability that occurs when a function or routine is called with incorrectly specified arguments, leading to unintended behavior. Use code inspection tools and validate function calls during the build phase to ensure correct argument specification.
| Field | Value |
|---|---|
| CWE ID | CWE-628 |
| OWASP Category | A06:2025 - Insecure Design |
| CAPEC | None known |
| Typical Severity | Medium |
| Affected Technologies | any programming language |
| Detection Difficulty | Moderate |
| Last Updated | 2026-07-29 |
What is Function Call with Incorrectly Specified Arguments?
Function Call with Incorrectly Specified Arguments (CWE-628) is a type of vulnerability that occurs when a function or routine is called with incorrectly specified arguments. As defined by the MITRE Corporation under CWE-628, and classified by the OWASP Foundation under A06:2025-Insecure Design, this weakness can lead to unintended behavior and resultant security issues.
Quick Summary
Function Call with Incorrectly Specified Arguments is a critical issue that can cause quality degradation and allow attackers to gain unintended access to system resources. It matters because incorrect function arguments can lead to severe consequences such as unauthorized access or data corruption. Jump to: Overview · How it Works · Business Impact · Attack Scenario · Detection · Fixing · Framework Fixes · Ask AI · Best Practices · FAQ · Related Vulnerabilities
Jump to: Quick Summary · Function Call with Incorrectly Specified Arguments Overview · How Function Call with Incorrectly Specified Arguments Works · Business Impact of Function Call with Incorrectly Specified Arguments · Function Call with Incorrectly Specified Arguments Attack Scenario · How to Detect Function Call with Incorrectly Specified Arguments · How to Fix Function Call with Incorrectly Specified Arguments · Framework-Specific Fixes for Function Call with Incorrectly Specified Arguments · How to Ask AI to Check Your Code for Function Call with Incorrectly Specified Arguments · Function Call with Incorrectly Specified Arguments Best Practices Checklist · Function Call with Incorrectly Specified Arguments FAQ · Vulnerabilities Related to Function Call with Incorrectly Specified Arguments · References · Scan Your Own Site
Function Call with Incorrectly Specified Arguments Overview
What: Function Call with Incorrectly Specified Arguments is a vulnerability where functions are called with incorrect arguments, leading to unintended behavior.
Why it matters: This weakness can cause quality degradation and allow attackers to gain unintended access to system resources. It affects applications that rely on stable API specifications and impacts developers who do not validate function calls properly.
Where it occurs: In any programming language or environment where functions are called with incorrect arguments.
Who is affected: Developers, security teams, and users of applications that do not follow correct argument specification practices.
Who is NOT affected: Systems already using robust code inspection tools to enforce correct argument usage during the build phase.
How Function Call with Incorrectly Specified Arguments Works
Root Cause
The root cause is calling a function or routine with incorrectly specified arguments, leading to unintended behavior and resultant weaknesses.
Attack Flow
- An attacker identifies a function call that uses incorrect arguments.
- The attacker exploits this by manipulating the input to trigger unexpected behavior.
- This leads to additional vulnerabilities such as unauthorized access or data corruption.
Prerequisites to Exploit
- Incorrectly specified arguments in function calls.
- Lack of validation for argument correctness during runtime.
Vulnerable Code
def process_data(data):
# Incorrectly specified arguments leading to unintended behavior
result = some_function(data, "invalid_argument")
This code demonstrates a function call with incorrect arguments that can lead to unexpected behavior and resultant weaknesses.
Secure Code
def process_data(data):
# Correct argument specification ensuring intended behavior
result = some_function(data, correct_argument)
The secure version ensures that the function is called with correctly specified arguments, preventing unintended behavior.
Business Impact of Function Call with Incorrectly Specified Arguments
Confidentiality: Data exposure due to incorrect function calls leading to unauthorized access.
- Example: An attacker exploits a misconfigured function call to gain access to sensitive data.
Integrity: Modification of system resources due to incorrect function calls.
- Example: An attacker manipulates input to cause unintended changes in system state or configuration.
Availability: Disruption of services due to incorrect function calls leading to crashes or errors.
- Example: Incorrect arguments can lead to application crashes, impacting service availability.
Business Consequences:
- Financial loss from data breaches and downtime.
- Compliance penalties for security incidents.
- Damage to reputation from publicized vulnerabilities.
Function Call with Incorrectly Specified Arguments Attack Scenario
- An attacker identifies a function call in the application code that uses incorrect arguments.
- The attacker manipulates input to trigger unexpected behavior, leading to unauthorized access or data corruption.
- This results in additional weaknesses such as unauthorized access or data modification.
How to Detect Function Call with Incorrectly Specified Arguments
Manual Testing
- Review function calls during the build phase for incorrect arguments.
- Validate argument correctness using static analysis tools.
- Test code manually by passing invalid arguments and observing behavior.
Automated Scanners (SAST / DAST)
Static analysis can detect potential issues with incorrect arguments, while dynamic testing is required to confirm actual vulnerabilities in runtime scenarios.
PenScan Detection
PenScan’s scanner engines such as ZAP and Wapiti can identify function calls with incorrectly specified arguments during automated scans.
False Positive Guidance
False positives may occur if the pattern looks risky but is actually safe due to context a scanner cannot see. Ensure that findings are validated in the application context before taking action.
How to Fix Function Call with Incorrectly Specified Arguments
- Use code inspection tools and relevant compiler features to identify potential violations.
- Pay special attention to code that is not likely to be exercised heavily during QA.
- Make sure API specifications are stable before using them in production code.
Framework-Specific Fixes for Function Call with Incorrectly Specified Arguments
Python/Django
def process_data(data):
# Correct argument specification ensuring intended behavior
result = some_function(data, correct_argument)
Java
public void processData(String data) {
// Correct argument specification ensuring intended behavior
someFunction(data, correctArgument);
}
Node.js
function processData(data) {
// Correct argument specification ensuring intended behavior
someFunction(data, correctArgument);
}
PHP
function processData($data) {
// Correct argument specification ensuring intended behavior
some_function($data, $correct_argument);
}
How to Ask AI to Check Your Code for Function Call with Incorrectly Specified Arguments
Review the following [language] code block for potential CWE-628 Function Call with Incorrectly Specified Arguments vulnerabilities and rewrite it using correct argument specification: [paste code here]
Function Call with Incorrectly Specified Arguments Best Practices Checklist
✅ Use code inspection tools to identify potential violations during the build phase. ✅ Validate function calls according to API specifications before deployment. ✅ Ensure stable API specifications are followed in production code. ✅ Test code manually by passing invalid arguments and observing behavior.
Function Call with Incorrectly Specified Arguments FAQ
How does Function Call with Incorrectly Specified Arguments work?
It occurs when a function is called with incorrect arguments, leading to unintended behavior and resultant weaknesses.
What are the common impacts of Function Call with Incorrectly Specified Arguments?
This weakness can cause quality degradation and allow attackers to gain unintended access to system resources.
Can you provide an example of vulnerable code for Function Call with Incorrectly Specified Arguments?
A function call with incorrect arguments, such as passing a string instead of an integer, can lead to unexpected behavior.
How do I detect Function Call with Incorrectly Specified Arguments in my application?
Use static analysis tools and code inspection techniques to identify potential violations during the build phase.
What is the primary prevention technique for Function Call with Incorrectly Specified Arguments?
Ensure that API specifications are stable before using them in production code, and use code inspection tools to validate arguments.
How can I fix Function Call with Incorrectly Specified Arguments in my application?
Review function calls during the build phase and ensure all arguments are correctly specified according to the API documentation.
What are some best practices for preventing Function Call with Incorrectly Specified Arguments?
Implement strict type checking, validate input parameters, and use automated tools to enforce correct argument usage.
Vulnerabilities Related to Function Call with Incorrectly Specified Arguments
| CWE | Name | Relationship |
|---|---|---|
| CWE-573 | Improper Following of Specification by Caller (ChildOf) |
References
Scan Your Own Site
Manual code review catches what you know to look for. An automated scan catches what you didn’t. Scan your own website using PenScan to find Function Call with Incorrectly Specified Arguments and other risks before an attacker does.