Cloudflare Opens Client-Side Security to All, AI Detection Cuts False Positives 200x
Client-side attacks have a boring superpower: they steal data without breaking anything. The page still loads, checkout still completes, and all it takes is one malicious script tag. In January 2026 Sansec reported a browser keylogger on an employee merchandise store of a major U.S. bank harvesting personal data, credentials, and credit card information. In September 2025, malicious npm package releases exposed countless front-end apps to crypto-stealing in the browser.
For ordinary visitors these attacks are nearly invisible: the script runs quietly during page load, collects form input, reads and writes cookies, hijacks redirects, and can even exfiltrate session tokens to third-party domains after you log in. The Magecart attacks that swept major media in 2019 are still the textbook case — attackers breached a third-party supplier of e-commerce sites, injected scripts into checkout pages, and harvested hundreds of thousands of card records within a month. This kind of supply-chain client-side attack is exactly what a product like Client-Side Security exists to stop.
In March 2026 Cloudflare responded by making Client-Side Security Advanced available to self-serve users and giving domain-based threat intelligence away to all customers.
The Core Challenge of Client-Side Security
Cloudflare's client-side security assesses about 3.5 billion scripts per day, with roughly 2,200 unique scripts per enterprise zone. The hard part is not volume but volatility: about a third of scripts update their code within any 30-day window. Manually approving every new DOM interaction or outbound connection would paralyze the development pipeline.
Detection therefore focuses on what a script is trying to do, analyzing the Abstract Syntax Tree (AST) to identify malicious intent patterns regardless of obfuscation.
A GNN + LLM Cascade
The frontline engine is a Graph Neural Network (GNN) that learns structural representations on the JavaScript AST, generalizing across variable renaming, minification, and obfuscation. Tuned for high recall to catch zero-days, its false-positive rate is already under 0.3%, but at 3.5 billion scripts per day that still means disruptive noise.
The fix is a cascading architecture with an LLM as a second opinion:
- Every script is first evaluated by the GNN; benign predictions terminate immediately at minimal latency for the vast majority of traffic.
- Scripts flagged as potentially malicious go to an open-source LLM hosted on Workers AI (currently gpt-oss-120b) for semantic analysis.
- If the LLM decides the script is benign, it overrides the GNN verdict.
The results are dramatic: the overall false-positive rate drops from about 0.3% to 0.1% (roughly 3x), while per unique script it falls from 1.39% to 0.007% (roughly 200x), removing millions of false alarms per day. Because the LLM acts as a reliable precision filter, the GNN threshold can be lowered to catch even more novel attacks.
Real-World Catch: The core.js Router Hijack
The architecture already caught a zero-day in the wild: a heavily obfuscated core.js script injected through compromised browser extensions, targeting Xiaomi OpenWrt routers. It queried the router's WAN config, overwrote DNS settings to route traffic through public DNS servers, and even tried to lock out the owner by changing the admin password. Traditional platforms like VirusTotal had not yet detected it, but the GNN pierced the obfuscation and the LLM confirmed the intent.
Comparing Detection Approaches
| Approach | How It Works | Strength | Limitation |
|---|---|---|---|
| Rules / blocklists | Match known malicious signatures and domains | Catches known attacks | Misses variants and obfuscation |
| Static analysis / AST | Parse code structure for suspicious patterns | Captures logic features | Higher false positives |
| GNN | Learns structural representations on the AST | Generalizes renaming and obfuscation | Needs lots of labeled samples |
| LLM semantic analysis | Understands code intent | Precisely judges complex samples | Higher latency and cost |
These four approaches are not mutually exclusive; they layer on top of each other. Rules catch known attacks, AST and GNN surface unknown patterns, and the LLM pushes precision highest. Cloudflare's cascade is exactly that division of labor: high recall and high precision handled separately — one makes sure nothing is missed, the other makes sure operators are not flooded.
Steps to Enable Client-Side Security
For a site on Cloudflare, enabling it roughly takes four steps:
- In the Cloudflare dashboard, go to Security → Client-Side Security and add the domains and scripts you want to monitor.
- Run in "observe only" mode for one to two weeks first to collect a baseline of which third-party scripts normally load.
- Once alerts look clean, switch to "block" or "report" mode.
- Route alerts to Slack, email, or a webhook and schedule a weekly review.
One caveat: client-side security only protects pages proxied through Cloudflare. Traffic that bypasses Cloudflare to reach your origin directly is not inspected and needs separate handling. Treat it as a front-end supply-chain health check rather than a set-and-forget switch to get the most value.
What It Means for Websites
Client-side security is often the weakest link for small and medium sites. Start with the basics: harden response headers with security headers configuration, and follow the website security checklist and website security best practices. More content is in the Security Hardening category.
Reference: Cloudflare Client-Side Security docs https://developers.cloudflare.com/client-side-security/
Source: https://blog.cloudflare.com/client-side-security-open-to-everyone/
16IDC Takeaway
Client-side security has long been a blind spot for small and mid-size sites: however tightly the server is hardened, one malicious script injected into the front end leaks user data just the same. What matters about this opening-up is that domain-based threat intelligence is no longer reserved for large enterprises; any site hosted on Cloudflare can get the key signals with one switch. For builders, relying on platform capability is not enough — build a front-end supply chain mindset: pin versions, verify integrity, restrict where third-party scripts come from, and regularly check whether every script a page loads is actually necessary. Security is a layered defence, and platform AI detection is only one layer.
Configuration & Integration Examples
Example 1: Snapshot third-party scripts to build a baseline
# Extract the host of every external script and keep a deduplicated daily baseline
curl -sS "https://www.example.com/checkout" \
-H "User-Agent: $SITE_AUDIT_UA" \
| grep -oE '<script[^>]+src="[^"]+"' \
| grep -oE 'src="[^"]+"' | sed 's/src="//;s/"$//' \
| awk -F/ '{print $3}' | sort -u > "baseline_$(date +%F).txt"
# Diff against the previous baseline; only new third-party hosts are printed
diff "baseline_$(date -v-1d +%F).txt" "baseline_$(date +%F).txt" \
| grep '^>' | sed 's/^> //'
Keeping a daily script-host baseline and diffing it turns "which script appeared today" into a single line of output, far cheaper than reconstructing it from logs afterwards.
Example 2: Collect suspicious loads with CSP reporting
# 1. Ship the policy in report-only mode first; nothing is blocked yet
# Content-Security-Policy-Report-Only: script-src 'self'; report-uri /csp-report
# 2. Accept reports in nginx and log them as JSON
# location /csp-report { access_log /var/log/nginx/csp.log json; return 204; }
# 3. Aggregate blocked hosts to find the most frequent offenders
awk -F'"' '/blocked-uri/{for(i=1;i<=NF;i++) if($i ~ /^https?:/) print $i}' \
/var/log/nginx/csp.log \
| awk -F/ '{print $3}' | sort | uniq -c | sort -rn | head -10
Run report-only for a week and review the violations before enforcing, or the checkout flow is likely to break on a script nobody remembered was there.
Limitations
- This article reflects public information as of 2026-08-05; terms, prices and quotas follow the provider's current published terms.
- Third-party capability and limit statements follow their official documentation; no further commitment is implied here.
- Licensing, filing and data-residency decisions must be verified against the regulations of your operating region.
FAQ
Is the 0.1% false-positive rate measured per domain?
Both ways, and the two differ by three orders of magnitude. Per domain it fell from about 0.3% to about 0.1%; per individual script it fell from 1.39% to 0.007%, across roughly 3.5 billion scripts a day. Boundary: quote which basis you mean, because one product can report numbers 200x apart.
How long should you observe before blocking scripts?
One to two weeks. Run in monitor-only mode to establish which third-party scripts normally load, then switch to block or report, and route alerts into Slack, email or a webhook for a weekly review. Boundary: on a checkout page that changes often, re-baseline monthly or new scripts read as false positives.
Why are pages that bypass the proxy unscanned?
Detection only happens on the Cloudflare proxy path. Pages that connect straight to the origin never pass through script evaluation and never raise an alert, so move the whole hostname behind the proxy and confirm no grey-cloud records remain. Boundary: direct-to-origin APIs still need CSP plus integrity checks at the application layer.
Will report-only CSP harm existing checkout scripts?
No, report-only reports without blocking. Run it for 1 week, aggregate blocked-uri values by domain to see the suspicious loads, and only then switch to enforcement; going straight to enforcement is what breaks a payment flow. Boundary: if your own scripts appear in the reports, whitelist them first.
Related Providers
- Cloudflare Security: Use it when a site already on Cloudflare needs client-side script monitoring switched on.
- Akamai Security: Use it when third-party script blocking must share one policy with edge rules.
- Imperva: Use it when a checkout page needs separate script integrity verification.
Community & Resources
Official docs and communities
- Page Shield documentation — client-side script monitoring, change alerts, and dependency listings.
- WAF detections — traffic detection mechanisms that complement client-side alerts.
- Cloudflare Blog — analyses of client-side and supply-chain attacks.
- Cloudflare Community — practical Q&A on script approval and false positives.
Learning resources and tools
- Cloudflare API documentation — toggle security features and read configuration in bulk.
- Terraform Provider — manage security policy as versioned infrastructure.
- Cloudflare support docs — feature availability and plan differences.
- Cloudflare developer docs home — the hub for combining this with other security features.
Original source: Cloudflare Blog ↗