===== Protection anti-robots par reaction =====
Nous utilisons [[https://blog.ppom.me/fr-reaction/|reaction]], une alternative efficiente à fail2ban, pour bannir temporairement les adresses à l'origine d'un comportement abusif.
On considère comme abusif, notamment : les requêtes envoyées à nos systèmes à un rythme trop élevé, les activités de reconnaissance de nos systèmes, les tentatives d'exploitation de vulnérabilités réelles ou supposées de nos systèmes, les requêtes malformées....
==== Filtres pour nginx ====
filters: {
// ...
bruteForce: {
regex: [
// POST request leading to response "403 Forbidden",
// such as a failed login attempt.
@'^ - [^\[]+\[[^\]]+\] "POST [^"]*" 403',
// Response "429 Too Many Requests"
@'^ - [^\[]+\[[^\]]+\] "[^"]*" 429',
],
// ...
},
},
[
// Response "400 Bad request" or "405 Method Not Allowed"
// if query type not GET nor POST nor PRI
@'^.*"[^PG][^"]*" 40[05]',
@'^.*"[^"][^OER][^"]*" 40[05]',
@'^.*"[^"]{2}[^STI][^"]*" 40[05]',
// (?:[^/" ]*/)* is a "non-capturing group" regex that allow for subpath(s)
// example: /code/.env should be matched as well as /.env
// ^^^^^
@'^.*"GET /(?:[^/" ]*/)*\.aws/',
@'^.*"GET /(?:[^/" ]*/)*\.env ',
@'^.*"GET /(?:[^/" ]*/)*\.git/config ',
@'^.*"GET /(?:[^/" ]*/)*auth.html ',
@'^.*"GET /(?:[^/" ]*/)*auth1.html ',
@'^.*"GET /(?:[^/" ]*/)*password.txt ',
@'^.*"GET /(?:[^/" ]*/)*passwords.txt ',
@'^.*"GET /(?:[^/" ]*/)*dns-query ',
@'^.*"GET /(?:[^/" ]*/)*info\.php[^"]*" 4[0-9][0-9]',
@'^.*"GET /(?:[^/" ]*/)*phpinfo\.php[^"]*" 4[0-9][0-9]',
@'^.*"GET /(?:[^/" ]*/)*wp-content/[^"]*\.php[^"]*" 4[0-9][0-9]',
@'^.*"GET /(?:[^/" ]*/)*wp-login\.php[^"]*" 4[0-9][0-9]',
@'^.*"GET /(?:[^/" ]*/)*wp-includes[^"]*" 4[0-9][0-9]',
@'^.*"GET /(?:[^/" ]*/)*xmlrpc\.php[^"]*" 4[0-9][0-9]',
@'^.*"GET /(?:[^/" ]*/)*config\.json [^"]*" 4[0-9][0-9]',
// Likely scanning or recon
@'^.*"GET /[^" ]*(~|\.swp)[^"]*" 4[0-9][0-9]', // Temporary files, backups
@'^.*"GET /\+CSCO[ELU]\+/[^"]*" 4[0-9][0-9]', // Cisco Adaptive Security Appliances (ASA)
@'^.*"GET /(?:[^/" ]*/)*\.DS_Store [^"]*" 4[0-9][0-9]', // macOS
@'^.*"GET /(?:[^/" ]*/)*api/v2/hoverfly/version [^"]*" 4[0-9][0-9]', // Hoverfly
@'^.*"GET /(?:[^/" ]*/)*ecp/Current/exporttool/microsoft.exchange.ediscovery.exporttool.application[^"]*" 4[0-9][0-9]', // Microsoft Exchange eDiscovery
@'^.*"GET /cgi/common.cgi[^"]*" 4[0-9][0-9]', // D-Link IP camera
@'^.*"GET /json/login_session[ ?][^"]*" 4[0-9][0-9]', // HP iLO remote console
@'^.*"GET /manager/html[ ?][^"]*" 4[0-9][0-9]', // Apache Tomcat
@'^.*"GET /owa/auth/logon.aspx[ ?][^"]*" 4[0-9][0-9]', // Microsoft Exchange
@'^.*"GET /photo/webapi/query\.[^"]*" 4[0-9][0-9]', // Synology PhotoStation API
@'^.*"GET /stssys.htm[^"]*" 4[0-9][0-9]', // TRENDnet IP camera
@'^.*"GET /server-info[ ?][^"]*" 4[0-9][0-9]', // Apache mod_info
// Likely exploit attempts
@'^.*"(GET|POST) (?:[^/" ]*/)*(myadmin|MyAdmin|phpmyadmin|phpMyAdmin|pma)[^/]*/scripts/setup.php[^"]*" 4[0-9][0-9]', // CVE-2009-1151
@'^.*"(GET|POST) [^" ]*(\.|%2e|%2E){2}(/|%2f|%2F|%5c|%5C)[^"]*" 4[0-9][0-9]', // CWE-22, https://owasp.org/www-community/attacks/Path_Traversal
@'^.*"(GET|POST) /cgi-bin/php([0-9]|)([.-]cgi|)[ ?][^"]*" 4[0-9][0-9]', // CA-96.11 https://www.php.net/manual/fr/security.cgi-bin.attacks.php
@'^.*"(GET|POST) /cgi-bin/(nobody|user)/(Config.cgi|Machine.cgi|Search.cgi)[^"]*"',// CVE-2013-4981, CVE-2025-34054, CVE-2025-57198 (Avtech device)
@'^.*"(GET|POST) /HNAP1/ [^"]*" 4[0-9][0-9]', // CVE-2025-2360
@'^.*"(GET|POST) /index.action[ ?][^"]*" 4[0-9][0-9]', // CVE-2017-5638, CVE-2020-17530
@'^.*"GET (?:[^/" ]*/)*phpunit/(?:[^/" ]*/)*Util/PHP/eval-stdin.php', // CVE-2017-9841
@'^.*"GET (?:[^/" ]*/)*autodiscover\.json[^"]*@[^"]*[Pp]ower[Ss]hell', // CVE-2022-41082
@'^.*"GET (?:[^/" ]*/)*@fs/[^" ]*?[^" ]*raw', // CVE-2025-30208
@'^.*"(GET|POST) /(hnd|tm)Unblock.cgi[ ?][^"]*" 4[0-9][0-9]', // CVE-2025-34037
@'^.*"POST /(?:[^/" ]*/)*batch/v1[^"]*" 4[0-9][0-9]', // CVE-2026-63030
// Unusual QUERY type (WebDav, ...) with an error response
@'^ - [^\[]+\[[^\]]+\] "PROPFIND [^"]*" 40[0345]',
@'^ - [^\[]+\[[^\]]+\] "PROPPATCH [^"]*" 40[0345]',
@'^ - [^\[]+\[[^\]]+\] "PUT [^"]*" 40[0345]',
]