Birim Login Lock – Limit Login Attempts & Two-Factor

By Melih Birim

0+ active installationsVersion 1.0.1

Limit login attempts on the login form, XML-RPC and app passwords, plus free two-factor sign-in. Imports Limit Login Attempts settings. No nags.

Description

Limit login attempts and add two-factor sign-in in one small plugin, with no cloud service, no upsell notices and no emails unless you ask for them. A maintained replacement for Limit Login Attempts, with one-click settings import.

Bots try thousands of passwords against wp-login.php and XML-RPC every day. Birim Login Lock counts failed sign-ins and locks the address out before a password is ever checked again.

Limit login attempts

  • Every way in: the login form, WooCommerce and other wp_signon() forms, XML-RPC and application passwords.
  • Lockouts that escalate: 4 failures lock an address out for 20 minutes; the 4th lockout in 24 hours lasts 24 hours. Same defaults as Limit Login Attempts, all adjustable.
  • Checked before the password: a locked-out address is refused without checking the password, even if it is right.
  • One message for every wrong attempt: the error never says whether the username or the password was wrong.
  • Allowlist and blocklist for IPs and ranges (CIDR, IPv4 and IPv6). Saving never blocklists your own address.
  • Blocked usernames: anyone who tries admin (or any name you list) is locked out at once. Names of real accounts are refused.
  • Password reset limit: 3 requests per hour per address and per user, so nobody can flood your users’ inboxes.
  • IPv6 done right: addresses are counted per /64 network, so an attacker cannot rotate through addresses to reset the count.

The right visitor IP

Many login limiters see every visitor as one address behind Cloudflare or a host proxy and lock everyone out, or trust an X-Forwarded-For header that anyone can fake.

  • Direct (default): the connection’s own address.
  • Cloudflare: reads CF-Connecting-IP, but only on requests that really come from Cloudflare’s published ranges.
  • Other proxy: reads the header you name, but only on requests from the proxy addresses you list.
  • The Settings screen shows your IP as the plugin sees it and suggests a mode if your site looks like it is behind a proxy.

Free two-factor sign-in

  • Authenticator app (Google Authenticator, Microsoft Authenticator, 1Password, Bitwarden and any other TOTP app): scan a QR code or type the key.
  • Codes by email, for people without an app.
  • 10 recovery codes, each usable once, shown once, with a download link.
  • Require it for roles you choose: users without a method set one up right after their password. No account can skip it.
  • For every user, free: each person turns it on under Users > Profile. Administrators can reset it for someone who lost their phone.
  • XML-RPC cannot ask for a code, so account passwords of two-factor users are refused there (on by default). Application passwords keep working.

Protection for a username attacked from many IPs

When one username gets 20 failed sign-ins from 3 or more addresses in an hour, a browser that has not signed in as that user before also needs a code from the user’s email for the next hour. Browsers the user signed in from before are not affected. The attack gets nothing, and the real user is never locked out.

Moving from Limit Login Attempts

Settings > Login Lock finds the settings of Limit Login Attempts (1.x and 2.x) and Limit Login Attempts Reloaded. It shows exactly what will change (limits, lockout times, allowlist, blocklist, blocked usernames, Cloudflare) and what is not imported, and then offers to deactivate the old plugin, because two limiters count every failure twice.

Screens

  • Lockouts: who is locked out now, with Unlock and Unlock and allowlist, plus the top IPs and usernames of the last 24 hours.
  • Log: every failed sign-in, lockout and password reset request, filterable by IP, username and result. Kept 30 days by default.
  • Settings: limits, visitor IP, lists, emails and two-factor rules.

Quiet by default

No emails unless you turn them on: an alert when an administrator’s username is attacked, and a weekly summary. No dashboard widget, no review requests, no “attack” banners.

Lightweight

Two small tables, indexed queries, nothing growing in wp_options. No external requests, no tracking, no ads. Works on PHP 7.4 and up.

Third-party code

QR codes are drawn in the browser by QR Code Generator for JavaScript 2.0.4 by Kazuhiko Arase (MIT license), included unmodified as assets/qrcode.js. Source: https://github.com/kazuhikoarase/qrcode-generator

Installation

  1. Install from Plugins > Add New, or upload the birim-login-lock folder to /wp-content/plugins/.
  2. Activate the plugin. Protection starts with the default limits.
  3. Go to Settings > Login Lock. Check that “Your IP as this plugin sees it” is right; behind Cloudflare or a proxy, choose that mode.
  4. Optional: turn on two-factor sign-in under Users > Profile, or require it for roles under Settings > Login Lock.

FAQ

How do I limit login attempts in WordPress?

Install and activate Birim Login Lock. Failed sign-ins are counted at once: after 4, the address is locked out for 20 minutes. Change the numbers under Settings > Login Lock.

I locked myself out.

Add define( 'BIRIM_LOGIN_LOCK_OFF', true ); to wp-config.php, sign in, unlock your address on the Lockouts screen (or add it to the allowlist), then remove the line. Renaming the plugin folder over FTP also works.

Everyone gets locked out at once.

Your site is probably behind Cloudflare or a proxy, so every visitor arrives from the same address. Go to Settings > Login Lock and choose Cloudflare or Other proxy. The screen shows the addresses each request carries.

I’m moving from Limit Login Attempts or Limit Login Attempts Reloaded.

Activate Birim Login Lock and open Settings > Login Lock. Review the import box and click Import settings, then deactivate the old plugin from the same screen. Usernames that skipped the limits and lockout emails are not imported; the box says so.

How do I add two-factor authentication to WordPress for free?

Go to Users > Profile, scan the QR code with an authenticator app, enter the code it shows and click Update Profile. Save the recovery codes it shows. To require it for a role, tick that role under Settings > Login Lock.

I lost my phone.

Sign in with one of your recovery codes, or with a code by email if you turned that on. An administrator can also turn off two-factor for your account on your profile (Users > Edit).

Does two-factor work with XML-RPC, the mobile app or other tools?

Those cannot ask for a code. Create an application password under Users > Profile and use it instead of your account password.

The emailed code does not arrive.

Your site must be able to send email; many hosts need an SMTP plugin. If a username is under attack from many IPs while email does not work, a browser that has not signed in as that user before waits for the protection to end (1 hour); browsers used before are not affected.

Will changing my security keys affect two-factor?

Authenticator secrets are encrypted with your site’s auth salt. If you change the salts in wp-config.php, users need to set up their authenticator app again (recovery codes and email codes keep working).

Does it work on multisite?

Each site has its own settings, log and lockouts. Network-wide settings are not available yet.

How do I report a security issue?

Please email security@birim.one instead of posting in the forum. See https://plugins.birim.one/security/ for the full policy.

Screenshots

Changelog

1.0.1

  • The settings screen footer links to the other free Birim plugins (shown only to users who can install plugins).

1.0.0

  • First release.