mehov / debian-automation

A few scripts to automate most common Debian setups
0 stars 0 forks source link

detect, log and block vulnerability scans #74

Closed mehov closed 5 years ago

mehov commented 5 years ago
  1. use patterns to log vulnerability scans
  2. block them with fail2ban
mehov commented 5 years ago

mod_security: https://www.youtube.com/watch?v=nVrwJEWjtSY&t=6m18s

Ilyan-conf2016-slide15_when-mod-security-is-a-pain.png

poor man's waf:

most of the above advice analyzes the query string, but the payload may be in the headers (e.g. referer)

read also:

scanning:

mehov commented 5 years ago

poor man's waf

map "$request_uri $http_referer $http_cookie" $suspicious {
    default 0;
    "~127\.0\.0\.1" 1;
    "~*%27" 1;
    "~*(un)?hex\(" 1;
    "~*base64_(en|de)code\(" 1;
    "~*char\(" 1;
    "~*(union(.*))?select(.*)from" 1;
    "~*union(.*)select((.*)from)?" 1;
    "~*\\\(x(5c|22))+" 1;
}