sandywp / plugins / wp-fail2ban
WP fail2ban – Advanced Security
WP fail2ban uses fail2ban to protect your WordPress site.
Ready in seconds.
v5.5.1 60,000+ installs WP 5.3+ PHP 7.4+

About this plugin
Got a firewall? Use it.
WP fail2ban gives fail2ban the information it needs to block attackers at the firewall. fail2ban is a server-side service that bans abusive IP addresses; WP fail2ban tells it about brute-force attacks, user enumeration, comment abuse, spam, and more.
Once an address is banned, the firewall stops its requests before they reach your site.
Free protection from the usual suspects
The Free edition covers the attacks WordPress sites see every day:
- Brute-force attacks — failed logins and attempts using unknown or blocked usernames give
fail2banthe information it needs to act. - User enumeration — blocks common ways bots discover valid usernames before trying to log in.
- Comment abuse and spam — catches suspicious comment attempts and can act on comments marked as spam.
- Pingbacks and trackbacks — turns abusive or failed requests into useful signals for
fail2ban. - Blocklist — the free Blocklist can stop known hostile IP addresses before they attack your site.
Need more protection? See what Premium adds →
How WP fail2ban works
WP fail2ban records security events in a form fail2ban can recognise. fail2ban watches those events and applies the rules you configure on the server. When an address crosses a threshold, it can be banned by the host firewall, so later requests are stopped before they reach WordPress.
WP fail2ban ships with filters that work well for typical sites, so most installations can start with them as they are.
The events themselves are deliberately written for humans as well as fail2ban: they tell you who is doing what, to what, and why it matters. That makes the logs useful to read directly, and makes it much easier to adapt the supplied filters or write your own if your setup needs something unusual.
WP fail2ban also handles exiting keep-alive connections. When abusive activity should result in a ban, it closes the connection so the client cannot simply keep sending requests over a connection that was opened before the firewall rule was added.
The Blocklist works a little differently: it can give the firewall hostile addresses learned from other participating sites, so your site does not have to see the attack first.
Installation and server setup →
Premium protection from the unusual suspects
Premium goes beyond fail2ban.
-
Block bots before they attack — the full Blocklist uses attacks seen across participating sites to give your firewall hostile IP addresses your site has not encountered yet. The free Blocklist helps build that network; Premium gets the full current intelligence available for your site.
-
Block the injection, not the signature — WP fail2ban’s Web Application Firewall (WAF) checks the SQL WordPress is actually about to run. There are no attack signatures: whether it is a zero-day or a well-known exploit, the WAF blocks the injection itself.
-
Investigate after they attack — Premium keeps a structured history of security events, so you can follow activity by IP address, country, username, event type and more instead of relying only on whatever remains in the system log.
-
Maintain your protection — some protection depends on external data that changes over time. Premium keeps geolocation data and trusted Cloudflare and Jetpack network ranges up to date automatically.
Premium also adds controls including geo‑blocking, XML‑RPC restrictions, honeypots, and safeguards around sensitive WordPress operations.
See Premium plans and pricing →
Your firewall can stop an IP address, but it cannot see what that address is doing inside WordPress. WP fail2ban fills that gap: the Free edition gives fail2ban the information it needs to act on everyday abuse, while Premium adds protection and intelligence that go beyond fail2ban.
If you have questions about hosting, the Blocklist, Free and Premium, version requirements, privacy, or how WP fail2ban stores data, the FAQ below covers the practical details.
Questions
- Is WP fail2ban “fail2ban for WordPress”?
No.
fail2banis the service that watches logs and bans abusive IP addresses at the firewall. WP fail2ban is the bridge between WordPress andfail2ban: it tellsfail2banwhat is happening inside WordPress in a form it can act on.The name dates from 2011, when “WP + something” was commonly understood to mean an integration between WordPress and that thing.
- Why does a dismissed Premium notice sometimes come back?
It shouldn’t.
The Premium notices are provided by Freemius and use WordPress’s normal admin request handling to remember when you dismiss them. If another plugin mishandles that request before WP fail2ban or Freemius sees it, the dismissal is never saved and the notice can appear again.
Because plugins are usually loaded alphabetically, this can be caused by almost any plugin loaded before WP fail2ban. There is very little WP fail2ban can do to work around another plugin breaking the request.
- Will WP fail2ban work with my hosting?
If you can configure
fail2banand the firewall, yes.That normally includes VPSs, dedicated servers, and other hosting where you have control of the operating system. WP fail2ban supplies the WordPress side of the integration;
fail2banand the firewall run on the server.On managed hosting, it depends on what your provider allows. If you cannot install or configure
fail2banyourself, ask your host whether they support it or can add the WP fail2ban filters for you.- What is the Blocklist?
The WP fail2ban Blocklist uses attacks seen by participating WP fail2ban sites to identify hostile IP addresses.
That means your firewall can block an address before it attacks your site, rather than waiting for your site to see enough activity for
fail2banto act.The Blocklist is built from WP fail2ban’s own data, not third-party threat feeds. The Free edition receives a reduced list; Premium receives the full current intelligence available for your site.
- Why is the WordPress.org edition 5.x while Premium is 6.x?
The WordPress.org edition remains on 5.x so it can continue to support PHP 7.4. There are still a lot of WP fail2ban sites running PHP 7.4, even though PHP itself stopped supporting it nearly four years ago.
Premium is based on 6.x and requires PHP 8 or later. It has moved on significantly from 5.x as WP fail2ban continues to develop.
WordPress.org does not provide parallel release channels for different major versions, so 5.x and 6.x cannot both be offered for different PHP versions. Keeping the WordPress.org edition on 5.x is therefore a compromise: it lets development continue on modern PHP without abandoning existing WP fail2ban users who have not yet been able to move away from PHP 7.4.
- What’s the difference between Free and Premium?
The Free edition covers the everyday WordPress abuse most sites need
fail2banto act on.Premium goes further with the full Blocklist, the Web Application Firewall, persistent event history, geo‑blocking, maintained security data, and additional controls.
- Is WP fail2ban a firewall?
It depends which kind of firewall you mean.
WP fail2ban is not a network firewall. It tells
fail2banwhen WordPress sees abusive behaviour, andfail2bancan then add bans to the server’s stateful network firewall. Thatfirewallstops traffic before it reaches WordPress.Premium also includes a Web Application Firewall (WAF). A WAF works at a different layer: it examines what a request is trying to make WordPress do and can block malicious application-level behaviour, including SQL injection.
The two complement each other. The network firewall blocks hostile sources; the WAF protects WordPress from malicious requests that reach WordPress.
- How is WP fail2ban different from ModSecurity and other WAFs?
They work at different layers, and they can work together.
ModSecurity and similar web-server WAFs inspect HTTP requests and responses and apply rules before or around the application. That makes them good at rejecting traffic based on what the request itself looks like.
WP fail2ban runs inside WordPress, so it can see what the request actually means to WordPress: whether a login failed, whether a username exists, whether a comment was rejected as spam, what WordPress operation was attempted, and so on. It turns that application-level knowledge into events that
fail2bancan act on at the network firewall.Premium’s WAF uses the same advantage. For SQL injection, for example, it can inspect the SQL WordPress is actually about to execute rather than trying to infer solely from the incoming request whether it contains an attack.
They are complementary, not alternatives: a web-server WAF can reject malicious-looking requests before WordPress sees them; WP fail2ban can act after WordPress has interpreted them and knows what they actually mean.
sandywp / also on the shelf
Try another plugin
Limit Login Attempts Security – Login Security, 2FA, Firewall, Brute Force…
4.8 · 1M+ installs
WordPress login security with brute force protection, Two-factor authentication (2FA/MFA), firewall, IP/country blocking, and…
5.0 · 200K+ installs
CloudSecure WP Securityは、管理画面とログインURLをサイバー攻撃から守る、国産・日本語対応のセキュリティ対策プラグインです。 簡単な設定だけで、不正アクセスや不正ログインからWordPressを保護し、サイトのセキュリティを高めます。
Anti-Malware Security and Brute-Force Firewall
4.9 · 100K+ installs
This Anti-Malware scanner searches for Malware, Viruses, and other security threats and vulnerabilities on your server and it…
Spin up a real WordPress site in seconds.
Test plugins, build a demo, hand a client a link — then squash it and start again. No local setup, no Docker.