Command Injection
Pentesting-Web
Command injection is a security vulnerability that allows an attacker to execute arbitrary commands inside a vulnerable application.
Tools
Exploits
Basic commands
Execute the command and voila :p
Chaining commands
Inside a command
Filter Bypasses
Bypass without space
Works on Linux only.
Commands execution without spaces, $ or - Linux (Bash only)
Works on Windows only.
Bypass with a line return
Bypass characters filter via hex encoding
Linux
Bypass characters filter
Commands execution without backslash and slash - linux bash
Bypass Blacklisted words
Bypass with single quote
Bypass with double quote
Bypass with backslash and slash
Bypass with $@
Bypass with variable expansion
Bypass with wildcards
Challenge
Challenge based on the previous tricks, what does the following command do:
Time based data exfiltration
Extracting data : char by char
DNS based data exfiltration
Based on the tool from https://github.com/HoLyVieR/dnsbin
also hosted at dnsbin.zhack.ca
Online tools to check for DNS based data exfiltration:
- dnsbin.zhack.ca
- pingb.in