Cloudflare Bot Management File Outage
A database permissions change doubled a bot-detection file past a hard limit, and Cloudflare's proxies crashed worldwide.
- Severity
- History books
- Difficulty
- intermediate
- Companies
- Cloudflare
- Tech
- ClickHouse, Rust, CDN, Machine learning, Configuration files
- Root cause
- config pushed globally, latent bug
The story
Quick (1 min)
On 18 November 2025, websites behind Cloudflare showed error pages around the world for about three hours, with knock-on problems until the evening (UTC).
Cloudflare's bot detection uses a "feature file" listing the signals its machine learning model checks. That file is rebuilt every few minutes from a database and sent to every server. A change to database permissions made the query that builds the file return duplicate rows, so the file doubled in size.
The proxy software had a hard limit on how many features it could load. The bigger file went over that limit and the software crashed instead of ignoring the bad file. Because the file was copied everywhere, the crash happened everywhere.
It was confusing at first: the network kept failing and recovering, and Cloudflare's separately hosted status page went down by coincidence, so the team suspected a huge attack.
The lesson: treat your own generated config like untrusted input, and never crash on a bad file. Keep the last good one.
Keep reading to the end to earn XP.Read. XP earned.
Engineer (2 min)
The pipeline. Requests flow through Cloudflare's core proxy (FL, being migrated to FL2, written in Rust). One module, Bot Management, scores every request with an ML model that takes a feature configuration file as input. The file is regenerated every five minutes by a query on a ClickHouse cluster and pushed to the whole network.
The permissions change (11:05 UTC). To run distributed subqueries under each user's own account, Cloudflare made users' implicit access to the underlying r0 tables explicit. Now metadata queries also returned columns from r0. The feature-file query read system.columns for table = 'http_requests_features' without filtering by database, so it started returning duplicate columns and the file doubled.
The limit and the panic. For performance, the module preallocates memory and caps features at 200 (normal use was about 60). The doubled file exceeded 200. The FL2 code handled that error with .unwrap(), which panics: thread fl2_worker_thread panicked: called Result::unwrap() on an Err value. Panicking workers meant HTTP 5xx. On the old FL proxy, requests didn't fail, but every request got a bot score of zero, so customers blocking bots saw false positives.
Why it flickered. The permissions change was rolling out gradually across ClickHouse nodes. Every five minutes the query might run on an updated node (bad file) or not (good file), so the network failed and recovered repeatedly. Combined with the status page outage, that pointed people toward a DDoS.
Recovery. Workers KV and Access were bypassed to an older proxy version at 13:05. New file generation was stopped and a known-good file inserted at 14:24. Core traffic was largely normal by 14:30, and everything by 17:06.
Interview takeaway: validate internal config like user input, fail open to the last good version, and don't unwrap() on the hot path.
Keep reading to the end to earn XP.Read. XP earned.
Deep dive (2 min)
Timeline (UTC, from Cloudflare's postmortem)
- 11:05: database access control change deployed (explicit grants on
r0tables, rolled out gradually). - 11:20–11:28: failures begin. The timeline lists 11:28 as impact start, when "first errors observed on customer HTTP traffic."
- 11:31: first automated test detects the issue. 11:32: manual investigation. 11:35: incident call created.
- 11:32–13:05: the team chases elevated Workers KV errors, trying traffic manipulation and account limiting. The 5xx graph flickers as good and bad files alternate. The status page, hosted entirely off Cloudflare, goes down by coincidence, raising fears of an attack like recent high-volume "Aisuru" DDoS events.
- 13:05: Workers KV and Access are bypassed to a prior proxy version, reducing impact.
- 13:37: work focuses on rolling back to a last-known-good Bot Management file.
- 14:24: automatic creation and propagation of new feature files stopped. A test of the old file succeeds.
- 14:30: a correct file is deployed globally. Main impact resolved.
- 17:06: all downstream services restarted and fully restored.
Services affected
- Core CDN and security: HTTP 5xx error pages for visitors.
- Turnstile: failed to load, so most users couldn't log into the Cloudflare Dashboard.
- Workers KV: elevated 5xx because its gateway depends on the core proxy.
- Access: widespread authentication failures until 13:05 (existing sessions unaffected).
- Email Security: reduced spam-detection accuracy for a time; no critical customer impact observed.
- CDN latency also rose, because debugging and observability systems consumed lots of CPU enhancing uncaught errors.
Not an attack
"The issue was not caused, directly or indirectly, by a cyber attack or malicious activity of any kind."
Remediation Cloudflare announced
- Harden ingestion of Cloudflare-generated configuration files "in the same way we would for user-generated input."
- Enable more global kill switches for features.
- Stop core dumps and error reports from overwhelming system resources.
- Review failure modes for error conditions across all core proxy modules.
Keep reading to the end to earn XP.Read. XP earned.
Failure replay
Step by step, what broke and what it hit next. Showing the key steps. Switch to Engineer or Deep dive for every step.
- 11:05ClickHouse permissionshealthy
A permissions change makes users' access to underlying r0 tables explicit, rolled out node by node.
Affects: Feature file job
- Every 5 minFeature file jobfailing
The metadata query doesn't filter by database, so updated nodes return duplicate columns and the file doubles.
Affects: Core proxies
- 11:20–11:28Core proxiesdown
The file exceeds the 200-feature limit. FL2 calls unwrap() on the error and panics, returning 5xx.
Affects: Visitors, Workers KV and Access
- 11:28+Visitorsdown
Sites behind Cloudflare show error pages. Turnstile fails, so Dashboard logins fail too.
- 11:32–13:05Core proxiesdegraded
Good and bad files alternate every five minutes, so the network flickers. A coincidental status page outage suggests an attack.
- 13:05Workers KV and Accessrecovering
Both are switched to an older proxy version, reducing their impact.
- 14:24Feature file jobrecovering
New file generation is stopped and a known-good file is inserted into the distribution queue.
Affects: Core proxies
- 14:30Core proxiesrecovering
The good file is live globally and the core proxy restarts. Main impact resolved.
Affects: Visitors
- 17:06Visitorshealthy
The remaining services are restarted. All systems are normal.
Impact
- Who was affected
- Visitors to Cloudflare-proxied sites worldwide, plus Turnstile, Workers KV, Access, Dashboard logins and Email Security features; customers on the older FL proxy got zero bot scores.
- How long
- Main impact about 3 hours (~11:28 to 14:30 UTC); all services restored at 17:06 UTC.
- Cost
- not disclosed
Lessons
- Validate internally generated config as strictly as user input; size and shape checks catch doubled files.
- On bad config, keep running with the last known good version instead of crashing.
- Avoid unwrap or panic on hot paths; handle errors explicitly.
- Queries over metadata should be fully qualified (filter by database), or permission changes can alter results.
- Intermittent failure plus coincidences can mislead responders; follow the data, not the story.
Quiz
What made the feature file double in size?
The answer is A database permissions change made a metadata query return duplicate columns from another database. The query didn't filter by database name, so once r0 tables became visible it returned duplicates.
Check answer
A database permissions change made a metadata query return duplicate columns from another database. The query didn't filter by database name, so once r0 tables became visible it returned duplicates.
Why did the proxy return 5xx errors instead of skipping the bad file?
The answer is The file exceeded a 200-feature limit and the Rust code called unwrap() on the error, causing a panic. The FL2 code panicked with "called Result::unwrap() on an Err value", failing requests that depended on the bots module.
Check answer
The file exceeded a 200-feature limit and the Rust code called unwrap() on the error, causing a panic. The FL2 code panicked with "called Result::unwrap() on an Err value", failing requests that depended on the bots module.
Why did the network keep failing and recovering at first?
The answer is The file was regenerated every five minutes and was only bad when the query ran on an updated ClickHouse node. The permissions change was rolling out gradually, so good and bad files alternated until every node produced bad ones.
Check answer
The file was regenerated every five minutes and was only bad when the query ran on an updated ClickHouse node. The permissions change was rolling out gradually, so good and bad files alternated until every node produced bad ones.
Which remediation did Cloudflare list first?
The answer is Harden ingestion of Cloudflare-generated config files the same way as user-generated input. Cloudflare said it would treat its own generated config like user input and add more global kill switches.
Check answer
Harden ingestion of Cloudflare-generated config files the same way as user-generated input. Cloudflare said it would treat its own generated config like user input and add more global kill switches.
Interview prep
Try answering out loud before you open the model answer.
- system design
A pipeline regenerates a config file every few minutes and pushes it to every server. How would you design it so a bad file can't take down the fleet?
Show model answer
Validate at generation and again at load: schema, row counts, size and duplicate checks against expected ranges. Stage distribution with a canary set and automatic halt if error rates rise. On the consumer side, never crash on a bad file. Reject it, keep serving with the last known good version, and alert. Keep a global kill switch to freeze distribution and pin a known-good file. Make generation queries robust (fully qualified names) and test them against permission changes. Cloudflare's fix list matches: harden ingestion of internal config like user input and add kill switches.
A strong answer hits:
- Validation at generation and at load
- Staged distribution with automatic halt
- Fail safe to last known good config
- Global kill switch and pinning
How did your answer compare? - debugging
Your service fails, recovers, then fails again every few minutes. How do you reason about the cause?
Show model answer
A periodic pattern suggests something periodic: a scheduled job, cache expiry, config refresh, or a partial rollout where some nodes behave differently. At Cloudflare, the file was regenerated every five minutes, and whether it was bad depended on which ClickHouse node ran the query during a gradual permissions rollout. Correlate failure onsets with job schedules and recent changes, check whether outputs differ between runs, and freeze the periodic process to see if the pattern stops. Don't let coincidences like a status page outage push you toward the attack theory without evidence.
A strong answer hits:
- Periodic symptoms mean look for periodic processes
- Partial rollouts produce mixed good and bad outputs
- Freeze the suspected process to test the theory
- Beware confirmation bias from coincidences
How did your answer compare? - system design
The Bot Management module had a fixed 200-feature limit for memory preallocation. Was the limit itself the mistake?
Show model answer
No. Limits are good: they bound memory and keep performance predictable, and 200 was well above the ~60 in use. The mistake was the failure mode. Exceeding the limit caused a panic that took down request handling, rather than rejecting the file and keeping the previous one. Good design keeps the limit, validates against it before loading, emits an alert, and degrades gracefully. Bot scoring being stale for a few minutes is far better than returning 5xx to everyone.
A strong answer hits:
- Limits are healthy for memory and performance
- The failure mode (panic) was the problem
- Validate before load and keep the previous version
- Graceful degradation over hard failure
How did your answer compare?
Go deeper
- Official postmortemCloudflare outage on November 18, 2025Cloudflare Blog, link checked 2026-11-25