Search anything:

OS Command Injection Attack

Learn Algorithms and become a National Programmer
Indian Technical Authorship Contest starts on 1st July 2023. Stay tuned.

Reading time: 10 minutes

os command injection attack

OS Command Injection is a form of shell injection attack, mostly used for execution of unauthorized OS commands in the operating system (OS) to target the system (usually a web server) and degrade its performance. In this attack, the hacker aims to find and exploit some of the vulnerable applications to gain the unauthorized access on the host operating system. In the particular attack, the hacker can alter or corrupt a database or even steal the customer records and launch a Distributed Denial of Service (DDoS) attack in some of the cases.

Procedure For The Attack

  1. In the attack, the hacker first tries to find some critical loopholes in the targeted web application.
  2. Then using that vulnerability, the hacker inserts the malicious code into the OS of the host server and tries to gain any functionality which the primary application offers.
  3. The hacker further injects the unwanted system level command via user-supplied data such as forms or cookies through the vulnerable application to retrieve the information of a web server or to make unauthorized access into the server.

Mitigation For The Attack

Never call out to OS commands from application-layer code and also use the strong server-side validation for all user inputs. Implement an white list for all the accepted commands to avoid the attack. Also, Disable the access of the application which is compromised.


Question 1

Which attack can also be done through this attack in some cases?

Shell Injection

Question 2

Malvertising uses which technique in its attack?

Shell Injection