Mitigated Automated Bot Probing at the Global Edge
Every production web application faces constant automated reconnaissance. Attackers run script bots across the internet 24/7, hunting for misconfigured servers, forgotten .env files, or unpatched CMS installations.


Every production web application faces constant automated reconnaissance. Attackers run script bots across the internet 24/7, hunting for misconfigured servers, forgotten .env files, or unpatched CMS installations.
I identified this automated noise in our logs and used it to harden the edge security perimeter of our platform. Here is an overview of what was happening, how I resolved it, and the measured outcome.
The Observation: Noise in the Logs
During routine log inspections, I identified repeated automated probes:
- Scans looking for setup scripts (such as
/wp-admin/install.phpand Magento endpoints). - Dictionary attacks searching for configuration dumps (
/.env,/.kube/config,/.docker/config.json, /secrets/openai.env,/openai.env, /.aws/credentials.js,/.aws/secret_access_key.txt). - Automated scrapers using command-line user agents (
curl,python-requests,Go-http-client).
Why this was not a breach: The platform is built modernly on Next.js. WordPress, PHP, and Magento files do not exist in our infrastructure. Every probe was met with a standard 404 Not Found.
The hidden cost: Even though the attacker gained zero access, each probe made it all the way to our Vercel serverless environment, booted edge middleware, and consumed roughly 200 MB of server memory per request. At scale, this wastes serverless compute and generates log noise.
What We Implemented: A Two-Layer Defense
Instead of letting malicious scans reach our application, we stopped them at the perimeter.
Layer 1: Global Edge Firewall (Cloudflare WAF)
We shifted traffic filtering directly to Cloudflare’s worldwide Content Delivery Network:
- Exploit Pattern Dropping: Deployed custom Web Application Firewall (WAF) rules that immediately terminate requests requesting
.env,.php,.git, or hidden configuration files at the edge. - Bad-Bot Interception: Added custom edge rules targeting automated exploitation toolkits and headless scraping signatures, deploying Managed Challenges to verify traffic legitimacy before allowing it through.
- Cryptographic HTTPS Enforcement: Turned on HTTP Strict Transport Security (HSTS) with a 1-year max-age policy and
X-Content-Type-Options: nosniffheaders to prevent protocol downgrade and MIME-sniffing attempts.
Layer 2: Next.js Edge Middleware Shielding
As a fallback behind Cloudflare, we updated firewall with an instant-rejection filter. If any anomalous probe or traversal pattern ever reaches the application router, the firewall drops it immediately with a lightweight 404, bypassing all database queries, rate limiters, and session lookups.
File Target in Log
Bots scan for these specific filenames because exposed credentials have high black-market value:
| File Target in Log | What the Attacker Was Searching For |
|---|---|
| /secrets/openai.env, /openai.env | Compromised OpenAI API keys to hijack GPT-4 credits. |
| /secrets/anthropic.env, /anthropic.env | Compromised Anthropic Claude API tokens. |
| /openrouter.env | Aggregator API keys for free AI inference. |
| /secrets/stripe.env, /stripe_keys.js | Stripe secret keys (sk_live_...) to clone payment pipelines. |
| /.aws/credentials.js, /.aws/secret_access_key.txt | Root AWS IAM access keys for cloud compute / S3 data theft. |
| /office365.env, /outlook.env, /mail.env | Corporate SMTP and mail relays for spam forwarding. |
| /config/database.yml, /config.env | Database connection strings (postgresql://...). |
3. The Outcome
| Metric | Before policy enforcement | Result & Outcome |
|---|---|---|
| Edge Compute Waste | Probes booted deployment functions (~214 MB memory per scan) | Zero — 100% dropped at the Cloudflare edge |
| Vulnerability Probes | Passed freely through the edge firewall | Blocked / Challenged automatically |
| Immediate Live Block | Inbound scans reached the app router | Intercepted instantly (e.g., active scanner IP blocked within minutes of deployment) |
| User Experience | Normal | Zero friction — users browse unaffected |
Takeaway
Security is not about hoping attackers will ignore your domain; it is about preparing and safeguarding automated filters that reject malicious traffic long before it touches your core application.