User Agents

Web browsers and everyday web tech, explained

How Cloudflare Detects Bots with TLS, HTTP/2, Browser Signals

· 5 min read · Browsers

In this article
  1. Background: The Rise of Bot Traffic
  2. How Cloudflare Analyzes TLS Fingerprints
  3. HTTP/2 Protocol Behavior Analysis
  4. Browser Fingerprinting and JavaScript Signals
  5. Turnstile: Invisible and Non-Intrusive Challenges
  6. Integration and Risk Scoring
  7. Frequently Asked Questions

Cloudflare detects bots by analyzing TLS fingerprints, HTTP/2 behavior, browser signals, and Turnstile challenges to distinguish automated scripts from real users. These techniques combine network-level inspection with client-side behavioral analysis to identify and block malicious automation while minimizing friction for legitimate traffic.

Background: The Rise of Bot Traffic

Bot traffic has become a dominant force on the internet, with estimates suggesting that over half of all web traffic originates from non-human sources. While some bots are beneficial — like search engine crawlers — many are malicious, used for credential stuffing, scraping, DDoS attacks, inventory hoarding, and account creation fraud. Traditional bot detection methods, such as IP reputation and rate limiting, are no longer sufficient due to the sophistication of modern bots that mimic real users. This has led companies like Cloudflare to develop more advanced, multi-layered detection systems.

How Cloudflare Analyzes TLS Fingerprints

Transport Layer Security (TLS) is the cryptographic protocol used to secure HTTPS connections. Every browser and client that connects to a website sends a "TLS handshake" that includes specific parameters, such as cipher suites, extensions, and order preferences. Cloudflare analyzes these handshake patterns — known as TLS fingerprints — to detect anomalies.

Legitimate browsers like Chrome, Firefox, and Safari have consistent, well-documented TLS behaviors. Bots, especially those built with scripting tools like Python’s requests library or headless browsers with misconfigurations, often send irregular or non-standard TLS handshakes. For example:

  • A real Chrome browser includes specific extensions like supported_versions and key_share in a defined order.
  • A bot using a generic TLS library might omit these or list them out of order.
  • Some bots use outdated cipher suites not supported by modern browsers.

Cloudflare maintains a database of known-good TLS fingerprints for real browsers and compares incoming connections against it. Deviations trigger further scrutiny or immediate blocking, depending on risk level.

HTTP/2 Protocol Behavior Analysis

HTTP/2 improves performance by enabling multiplexing, header compression, and server push. However, it also introduces new signals for bot detection. Cloudflare monitors how clients implement HTTP/2 to identify non-standard behavior.

Real browsers adhere closely to the HTTP/2 specification, while bots often implement only partial or incorrect versions. Key signals include:

  • Frame ordering and types: Browsers send specific frame sequences (HEADERS, SETTINGS, PRIORITY). Bots may send malformed frames or in unexpected order.
  • Stream concurrency: Real browsers open multiple streams efficiently. Bots might open too many too quickly or use incorrect stream IDs.
  • Header compression (HPACK): Misuse or absence of proper HPACK encoding is a red flag.
  • Connection reuse: Browsers reuse HTTP/2 connections. Bots often open and close connections rapidly.

For example, a bot scraping a site might open hundreds of streams in a single connection but fail to handle flow control properly, leading to detectable errors. Cloudflare’s edge servers observe these patterns in real time and score the likelihood of automation.

Browser Fingerprinting and JavaScript Signals

Cloudflare collects dozens of browser-level signals through lightweight JavaScript challenges and client-side probes. These are served to suspicious visitors without disrupting user experience for most.

Signals include:

  • User agent consistency: Does the reported browser match the TLS and HTTP/2 behavior?
  • Canvas and WebGL fingerprints: Rendering output varies slightly across devices and GPU drivers.
  • Font enumeration: Which fonts are available? Headless browsers often lack system fonts.
  • Plugin and MIME type lists: Real browsers report standard plugins; bots may report none or fake ones.
  • WebRTC behavior: How does the client handle peer-to-peer networking?
  • Touch support and device memory: Mobile bots may incorrectly report desktop capabilities.

These signals are combined into a behavioral score. A mismatch — such as a "Chrome 120" user agent with no canvas support — strongly indicates a bot. Cloudflare uses machine learning models trained on billions of requests to weigh these signals dynamically.

Turnstile: Invisible and Non-Intrusive Challenges

Turnstile is Cloudflare’s modern replacement for CAPTCHA. Unlike traditional CAPTCHAs that require solving puzzles, Turnstile operates invisibly in most cases, analyzing browser behavior during page load.

When a request appears suspicious, Cloudflare serves a Turnstile challenge. The visitor may see a simple checkbox or nothing at all. Behind the scenes, Turnstile runs a series of checks:

  1. Loads a lightweight script that measures browser execution environment.
  2. Analyzes timing, DOM access patterns, and JavaScript object consistency.
  3. Validates proof of a real rendering engine (e.g., Blink or WebKit).
  4. Generates a cryptographic token indicating "human likelihood."
  5. Submits the token to Cloudflare for verification.

Turnstile is designed to be privacy-preserving: it does not track users across sites and does not require personal information. It blocks headless browsers like Puppeteer or Selenium unless they are specifically configured to evade detection — which itself becomes a detectable pattern.

Integration and Risk Scoring

Cloudflare combines all these signals — TLS, HTTP/2, browser fingerprints, and Turnstile responses — into a unified risk score for each request. This score determines whether to:

  • Allow the request silently,
  • Challenge with Turnstile,
  • Rate limit,
  • Or block outright.

The system is adaptive: a single anomaly may not trigger a block, but multiple red flags increase the score rapidly. For example, a request with an unusual TLS fingerprint, no HTTP/2 stream reuse, and a missing canvas API might be challenged immediately. Cloudflare’s machine learning models are updated continuously based on global threat intelligence, allowing it to detect new bot patterns quickly.

Frequently Asked Questions

Can Cloudflare block legitimate bots like search engines?

Cloudflare is designed to allow known good bots like Googlebot, Bingbot, and others by recognizing their IPs and user agents. Site owners can also configure allowlists for specific crawlers. Legitimate bots that follow robots.txt and use standard TLS/browser behavior are typically not challenged.

Does Turnstile collect personal data?

No, Turnstile does not collect personally identifiable information. It analyzes browser behavior and environment characteristics to assess automation risk, but does not track users across websites or store personal data.

Can bots bypass Cloudflare’s detection?

Advanced bots using real browser instances (e.g., through Puppeteer with stealth plugins) can sometimes bypass initial detection. However, Cloudflare continuously updates its models to detect such tools based on subtle inconsistencies in timing, rendering, or protocol use. Sustained bypass is difficult and often short-lived.

Is Turnstile the same as reCAPTCHA?

No, Turnstile is Cloudflare’s own system, designed to be more privacy-friendly and less intrusive than reCAPTCHA. Unlike reCAPTCHA, Turnstile does not rely on Google’s infrastructure or user profiling.

How does Cloudflare handle false positives?

False positives are minimized through adaptive scoring and whitelisting. If a legitimate user is challenged, completing a Turnstile check usually resolves it. Site owners can adjust sensitivity levels and review logs to fine-tune protection.

Do I need to enable Turnstile manually?

Turnstile can be enabled automatically via Cloudflare’s bot management settings. Site administrators can choose between different modes — such as "Managed" (automatic) or "Learning" — depending on their traffic and risk profile.