How to Stop Brute-Force Attacks on wp-login.php and xmlrpc.php
Thousands of POSTs to wp-login.php and xmlrpc.php are slowing your site. Measure the attack in your logs, then layer 2FA, attempt limits, an xmlrpc block and edge rules.
Spam pages, strange admin users, redirects to other sites or files you did not add.
Do this first
Diagnose it
Most compromised sites stay online, because the attacker wants your traffic and your server. The symptom tells you what kind of infection you are dealing with.
| What you see | What it usually is |
|---|---|
Google results for your site with Japanese or pharmacy titles, or This site may be hacked under your listing | SEO spam: thousands of generated pages or a cloaked spam layer shown only to search engines. |
A red full-page warning: Deceptive site ahead or The site ahead contains malware | Google Safe Browsing has flagged the site. Search Console lists it under Security issues. |
| Visitors from Google or on phones land on a scam site, but you never see it | A conditional redirect that skips logged-in users and repeat visitors. |
| Admin users you did not create | A backdoor account, often created through a vulnerable plugin. |
PHP files in wp-content/uploads, or files with random names in the site root | Web shells or backdoors. |
| Bounces you never sent, or a host notice about outgoing spam | A mailer script on the site or a compromised mailbox. |
| A suspension notice for malware or phishing | Your host’s scanner or an outside abuse report found it. |
A fake Verify you are human box that tells visitors to press Win+R, or to paste a command into Terminal or PowerShell | A ClickFix overlay injected into the site to trick visitors into running malware. See fake CAPTCHA and ClickFix. |
1. Look at your site the way search engines see it.
curl -s -A 'Googlebot/2.1 (+http://www.google.com/bot.html)' https://example.com/ | grep -ioE 'viagra|cialis|casino|slot gacor|replica' | sort | uniq -c
Run it on your own computer, replacing example.com with your domain. -A sends the Googlebot user agent, which cloaked spam is set up to answer. Good: no output. Bad: spam words that do not appear when you view the page normally.
2. Look at it the way a phone user from Google sees it.
curl -sI -A 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' -e 'https://www.google.com/' https://example.com/ | grep -iE '^(HTTP|location)'
Run it on your own computer. -e pretends you arrived from Google; -A pretends to be an iPhone. Good: HTTP/2 200 and no location line, or a location on your own domain. Bad: a location pointing at a domain you do not own.
3. Search Google for pages you did not write.
site:example.com
Type this into Google search. Scroll several pages. Titles in other languages or about products you do not sell mean spam pages exist or existed.
4. Find PHP files where none should be.
find wp-content/uploads -type f -name '*.php'
Run it in an SSH terminal inside the site’s folder (the one with wp-config.php). The uploads folder holds images and documents. Good: no output, or only an empty index.php placed by a plugin. Bad: any other PHP file.
5. Check plugin files against the official copies.
wp plugin verify-checksums --all
Run it in the same SSH terminal, in the site’s folder. --all checks every installed plugin against the files published on WordPress.org. Good: Verified for each one. Bad: File was added or Checksum does not match. Premium plugins not hosted on WordPress.org are reported as unverifiable, so check those against a fresh download.
These are the usual ways in. Knowing which one happened decides whether your cleanup holds.
admin-ajax.php or a REST route. Fix: update or remove it; delete anything that no longer gets updates.POST /wp-login.php from an unfamiliar IP, followed by a plugin upload or a theme file edit. Fix: new unique passwords and 2FA for every admin.eval(base64_decode( sits inside it from the day it was installed. Fix: delete it and install a licensed copy.phpinfo files or migration installer scripts reachable by URL. Fix: delete them and keep backups outside the public folder.Did this fix it?
Still stuck? Start again from what you can see in the Emergency Room.
The full fix
Thousands of POSTs to wp-login.php and xmlrpc.php are slowing your site. Measure the attack in your logs, then layer 2FA, attempt limits, an xmlrpc block and edge rules.
You got an alert that a plugin you run is vulnerable. Read the advisory, decide how urgent it is, patch or replace the plugin, and check whether you were already exploited.
Someone logged in as one of your users. Lock the account, kill its sessions and application passwords, secure the email behind it, then review what it changed.
Your site is buried under traffic. Tell an attack from a viral spike, put Cloudflare in front, challenge or rate limit the hot paths, and lock your origin so it cannot be bypassed.
A security scanner flagged a file on your site. Verify it against official checksums, compare it with a clean copy, check its timestamps and read it safely to decide.
Customers report card fraud after buying from you, or a strange card form appears at checkout. Stop card payments, find the skimmer in the database and files, clean up and notify the right people.
Your site and email vanished and the domain now points somewhere else, or sits at a registrar you never used. Confirm what changed with RDAP, lock down the email behind the registrar login, then escalate through the registrar, the transfer dispute process and ICANN.
Visitors see a fake Cloudflare check that tells them to press Windows key + R and paste a command. Your site is hacked. Make the lure show itself, find the injected script, clean up and warn visitors.
An email says your site has a vulnerability, broke copyright, is about to lose its domain or will be suspended. Most are scams, some are real. Verify each one by logging in to the real account yourself, never through the link in the email.
Someone is in your mailbox: contacts get spam from you, replies vanish or your provider blocked sending. Lock the attacker out, remove their rules and forwarding, then get delisted.
Search the field manual
Or jump straight to a symptom
Press / to search from any page, Esc to close