Skip to content

Command-Line Argument or Environment Variable Access

Description

The program accesses command-line arguments or environment variables, which are controlled by potential attackers. This could lead to security vulnerabilities if the input is not properly sanitized.

Examples

Insecure Code

c
int main(int argc, char *argv[]) { system(argv[1]); }

Secure Code

c
int main(int argc, char *argv[]) { if (argc > 1) { /* validate and sanitize argv[1] */ } }

Remediation

Validate and sanitize command-line arguments and environment variables before using them.

Rule Details

FieldValue
IDCODE-0185
CategoryInjection
SeverityMEDIUM
CWECWE-78
ConfidenceMEDIUM
ImpactMEDIUM
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagscommand-line, environment-variables
OWASPN/A

References