National Cyber Warfare Foundation (NCWF)

nginx-ultimate-bad-bot-blocker for filtering malicious bots, scrapers and spam referrers at the edge


0 user ratings
2026-10-07 17:28:52
milo
Red Team (CNA)
"nginx-ultimate-bad-bot-blocker

A pure-configuration nginx defense layer that blocks roughly 7,000 bad referrers, 700 malicious user-agents and 218 fake Googlebots before traffic ever reaches an application, for defenders hardening their own servers.








Toolmitchellkrogza/nginx-ultimate-bad-bot-blocker — Nginx blocker for bad bots, user-agents, spam referrers, vulnerability scanners, malware/adware sites and fake Googlebots, with rate limiting and a Fail2Ban jail
CategoryWeb server hardening / traffic filtering (Shell-generated Nginx configuration)
Primary UseBlocking hostile user-agents, spam referrers, scanner traffic and bad IPs at the nginx edge on servers you own or administer, via include files and daily-updated blacklists
Safe UsePurely defensive: deployed by administrators on their own nginx servers and vhosts during authorized hardening, lab testing, or security baselining; it filters inbound traffic rather than attacking anything
Telemetry NoteEntirely server-side and observable in your own logs: blocked requests generate nginx access-log entries and Fail2Ban events; the update scripts pull lists from raw.githubusercontent.com, which defenders can monitor

mitchellkrogza/nginx-ultimate-bad-bot-blocker is one of the more battle-tested community projects in the web-server hardening niche, sitting at 4,790 stars and written almost entirely in Shell. Its premise is simple and appealing: rather than letting scraper bots, referrer spam, vulnerability scanners and fake Googlebots consume your application tier, you reject them at the nginx edge using a set of generated configuration includes. The current release, V4.2026.10.6182, ships with 7,116 blocked bad referrers, 700 blocked bad user-agents/bots, and 218 blocked fake Googlebots, all maintained as list files under _generator_lists/ in the repository. This is a defensive tool by construction — there is nothing here that operates against third-party systems, only configuration that hardens your own.


Architecturally the project is a collection of nginx configuration fragments plus a small toolchain of shell scripts to install and maintain them. The core artifacts land in two directories: /etc/nginx/conf.d/ receives globalblacklist.conf and botblocker-nginx-settings.conf, while /etc/nginx/bots.d/ receives the modular pieces — blockbots.conf, ddos.conf, whitelist-ips.conf, whitelist-domains.conf, blacklist-user-agents.conf, blacklist-ips.conf, bad-referrer-words.conf and custom-bad-referrers.conf. That split between a monolithic global blacklist and granular per-function includes is a pragmatic design: the generated lists stay machine-managed, while the custom-* and whitelist-* files give the operator clean insertion points for local overrides without touching files that get overwritten by updates.


Installation is handled by three scripts contributed and maintained by Stuart Cardall (@itoffoise is how the README garbles it; the handle is @itoffshore), who the README credits as an Alpine Linux package maintainer. The flow is install-ngxblocker to fetch everything, setup-ngxblocker to wire the includes into nginx.conf and your vhost files, and update-ngxblocker for ongoing list refreshes. The installer pulls its manifest from include_filelist.txt on the repository's master branch via raw.githubusercontent.com, which means you are trusting that upstream channel every time you update — worth noting for supply-chain review, since the scripts fetch configuration that nginx will parse verbatim. All three scripts accept --help/-h and can be pointed at non-standard Nginx locations from the command line.


A representative non-weaponized install on Linux looks like: sudo wget https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master/install-ngxblocker -O /usr/local/sbin/install-ngxblocker followed by sudo chmod +x /usr/local/sbin/install-ngxblocker, then running install-ngxblocker first in dry-run mode (no changes) and with -x to actually fetch the files. FreeBSD users get the cleaner path of pkg install www/nginx-ultimate-bad-bot-blocker or portmaster www/nginx-ultimate-bad-bot-blocker, which is a good signal that the project has earned distro packaging. The dry-run default is a thoughtful touch — you see exactly which files will be written before anything touches your config tree.


