OS command injection is a bug class where an application passes untrusted input to the operating system as part of a shell command. If user-controlled text is not strictly validated, escaped, or replaced with safe APIs, an attacker can append extra commands, change arguments, or trigger unintended actions on the host. This is especially dangerous because the code runs with the privileges of the vulnerable service, which may include access to files, credentials, or management functions.
In real attacks, command injection often appears in web forms, API parameters, device administration panels, and automation tools that call system utilities. A successful exploit can lead to remote code execution, persistence, data theft, or lateral movement. Defenders reduce the risk by avoiding shell invocation where possible, using allowlists for expected input, separating data from commands, running services with minimal privileges, and reviewing logs for unusual process launches or command-line arguments. In security appliances, the impact can be high because the vulnerable system may sit on a trusted control path.


