{"slug": "i-asked-two-ai-teams-to-break-my-bot-detector-they-found-8-holes-and-their-fixes", "title": "I asked two AI teams to break my bot detector. They found 8 holes, and their fixes opened 3 new ones.", "summary": "A developer ran two AI agent teams, one on Claude and one on Gemini, against their open-source CAPTCHA alternative Synapse Shield, and the agents independently flagged 10 issues, with a red-team agent confirming 8 of 8 claims via working proof-of-concept exploits. Coding agents then produced eleven patches, but three passed their own tests while still being wrong, including a header parser that merged spoofed variants like x_forwarded_for into X-Forwarded-For. All findings are fixed in v0.12.0, and the developer argues every agent-written security fix must be reviewed as if it came from a stranger.", "body_md": "Last week I shipped a release where I barely wrote any code myself.\n\nAI agents found the bugs, and other agents wrote the fixes. My job was to **check every fix as if it had come from a stranger**.\n\nThat turned out to be the most important part. Three of the eleven patches passed their own tests and were still wrong.\n\nThis post covers what the agents found in my open-source bot detector, how the review process worked, and what I learned about letting AI touch security code.\n\nIt's a self-hosted replacement for CAPTCHAs. A small browser SDK records **how** a visitor moves, taps and types. It never records **what** they type. Your server then scores the session and allows it, blocks it, or asks the browser to solve an invisible proof-of-work.\n\nIt's written in Python with a Rust core, has SDKs for React, Vue and plain JS, and is MIT licensed.\n\nI split the codebase into five areas: detection engine, crypto and tokens, framework adapters and SDKs, Rust core, and monitoring. I gave each area to an AI \"owner\" with one rule: **research only, change nothing, and back every claim with a file and line number**.\n\nI ran the same assignment twice, once with Claude agents and once with Gemini agents.\n\n| Issues found independently by **both** teams | 10 | \n| Found only by one team | several each | \n| Claims later confirmed by a red-team agent writing a working proof of concept | **8 of 8** | \n\nThe overlap was the useful signal. When two different models independently point at the same line, it's probably real.\n\nThen a third agent played attacker. For every claim it wrote a small script that either reproduced the hole or failed to. No reproduction meant no fix.\n\nAll of these are fixed in v0.12.0. If you run Synapse Shield, please upgrade.\n\n**1. Phone-sized screens skipped the behavioural layer (critical).**\n\nIf a request said \"I support touch\" but sent no touch events, the session was supposed to be treated as desktop. That check only ran on screens 1024 px or wider. On a phone-sized screen, a one-click macro scored **0 out of 100** and was allowed.\n\n**2. The client could choose its own IP address (critical, behind some proxies).**\n\nBehind a reverse proxy, the server trusted several forwarding headers in a fixed order. If the proxy passed client-sent headers through, an attacker could pick their own IP and dodge bans and rate limits. In development mode, a forged loopback address even unlocked the admin panel.\n\n**3. Two framework integrations broke the proof-of-work.**\n\nThey wrapped the challenge response one level deeper than the SDKs expected. Users on those routes got stuck on a 429 they could never clear.\n\n**4. The Rust core and the Python fallback disagreed.**\n\nLeave one field out of the request and the Rust path said \"human\" while the Python path said \"bot\". That's a free bypass whenever the fast path is active.\n\n**5. A locked database looked like an attack.**\n\nWhen SQLite was briefly locked, the nonce check failed. A failed check was counted as a replay, so a real user got a strike against their IP.\n\n**6. Very short mouse movements were punished for being short (false positives).**\n\nWith 3 or 4 points, some statistics only have one value, so their variance is 0. The rule read that zero as \"too perfect, must be a bot\".\n\n**7. The docs told you to send a field no integration read.**\n\n**8. The plain-JS SDK didn't solve the proof-of-work.**\n\nThe React and Vue SDKs did.\n\nI gave each fix to a coding agent with a strict ticket. It had to:\n\nEvery agent came back saying it was done and all tests passed.\n\nI didn't accept a single \"done\" without checking. I read every diff, reran every proof of concept myself and wrote my own probes. **Three patches were wrong, and every one of them had passed its own tests.**\n\nThe agent's new header parser tried to be helpful. It treated header names written in other ways, such as `x_forwarded_for` or `http-x-forwarded-for`, as the real `X-Forwarded-For` header and merged their values.\n\nMy probe added one fake header next to the proxy's real one:\n\n``` php\nreal proxy header only           -> 203.0.113.5   (correct)\n+ \"http-x-forwarded-for: 9.9.9.9\" -> 9.9.9.9       (attacker wins)\n+ \"x_forwarded_for: 8.8.8.8\"      -> 8.8.8.8       (attacker wins)\n```\n\nThe agent's tests only covered the attacks from the original report. **It closed the reported hole and opened a new one right next to it.** In the second round, only the exact canonical header names are read.\n\nRust panics must never kill the Python worker. The agent switched the build from `abort` to `unwind` and wrapped every native call so that a `PanicException` falls back to Python.\n\nIts tests injected a fake `PanicException` class, and they passed. At runtime, though, the real class was never found, because the module the agent looked it up in isn't registered in `sys.modules`. **The code caught every exception except the one it was written for.**\n\n```\npyo3_runtime in sys.modules: False\nresolved PanicException: _NeverMatchingPanic\n```\n\nIn round two the Rust module exports the real type. A test now triggers a real panic and checks that the process survives.\n\nThe storage fix called three Rust functions \"if they exist\". None of them did, so the code did nothing at all. It also added a cache with no size limit. Neither problem would ever fail a test.\n\n💡 **Lesson:** an agent's test suite shows that the agent's idea of the bug is fixed. It doesn't show that the bug is fixed. Someone has to attack the fix with the same suspicion as the original code.\n\nEvery number below was measured on real people (the public SapiMouse dataset, 120 people, and the CMU keystroke dataset), except bot detection, which comes from synthetic generators.\n\n| Measurement | v0.11 | v0.12 | \n|---|---|---|\n| Real 3–10 point mouse movements blocked | 12.1% | **1.7%** | \n| Real 2 / 6 / 20 s sessions blocked | 2.3 / 0.97 / 0.46% | unchanged | \n| Real typing sessions blocked (CMU, 20,400) | 0.034% | unchanged | \n| Synthetic bots detected | 100% | 100% | \n| Rust feature extraction, 300 points | 592 µs | **136 µs** | \n\n**One measurement bug of my own.** An agent reported a small regression on 6-second windows. When I re-ran it, I got a third, different number. The cause was the benchmark itself: it reused the same database and IP addresses between runs, so session history from earlier runs leaked into later ones. With one isolated database per run, before and after were **identical**. The regression never existed, but I would have shipped a wrong number into the docs.\n\n**What still isn't good enough:** on the longest traces (300 points), the 95th-percentile latency is **1.22 ms**, over my 1 ms budget. The Rust part is now fast; the remaining time is in Python. That's the next release.\n\nThe client IP is now read **only** from the header you name:\n\n```\nSYNAPSE_PROXY_HEADER=x-forwarded-for   # default\nSYNAPSE_PROXY_HEADER=cf-connecting-ip  # behind Cloudflare: set this!\n```\n\nIf you run behind Cloudflare and don't set this, every visitor will look like a Cloudflare IP. That's why this release is 0.12.0, not a patch, and why both the startup log and `synapse-shield doctor` warn you about it.\n\n```\npip install -U \"synapse-shield[server]\"\nnpm install synapse-shield-react   # or synapse-shield-vue\n```\n\nThe React and Vue SDKs are on npm for the first time.\n\n👉 **GitHub:** [0xStoic-bit/Synapse_Shield](https://github.com/0xStoic-bit/Synapse_Shield)\n\nIf this was useful, a ⭐ on GitHub helps other developers find the project.", "url": "https://wpnews.pro/news/i-asked-two-ai-teams-to-break-my-bot-detector-they-found-8-holes-and-their-fixes", "canonical_source": "https://dev.to/0xstoic_bit/i-asked-two-ai-teams-to-break-my-bot-detector-they-found-8-holes-and-their-fixes-opened-3-new-f58", "published_at": "2026-11-22 20:28:22+00:00", "updated_at": "2026-11-22 20:41:45.509975+00:00", "lang": "en", "topics": ["ai-agents", "ai-safety", "ai-tools", "developer-tools", "artificial-intelligence"], "entities": ["Synapse Shield", "Claude", "Gemini", "Rust", "Python", "React", "Vue", "SQLite"], "also_reported_by": [], "takeaway": "Running the same code audit with two different models and only trusting issues both flag, then requiring a red-team agent to reproduce each claim with a working exploit, surfaced 8 confirmed vulnerabilities in Synapse Shield that are fixed in v0.12.0.", "recommendation": {"advice": "Require a working proof-of-concept exploit before accepting any agent-reported vulnerability, and manually review every agent-written security patch since three of eleven passed their own tests while remaining exploitable.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/i-asked-two-ai-teams-to-break-my-bot-detector-they-found-8-holes-and-their-fixes", "markdown": "https://wpnews.pro/news/i-asked-two-ai-teams-to-break-my-bot-detector-they-found-8-holes-and-their-fixes.md", "text": "https://wpnews.pro/news/i-asked-two-ai-teams-to-break-my-bot-detector-they-found-8-holes-and-their-fixes.txt", "jsonld": "https://wpnews.pro/news/i-asked-two-ai-teams-to-break-my-bot-detector-they-found-8-holes-and-their-fixes.jsonld"}}