Execution of OS command formed with user input detected.
- Rule ID: php_lang_exec_using_user_input
- Languages: php
- Source: exec_using_user_input.yml
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:
exec($_GET["command"]);
✅ Use user input indirectly when executing commands:
if ($_GET["action"] == "option1") {
$command = "command1";
} else {
$command = "command2";
}
exec($command);
Resources
Associated CWE
OWASP Top 10
Configuration
To skip this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --skip-rule=php_lang_exec_using_user_input
To run only this rule during a scan, use the following flag
bearer scan /path/to/your-project/ --only-rule=php_lang_exec_using_user_input
Ready to take the next step? Learn more about Bearer Cloud.