Execution of OS command formed with user input detected.

Description

Applications should not execute OS commands that are formed from user input. This rule checks for external commands containing user-supplied data.

Remediations

❌ Avoid using user input when executing commands:

system(params[:command])

✅ Use user input indirectly when executing commands:

command =
case params[:action]
when "option1"
"command1"
when "option2"
"command2"
end

system(command)

Resources

Associated CWE

OWASP Top 10