GeoTech

Engineering / Case study

Password spraying through residential proxies: how we caught a mailbox takeover that rate-limits could not see

GeoTech Engineering · · 9 min read

Email securityIncident responsefail2banPhishing

On 17 November 2026 a mid-sized Egyptian manufacturer that runs its email on our platform told us that staff could not sign in. Within the day we had found a password-spraying campaign that had been running for a month, a finance mailbox quietly being used to send German-language bank phishing, and the phishing email that started it. This is what we saw, what worked, one mistake we made, and the controls we now run for every customer at no extra infrastructure cost.

616failed logins
615attacking IPs
36countries
614IPs used only once

TL;DR

How the attack unfolded

0357010514018 Oct: 118 Oct19 Oct: 420 Oct: 722 Oct: 1323 Oct: 1424 Oct: 224 Oct25 Oct: 426 Oct: 527 Oct: 728 Oct: 1129 Oct: 930 Oct: 130 Oct31 Oct: 11 Nov: 92 Nov: 33 Nov: 25 Nov: 25 Nov6 Nov: 67 Nov: 68 Nov: 19 Nov: 1411 Nov: 711 Nov12 Nov: 713 Nov: 4814 Nov: 6115 Nov: 11816 Nov: 13117 Nov: 12217 Nov
Failed logins per day against the customer's domain. For three weeks the attacker targeted an address that does not exist (guessed from an employee's name); from 14 November the volume roughly doubled every day against a real mailbox.

The early traffic is the tell: hundreds of attempts against firstname.lastname@ combinations that never existed. The attacker was building addresses from public employee names, the same way a sales tool would. Once a real address responded differently, the campaign moved to it.

Where the 615 attacking addresses were located. The black marker is the mail server in Egypt. US share: 86%, spread across 300+ cities, mostly consumer ISPs and mobile carriers.

Why classic rate limiting saw nothing

Most mail servers protect logins with a rule like "ban an IP after 5 failures in 10 minutes". Against this campaign that rule is useless:

The signal that does work is where the attempt comes from relative to who normally uses the mailbox. This company's staff connect from Egypt. A failed login from Ohio is not a typo.

How they actually got in: one click

The mailbox that was taken over had received, the evening before, an email titled [Ticket ID: #CFD-…] Employee's Urgent reconfirmation needed for <user>@<company>, sent from a compromised server in Vietnam. Its button led to a fake login page. The user later confirmed he had opened it. Thirteen hours later the first login from Nigeria succeeded at the first attempt, with the correct password. A typo in the username followed by a correction 13 seconds later suggests a human operator, not a script.

Searching the other mailboxes turned up the same lure going back to July: "password expires today", "email reconfirmation needed urgently!!!". Phishing, not the spray, was the entry point.

What the attacker did with a finance mailbox

A second mailbox, belonging to the finance function, was logged into from rotating US residential IPs, each login from a new address with no failed attempt first: the signature of someone who already holds the password. It was then used to send mail through our server from an IP in Turkey:

  1. Testing (5–16 Nov): nine small messages to two random-looking inboxes at a German webmail provider, almost certainly the attacker's own, to confirm the account could send without being filtered.
  2. Campaign (16–17 Nov): eight larger messages to named individuals in alphabetical order (t…, to…, tom…, tor…, tri…, tu…, u…), with the sender name "ING Supportbearbeitung" and subjects such as "Ihr Konto wartet auf Sie" ("Your account is waiting for you"). Five were delivered, three bounced.

The attacker paced messages about 13 minutes apart to stay under volume alarms, and the bounce reports were removed from the mailbox. Nothing was sent to the company's own customers or suppliers.

Response

A scheduled credential rotation on the migrated mailboxes cut the attacker off. The last phishing message left at 05:21.

Staff report they cannot sign in. Log review begins.

Automatic banning enabled for repeated failures (fail2ban on Dovecot and Postfix SASL).

637 addresses blocked permanently on mail ports (firewalld ipset). New rule: a single failed login from outside Egypt on this domain is banned for 30 days.

New passwords for all 26 mailboxes, every session terminated. Passwords delivered through a single-use link that opens only after a WhatsApp code to the account owner.

Self-service password change page published so each employee replaces the temporary password immediately.

Every other domain on the platform scanned for the same pattern. One more mailbox at a different customer showed valid-password logins from US residential IPs; its sources were blocked the same afternoon.

The mistake we made, and the lesson

When staff could not sign in, we briefly rolled the passwords back to keep the business running while we investigated. Those were the passwords the attacker held. Our firewall had already blocked the Turkish sender, so nothing more went out, but for a few hours the door was open again.

Lesson: never roll credentials back before you have checked for compromise. If people are locked out, deliver new credentials quickly instead.

A second, subtler one: our first whitelist (to avoid banning real users) included every address that had logged in successfully. That list also contained the attacker. We now whitelist only domestic addresses with a successful login in the last 14 days.

The controls, in detail

1. First failure from abroad = ban

fail2ban supports an ignorecommand: a script that decides per IP whether to skip banning. Ours returns "skip" only when the address is in Egypt (GeoLite2 country database) or on the known-good list. Combined with maxretry = 1, one wrong password from another country is enough.

[customer-spray]
enabled       = true
filter        = customer-spray        # Dovecot "auth failed" + Postfix SASL failures for one domain
logpath       = /var/log/maillog
maxretry      = 1
findtime      = 1d
bantime       = 30d
ignorecommand = /usr/local/sbin/f2b-ignore-home-country <ip>
#!/bin/bash
# exit 0 = do not ban: the address is in the home country, or logged in successfully before
ip="$1"
grep -qw -- "$ip" /etc/fail2ban/jail.d/zz-goodips.local && exit 0
cc=$(mmdblookup --file /usr/share/GeoIP/GeoLite2-Country.mmdb --ip "$ip" country iso_code \
     | grep -oE '"[A-Z]{2}"' | tr -d '"')
[ "$cc" = "EG" ] && exit 0
exit 1

2. Block what already got in

Addresses that logged in successfully from abroad never trigger a failure-based rule. We pulled them from the logs and put them, with the spray sources, into one ipset dropped on IMAP, POP3 and submission ports, leaving port 25 open so legitimate inbound mail still arrives.

3. Credentials that open once

New passwords should never sit in a chat thread or an email. We built a small handoff link: the bundle is encrypted at rest, opens only after a WhatsApp code sent to the one phone number it was issued for, and is erased the moment it is read.

4. Hunt across every tenant

The useful question after one incident is "who else?". Comparing each mailbox's successful-login countries with where its users normally are takes seconds on a single server and found a second affected mailbox at another customer the same day.

Results

Checklist for your own mail server

  1. Know where your users log in from, and alert on successful logins from elsewhere, not only failures.
  2. Add a geo-aware rule: one failure from an unexpected country should be enough to ban.
  3. Do not whitelist "anyone who logged in successfully". Attackers log in successfully too.
  4. Train staff on one rule: never type the email password into a page opened from a link in an email.
  5. Give users a real place to change their password, and rotate on a schedule.
  6. After any incident, scan every tenant for the same pattern the same day.

Indicators

TypeValueContext
IP176.53.159.177Sent the ING-themed phishing through a compromised mailbox (TR)
Hostmail.digiwall.vn (223.27.104.11)Delivered the "Employee's Urgent reconfirmation needed" lure
Emailsubsectorcolony6@web.de, unwittingchase3@web.deAttacker test inboxes
Subject[Ticket ID: #CFD-…] Employee's Urgent reconfirmation needed for …Credential-phishing lure