Skip to content

OS Command Injection

Description

The highlighted API is used to execute a system command. If unfiltered input is passed to this API, it can lead to arbitrary command execution.

Examples

Insecure Code

scala
val rt = Runtime.getRuntime
rt.exec(param)

Secure Code

scala
val rt = Runtime.getRuntime
rt.exec("valid_command")

Remediation

Validate and sanitize all input to system commands to prevent injection of malicious commands.

Rule Details

FieldValue
IDCODE-0042
CategoryInjection
SeverityCRITICAL
CWECWE-78
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityEASY
Tagsos command injection, command injection
OWASPN/A