Last active
October 25, 2025 10:46
-
-
Save oralunal/62de9150d2de24443b9538366b4c8b86 to your computer and use it in GitHub Desktop.
Fail2Ban filter for suspicious accesses
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Fail2Ban filter for suspicious accesses | |
| # Detects access to common backdoor/shell PHP and environment files, detects bots | |
| # Author: @oralunal | |
| [Definition] | |
| # Suspicious PHP files (backdoors, shells, short names) | |
| failregex = ^<HOST> .* ".*" .* .* ".*" "((.*(cc\_bot|Python|Scrapy|aiohttp|Photon|fasthttp|GNSSInternetRadio|CensysInspect|Palo Alto Networks|onlyscans\.com\/about|Go\-http\-client|xfa1|HTTP Banner Detection|bang2012\@tutanota\.de|libredtail\-http|python\-requests|python-urllib|zgrab|l9tcpid|wpbot|curl|wget|Wget|Nuclei|masscan|nmap|scanner|nikto|sqlmap|wpscan|dirbuster|gobuster|python\-httpx|\\x22).*)|\-|Mozilla\/5\.0|Mozilla)"$ | |
| ^<HOST> .* ".*(botavcisi|b374k|wso|c99|r57|nc4|shell|webshell|chosen|alfa|up|fm|pass|core|bolt|adminfuns|xmrlpc|xmlrpc|unixlogin|phpinfo|change\_config|wpdiscuz\-ajax|eval\-stdin)\.php(.*)" (301|302|400|403|404|405|500) .+ ".+" ".+"$ | |
| ^<HOST> .* ".*xmlrpc\.php(.*)" (200) .+ ".+" ".+"$ | |
| ^<HOST> .* ".*(site\/phpinfo\.php\.save|site\/info\.php\.save|wlwmanifest\.xml|\.env|\.git|JMXInvokerServlet|cgiServer\.exx|pandora_console).*" (403|404) .+ ".+" ".+"$ | |
| ignoreregex = |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fail2Ban Suspicious Filter
A Fail2Ban filter designed to protect your web servers against suspicious PHP file access attempts and common attack patterns.
(Türkçe: Fail2Ban’da Hazırladığım Tarama Botlarını Engelleyen Filtre - ingilizcesini ai hazırladı)
What Does It Do?
This filter automatically detects and bans IP addresses attempting to access malicious bots, scanners, backdoors, and webshells targeting your web server.
Detected Threats
1. Suspicious User-Agents
Detects known bot and scanner tools:
2. Common PHP Backdoor/Webshell Files
Catches the most widely used webshell names:
wso.php,c99.php,r57.php- Classic webshellsb374k.php,alfa.php- Popular backdoor toolsshell.php,webshell.php- Generic shell fileseval-stdin.php- Code execution files3. WordPress Vulnerabilities
Blocks WordPress-targeted attacks:
xmlrpc.php- Used in DDoS and brute-force attackswpdiscuz-ajax.php- Known plugin vulnerabilities4. Sensitive File Access
Catches attempts to access system and configuration files:
.env- Environment variables and passwords.git- Source code repositorywlwmanifest.xml- Windows Live Writer manifestJMXInvokerServlet- Java exploit attemptsInstallation
/etc/fail2ban/jail.d/suspicious.conf):Testing
Test if the filter is working correctly:
Recommendations
maxretryvalue according to your needs (default: 3)bantimevalue for longer ban periodsWarnings
Author: @oralunal
License: MIT
Contributions are welcome! 🛡️