How to prevent bot signups: a layered defence that real users never notice
· 8 min read · Disposable email
To prevent bot signups, stack cheap checks on the server in order of cost: a rate limit per IP, a challenge such as Cloudflare Turnstile or a CAPTCHA, then a check on the email address itself (disposable domain, machine-generated local part), and finally a confirmation email before the account gets anything valuable. No single layer stops every bot. Together they make each fake account slow and expensive, while a real person only sees a form and one confirmation link.
The mistake most teams make is picking one tool and expecting it to carry the whole load. A CAPTCHA alone gets solved. A blocklist alone misses new domains. Verification alone lets the bot create the row, which is often the part that costs you.
What a signup bot actually wants
Before choosing defences, figure out why the bots are there. The goal decides which layer matters most.
| Bot goal | What it does | Layer that hurts it most |
|---|---|---|
| Free-tier resources (credits, compute, storage) | Creates many accounts, each with a throwaway inbox | Disposable-domain block, verification before value |
| Spam or phishing from your platform | Signs up, then sends messages or hosts content | Verification, usage caps until trust builds |
| Referral or promo credit | Farms accounts that each claim a reward | Email normalization, disposable block, delayed payout |
| Credential or email enumeration | Probes whether an address already has an account | Rate limits, identical responses for existing and new |
| Form spam (no account goal) | Fills every form it finds with junk | CAPTCHA or Turnstile, honeypot field |
If you can't tell which one you have, look at what the fake accounts did after signing up. Fake signups: where they come from walks through how to read that.
Layer 1: rate limit the signup endpoint
Rate limits are the cheapest defence and the one most often missing. Limit signup attempts per IP (per /64 for IPv6, since one host typically controls the whole block) and, separately, per normalized email address.
A limit like 5 attempts per IP per 10 minutes rarely touches a real user. Shared IPs (offices, universities, mobile carriers) can trip it, so return a clear message and a retry time rather than a silent failure.
Rate limits don't stop a bot with a pool of residential proxies. They do stop the lazy majority, and they put a ceiling on how fast the clever ones can go.
Layer 2: a challenge (Turnstile or CAPTCHA)
A challenge proves something in a browser executed your page. Cloudflare Turnstile runs mostly without a visible puzzle; reCAPTCHA and hCaptcha are the common alternatives. Whichever you use, the rule is the same: the browser gets a token, and your server checks that token with the provider before doing anything else. A token that is never checked server-side is decoration.
For Turnstile, the server call is a POST to the siteverify endpoint documented in Cloudflare's server-side validation guide. Tokens are single-use and expire, so validate once, at submission time.
Trade-offs to accept:
- Some privacy tools and older browsers fail challenges. Offer a fallback path (an email-only flow, a support contact) instead of a dead end.
- Solving services exist. A challenge raises the price of an automated signup, it does not make it impossible.
- If the provider is down, decide in advance whether you fail open or closed. For most products, failing open plus tighter downstream checks is the better choice.
Layer 3: check the email address
Bots need inboxes, and the cheap inboxes are recognizable. Two patterns cover most of what gets through the first two layers:
- Disposable domains. Throwaway inbox services publish their domains, and the community disposable-email-domains list tracks several thousand of them. The ones we flag are on the disposable domain category page.
- Machine-generated local parts at real providers:
k3xq9vz7tp@gmail.com. The domain is fine, so a blocklist can't help. You need a check on the characters before the@(how that scoring works).
pingutil's lookup returns both as one decision. With skip_enrichment: true there is no company-profile step, so it answers fast enough to run inline in the signup request. The fields to read:
verdict.is_spam: true for disposable domains, reputation-flagged domains and randomized local parts. This is the one to block on.verdict.low_trustandverdict.reason: role, system or sales addresses (info@,noreply@,sales@). Flag or review, don't block.email_signals.randomness_score: 0 to 100. Useful as a feature in your own risk score, even below the threshold whereis_randomizedflips.
Be honest with yourself about what this misses. A bot with a pool of aged, real-looking Gmail addresses passes the email check. Privacy relays like Apple Hide My Email produce random-looking aliases and can be flagged as randomized, so treat randomized_local_part as "ask for verification" if your audience leans that way. Some real non-English names also score high.
Layer 4: verify before handing out value
The last layer is the oldest: send a confirmation link and don't release anything costly until it's clicked. A bot that used a fake or unreachable address stops here, and one that used a real inbox has to automate reading it, which is more work per account.
You can also check the mailbox before sending the link. POST /v1/verify runs syntax, DNS/MX and an SMTP RCPT TO check without sending a message, and returns valid, invalid, risky or unknown. Reject on invalid. Treat risky (including catch-all domains, which can never be confirmed) and unknown (the server wouldn't answer) as "let them in, require the confirmation click". Mailbox checks take longer than the lookup, so many teams run them right after account creation rather than inside the request. Verifying at signup without adding friction covers that ordering.
A signup handler with all four layers
Express on Node 18+, using the built-in fetch. The in-memory rate limiter is for illustration; use Redis or your platform's limiter in production so limits survive restarts and work across instances.
// server.mjs
import express from 'express';
import { randomUUID } from 'node:crypto';
const app = express();
app.use(express.json({ limit: '16kb' }));
const PINGUTIL_KEY = process.env.PINGUTIL_KEY;
const TURNSTILE_SECRET = process.env.TURNSTILE_SECRET;
// --- Layer 1: naive fixed-window limiter (replace with Redis in production)
const hits = new Map();
function allow(key, max, windowMs) {
const now = Date.now();
const entry = hits.get(key);
if (!entry || now - entry.start > windowMs) {
hits.set(key, { start: now, count: 1 });
return true;
}
entry.count += 1;
return entry.count <= max;
}
function clientKey(req) {
const ip = req.ip ?? '';
// Group IPv6 by /64: keep the first four hextets.
return ip.includes(':') ? ip.split(':').slice(0, 4).join(':') : ip;
}
// --- Layer 2: Turnstile token check
async function turnstileOk(token, ip) {
if (!token) return false;
const body = new URLSearchParams({ secret: TURNSTILE_SECRET, response: token, remoteip: ip });
try {
const res = await fetch('https://challenges.cloudflare.com/turnstile/v0/siteverify', {
method: 'POST',
body,
signal: AbortSignal.timeout(5_000),
});
const data = await res.json();
return data.success === true;
} catch {
return true; // provider unreachable: fail open, later layers still apply
}
}
// --- Layer 3: email screening
async function screenEmail(email) {
try {
const res = await fetch('https://pingutil.com/v1/lookup', {
method: 'POST',
headers: { authorization: `Bearer ${PINGUTIL_KEY}`, 'content-type': 'application/json' },
body: JSON.stringify({ input: email, skip_enrichment: true }),
signal: AbortSignal.timeout(3_000),
});
if (!res.ok) return { block: false, review: false, reason: 'lookup_unavailable' };
const r = await res.json();
return {
block: r.verdict.is_spam,
review: r.verdict.low_trust || (r.email_signals?.randomness_score ?? 0) >= 60,
reason: r.verdict.reason,
category: r.category,
};
} catch {
return { block: false, review: false, reason: 'lookup_unavailable' };
}
}
app.post('/signup', async (req, res) => {
const { email, password, turnstileToken } = req.body ?? {};
if (typeof email !== 'string' || typeof password !== 'string') {
return res.status(400).json({ error: 'email and password are required' });
}
const normalized = email.trim().toLowerCase();
if (!allow(`ip:${clientKey(req)}`, 5, 10 * 60_000) || !allow(`email:${normalized}`, 3, 60 * 60_000)) {
return res.status(429).json({ error: 'Too many attempts. Try again in a few minutes.' });
}
if (!(await turnstileOk(turnstileToken, req.ip))) {
return res.status(403).json({ error: 'Please complete the challenge and try again.' });
}
const screen = await screenEmail(normalized);
if (screen.block) {
return res.status(422).json({
error: 'Please use a permanent email address you can receive mail at.',
});
}
// Create the account in a limited state. Layer 4: nothing costly until confirmed.
const user = await createUser({
email: normalized,
password,
status: 'unconfirmed',
needsReview: screen.review,
screenReason: screen.reason,
});
await sendConfirmationEmail(user);
res.status(201).json({ ok: true });
});
// Stubs: replace with your persistence and mailer.
async function createUser(u) { return { id: randomUUID(), ...u }; }
async function sendConfirmationEmail(u) { console.log('confirm link for', u.email); }
app.listen(3000);
Three choices in this code are deliberate.
- Every external check fails open. If Turnstile or the lookup times out, the signup continues and the confirmation step still applies. Blocking real users because a dependency hiccupped costs more than letting a few bots reach an unconfirmed state.
- The block message is generic. It doesn't say "disposable domain detected", which would tell a bot author which layer to route around.
reviewdoesn't block. Role addresses and borderline randomness scores go into a queue or a stricter trial, not a rejection. The 60 threshold is a starting point; tune it against your own signups.
What each layer costs real users
| Layer | Real-user cost | Bot cost | Failure mode |
|---|---|---|---|
| Rate limit | None, unless on a busy shared IP | High for single-host bots | Proxy pools spread the load |
| Turnstile / CAPTCHA | Low, occasionally a puzzle | Moderate (solvers cost money) | Solving services, headless browsers |
| Email check | None for almost everyone | High for throwaway-inbox bots | Aged real inboxes, new disposable domains |
| Confirmation before value | One click | High if they used fake addresses | Bots that automate real inboxes |
| Card or phone for expensive features | High, some people leave | Very high | Stolen cards, SMS farms |
The first four rows are cheap enough to run on every signup. The last row is a dial you turn only for the parts of the product that are expensive to give away. Stopping free-trial abuse goes further into that ladder.
Watch the layers, not just the totals
Log which layer stopped each attempt (rate_limited, challenge_failed, email_blocked, never_confirmed). When bot volume changes, the breakdown tells you which layer they found a way past. A jump in never_confirmed with a flat email_blocked count usually means a new disposable domain or a switch to real webmail, and that's your cue to look at the addresses rather than add another CAPTCHA.
For the full playbook on fake accounts, including what to do after signup, see the guide to stopping fake signups and the SaaS signup protection use case. If you want to see what the email check returns before wiring it in, paste a few addresses into the live demo.
Questions people ask
- Is a CAPTCHA enough to stop bot signups?
- No. A CAPTCHA raises the cost of each automated attempt, but solving services and headless browsers get through, and it does nothing about the email address the bot submits. Pair it with rate limits and an email check on the server.
- Should I block signups from Gmail to stop bots?
- Usually not. Most real consumers and plenty of B2B evaluators sign up with free webmail. Block disposable domains and machine-generated local parts instead, and leave free webmail open unless your product is strictly for companies.
- Where should bot checks run, in the browser or on the server?
- The decision has to be made on the server. Browser checks are useful for user feedback, but a bot can skip your JavaScript entirely and post straight to your signup endpoint.