DEV Community

ClientN
ClientN

Posted on Originally published at clientn.com

Why Blocking an IP Address Hits the Wrong People

Ask a web server who is knocking and it will answer with an IP address. For two decades that answer has been the default unit of abuse control. Too many failed logins from one address, and the address gets blocked. A scraper floods a product page, and its range gets a temporary ban. The method is cheap, needs no accounts, and works often enough that most sites still lean on it.

The trouble is that an IP address is not a person, and the gap keeps widening. Phones on mobile carriers, households behind one router, offices and VPN services put many people behind a few public addresses. When a site blocks one of those addresses, it blocks everyone who shares it.

An address was supposed to name one device

The original Internet design assumed a simple relationship between a device and its address. Richter and eight co-authors start their 2016 measurement study from that assumption: the architecture calls for IP addresses to uniquely identify devices (arXiv:1605.05606, published at ACM IMC). Abuse tools were built on the same assumption. If an address belonged to one machine, blocking it hit the machine that misbehaved.

The idea began to break when public IPv4 addresses ran short. RFC 6269, an Informational document from June 2011, starts from the completion of IPv4 allocations at IANA and the Regional Internet Registries. Operators then faced a slow fix (IPv6, which takes time to reach every network) and a fast one: let customers share the public addresses that remained. Many chose sharing, and that sharing reached the people using websites.

How shared addresses became the norm

The usual answer is carrier-grade NAT. A phone holds a private address that only means something inside the carrier's network. The carrier's gateway maps many customers onto a small pool of public addresses. RFC 6888, the Best Current Practice for carrier-grade NATs (BCP 127, April 2013), describes a service in which one public IPv4 address is shared by many subscribers.

How common is it? The 2016 study combined a crawl of the BitTorrent DHT with Netalyzr measurements and answers from 75 ISPs. It found CGN ubiquitous in cellular networks, with more than 90% of cellular ASes deploying one. For fixed networks the rate was 17 to 18 percent of eyeball ASes. Those are 2016 numbers, so read them as a snapshot. The direction is still clear.

Addresses also change. A phone that moves from mobile data to Wi-Fi can present a different public address in the middle of a session. A login that starts on one network and finishes on another can look like two visitors. A rate limiter can reset during a real attack, and an honest user can meet a challenge that appears only because the address changed under them.

What your server sees

From the server's side, a carrier gateway looks like one visitor making a lot of requests. A thousand people reading the same article, or signing in to the same forum, can all arrive from one address.

Now add one abusive user. A bot behind that gateway starts guessing passwords on your login page. Your rate limit counts failures per address, because the address is the only identifier the request carries. The count crosses the threshold, and the block lands on every subscriber behind the gateway, including the person who only wanted to check a balance. RFC 6269 makes the same point in its section on abuse logging: "one user who fails a number of login attempts may block out other users."

Logs make the problem last longer. Each request in an access log carries the shared address, so one abusive burst leaves a trail that points at a crowd. Someone reading those logs months later can mistake the crowd for the attacker.

Blocking by address fails in both directions

Shared addresses cause false positives first. For a site with many mobile visitors, the damage shows up as a CAPTCHA wall, a temporary lockout or a refused sign-in. The person on the other end usually cannot explain who they are, and does not know why they were turned away.

The opposite failure matters just as much. Attackers rotate through proxies, cloud instances, residential pools and botnets, so a block that catches one address does little to a crawler that can ask for the next one. The site pays the collateral cost while the attacker moves on.

There is also a bias in who gets hurt. People on mobile networks, behind campus firewalls or using privacy tools are the ones who share addresses with strangers. Address blocks put the burden of someone else's abuse on the users least able to see it coming and least able to appeal it.

What a rate limit should count instead

Once an address is accepted as a weak identifier, the design question is what to count. There are three common choices, and each has a cost.

  • Per account. A cap on failed attempts against one account stops a guesser who keeps trying the same user. NIST SP 800-63B-4 section 3.2.2 says verifiers "SHALL implement controls to protect against online guessing attacks." The weakness is spraying: a few guesses spread across thousands of accounts can stay under every per-account cap.
  • Per address. Cheap and needs no account, but it reaches the crowd behind a shared address.
  • Per device or session. This can separate people behind one address, but a fresh cookie or a new browser profile resets the count. Tying counts to a device also builds a record of that device, which is a privacy cost of its own.

Each option ties the defense to something an attacker can change cheaply, something innocent users share, or something that exposes the person. The useful question is whether you can count a unit that is expensive for an attacker to rotate and that does not reveal who the person is. That is still an open design problem.

Counting without a name

Anonymous tokens are one answer. A service issues a limited budget of tokens after a check, and each token later proves that the holder earned one more action without revealing a stable identity. Privacy Pass is a well-known example. Anonymous tokens raise governance questions of their own: someone decides who gets tokens, how many, and under what check, and that issuer becomes a point of trust.

Proof of work is another option. Each request costs the client a little computation, so bulk abuse gets expensive without asking anyone for identity. It drains phone batteries, and it does little against a well-funded botnet.

Sign-in is where anonymity changes the design. If a service needs a stable identifier to sign someone in, abuse control is easy but the privacy cost is high. If it only needs proof that a sign-in was approved by the right key on the right device, it can aim its controls at the attempt rather than at a person's history.

What to build instead

Address blocks have not disappeared. They still work as a short-lived, low-cost signal, but they should not be the main defense on a login form. A few practical habits follow:

  • Treat a raw address block as a weak signal, and combine it with other signals before blocking anything.
  • Prefer short, growing delays on the affected account over long blocks on an address.
  • Give legitimate users a clear message, a retry time and a way forward, such as a passkey or a second factor they already own.
  • Expire every block automatically. Carrier addresses are reassigned, so a block with no expiry becomes a penalty on whoever inherits the address next.
  • Keep only the logs you need, with short retention for raw addresses. Logs of failed sign-ins are personal data too.

I'm building ClientN, an anonymous sign-in service, so read this as my view, not a neutral one. Each website that uses ClientN gets a random ID made only for that site, not your email address, and sign-in approvals are checked on your own device. Abuse controls still matter in that design, which is why they belong in the same conversation as the address question. The security page explains how approvals are checked: https://clientn.com/security/

Originally published at clientn.com/blog.

Top comments (0)