安裝
apt install -y apache2 libapache2-mod-security2
a2enmod security2
設定 ModSecurity 設定檔 /etc/modsecurity/modsecurity.conf
cp /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf
將 SecRuleEngine 的 DetectionOnly 改成 On
編輯 /etc/apache2/sites-enabled/000-default.conf 加入
SecRuleEngine On
ModSecurity 的核心指令(如 SecRuleEngine)預設不允許在 .htaccess 內使用
相關檔案
/etc/apache2/mods-enabled/security2.conf
/etc/apache2/mods-enabled/security2.load
/var/cache/modsecurity
/etc/modsecurity/*.conf
/usr/share/modsecurity-crs/*.load
測試方式
curl -i "http://localhost/?id=1%27%20OR%201=1"
curl http://127.0.0.1/index.html?exec=/bin/bash
curl -k https://127.0.0.1/index.html?exec=/bin/bash
沒有留言:
張貼留言