Skip to content
By cyberattacks

How To Secure Your Contact Form From Bot Attacks

Contact-form spam, scraping, and abuse are now industrialised. Here are the layered defences that actually keep bots out without annoying humans.

How To Secure Your Contact Form From Bot Attacks, by Deepak Gupta on guptadeepak.com

Contact forms look harmless. They are also one of the easiest abuse surfaces on the modern web. Spammers, scrapers, credential testers, and increasingly AI-driven scrapers all hit them at scale. If your form is unprotected, you are almost certainly receiving more bot submissions than human ones.

The defence has to balance two goals: keep bots out, and keep humans in. Hostile CAPTCHA wars drive away legitimate users; minimal protection lets the bots through. The right answer is layered.

What bots actually do to your form

  • Spam. Mass submission of links and pitches.
  • Reconnaissance. Probing for error messages that leak server details.
  • Email harvesting. Submitting fake leads to capture the auto-reply email and learn your address structure.
  • SQL or XSS injection. Testing whether your form is vulnerable to common attacks.
  • Lead-data poisoning. Filling your CRM with junk to slow your sales team.
  • Resource exhaustion. Hitting a form thousands of times per minute to overload backend processing.

The layered defence

1. Server-side input validation

The most basic and most-skipped layer. Validate the email format, the phone format, the length of every field, the character set. Reject anything that does not match the spec. This alone filters out most lazy bots.

2. Honeypot fields

Add a hidden field that real users never see and bots tend to fill in. Reject any submission where the field is populated. Costs nothing, breaks no UX, catches a meaningful share of automated traffic.

3. Time-based filtering

A human cannot fill out a contact form in under a second. Record the time the form was rendered and rejected anything submitted faster than a reasonable minimum.

4. Rate limiting

Per-IP and per-fingerprint rate limits on form submissions. A real person fills one form. A bot tries hundreds.

5. Modern bot management

Services like Cloudflare Turnstile, hCaptcha Enterprise, or commercial bot management score every request silently and only challenge the suspicious ones. Most legitimate visitors never see a CAPTCHA.

6. Email verification

For high-value forms (newsletter signup, contact, lead gen), require email confirmation before processing the submission. Cuts fake leads to near zero.

7. Content filtering

Scan submissions for known spam patterns: link-stuffed bodies, common spam phrases, mismatched language and locale. Akismet and equivalents do this well.

8. Authentication for higher-stakes forms

Anything that creates an account, books a meeting, or triggers a payout should require at least an email loop, ideally an authenticated session.

What to avoid

  • Old-style image CAPTCHA. Solvable by attackers at scale, hated by humans, terrible for accessibility.
  • Client-side-only validation. A bot ignores your JavaScript. Validate on the server.
  • Blocking entire countries. Almost always too blunt; loses real customers along with bots.
  • Hidden error messages that leak server detail. "Database connection failed at line 42" is a gift to attackers.

What to monitor

  • Submission volume by IP, ASN, and country.
  • Ratio of submissions to successful follow-ups.
  • Spike alerts on traffic from data-centre IPs.
  • Failed-validation rate, broken out by rule.

The data tells you which layer is doing the work and where new bots are slipping through.

The bottom line

No single control will keep a determined attacker out. A combination of honeypots, time gates, rate limits, modern bot management, and email verification will defeat almost every automated abuse pattern in circulation while staying invisible to your real visitors. Build the stack once, monitor it, and your contact form stops being the soft target on your site.

Get the newsletter

New writing on identity, AI security, and building software, delivered when it ships. No tracking pixels, no funnels, unsubscribe with one click.