The setup-ngxblocker script assumes a conventional Debian-style layout where vhost files live in /etc/nginx/sites-available/ and end in .vhost, and it automatically adds the required include directives to nginx.conf and each vhost. If your deployment deviates from that convention, the README directs you to step 11 of the instructions for customizing paths. There is also a full MANUAL-CONFIGURATION.md for operators who prefer to review and place every include by hand, which is the route I would recommend for production systems with change-control requirements — the automation is convenient, but on a hardened edge server you want to diff what it changed.


Beyond static blocking, the project layers several rate-based and behavioral controls. The ddos.conf include implements the anti-DDOS and rate-limiting side using Nginx's native limiting directives, and the overall feature set extends to blocking adware, malware and ransomware-associated domains, clickjacking and click-redirecting sites, SEO company crawlers, WordPress theme detectors, and bad IP ranges. The WordPress theme-detector blocking is a niche but telling feature: reconnaissance actors fingerprint themes and plugins to select exploits, and cutting that off early degrades their targeting loop. Fake Googlebot detection similarly addresses a common cloaking technique where scanners borrow Google's user-agent to slip past naive allowlists.


A notable integration highlighted in the README's own branding is a Fail2Ban jail for repeat offenders, which closes the loop between Nginx-level rejection and host-level remediation. Blocked requests logged by nginx become input for Fail2Ban matching, escalating from a 403-style denial to temporary IP bans for persistent abuse. For defenders, this is also the telemetry story: the blocker's activity is fully visible in your own access logs and Fail2Ban databases, giving clean signals for dashboards, alerting, and long-term attribution of which scanners hammer your properties most.


The README is refreshingly honest about operational quirks. A dedicated warning section explains that daily-updated IP blacklists can transiently list well-known good ranges with value "1", which are then whitelisted at the end of globalblacklist with value "0" — producing [WARN] duplicate network messages in Nginx output. The maintainers state this is desired behavior, not a bug, and that these are warnings rather than [EMERG] errors with no effect on operation. It has behaved this way since day one, and knowing this in advance prevents an operator from misdiagnosing a healthy deployment as broken.


There is also a practical note for anyone running Let's Encrypt certificates: the preferred method is the webroot authenticator, because the http-01 challenge route has exhibited issues the maintainers could not definitively attribute to certbot or nginx. When a blocking layer sits in front of your challenge path, this class of interaction is exactly what breaks certificate renewal at 3 a.m., so reading this section before deployment will save troubleshooting time. The project is tested against nginx/1.10.x through mainstream releases, and an Apache sibling project, apache-ultimate-bad-bot-blocker, exists for shops not on Nginx.


From a fit perspective, this tool occupies the space between doing nothing at the edge and deploying a full WAF or commercial bot-management platform. It will not stop sophisticated actors who rotate user-agents or use residential proxies, since its primary matching is on user-agent strings, referrer keywords and known-bad IP ranges — trivially spoofable signals. What it does do is cheaply and reliably eliminate the enormous background noise floor of commodity scanners, referrer spam and lazy scrapers, which both reduces log clutter and removes the low-hanging reconnaissance that precedes opportunistic exploitation attempts.


For an authorized workflow, the natural placement is during baseline hardening of internet-facing nginx servers you administer: install, review the generated includes, keep update-ngxblocker on a schedule so the 7,000-plus referrer list stays current, and maintain your whitelist-ips.conf and whitelist-domains.conf for legitimate partners. The maintenance model matters here — blocklists decay quickly, and a project with a version string like V4.2026.10.6182 and dated list refreshes signals an actively curated dataset, which is the real value being delivered rather than the configuration mechanics themselves. Verify against your own logs that legitimate crawlers and uptime monitors survive the rollout.


The licensing is marked NOASSERTION in the repository metadata with a referenced LICENSE.md, so commercial adopters should read the license file directly before bundling the lists into a product. With that caveat, nginx-ultimate-bad-bot-blocker remains a solid, low-cost defensive layer for the servers you are authorized to protect: educational to read as a study in edge-filtering architecture, and immediately useful as production noise reduction.



Official project repository for mitchellkrogza/nginx-ultimate-bad-bot-blocker.

Download Tool

Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/10/nginx-ultimate-bad-bot-blocker-for.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.