Executing OS commands using an SQL injection
One of the most severe impacts of SQL injection attacks is the command execution at the OS level. Most of the time, if the user executes system commands, this results in the whole server and the application being compromised.
The vulnerability
The command injection vulnerabilities into SQL injections usually occur because the DBMS has a stored procedure or an allowed native option, which interacts directly with the OS. For example, xp_cmdshell
on SQL Server, or a specially stored procedure developed in Java for Oracle.
In some cases, it is also possible that the application stores the database strings that are extracted by a query and executed; so, if we can update the database, we could inject a command into the server. However, as I mentioned, this is not a common case.
Once we have detected a vulnerability related to command injection, we can use Burp Suite to exploit it. For example, let's examine the following request from an application:
This...