Seatext library / BotRefund evidence

How to Implement CPU Concurrency Checks in Bot Detection

CPU concurrency checks detect bots by looking for mismatches between the reported number of CPU threads and what a real browsing session would produce. Implementation involves reading navigator.hardwareConcurrency, correlating it with other signals like...

Built for advertisers who need clear, refund-ready traffic evidence.

What CPU Concurrency Checks Measure

A CPU concurrency check uses the browser's navigator.hardwareConcurrency property to read the number of logical processor cores available to the page. In a normal browser, this value is stable and matches the device's actual hardware. An automated browser, a virtual machine, or a spoofed profile often claims a different core count than what the surrounding signals indicate.

This check is not about counting cores alone. It's about consistency. As the BotRefund detection page explains, the check looks for "a mismatch that a real browsing session does not normally create." For example, a bot may report 8 cores while its graphics or audio behavior reflects a weak virtual machine. That mismatch is the signal.

The concept is simple: a real device has a coherent set of hardware properties. A CPU with 8 threads usually pairs with a mid-range or high-end GPU, a certain memory size, and a display resolution that fits the market segment. A bot that spoofs the CPU number but leaves other values untouched creates an internal contradiction. The more contradictions you find, the higher the probability of automation.

BotRefund lists this as one of 106 independent checks. That means it is a single piece of evidence, not a rule. The check adds one objective fact about the visit. The final decision comes from a model that weighs all facts together.

Prerequisites for a Reliable Check

Before you code anything, understand these requirements:

  • You need access to client-side JavaScript. The check runs in the user's browser, so you cannot do it server-side only.
  • You must test against realistic bot traffic. Tools like Puppeteer, Playwright, and Selenium are common, but they are not the only threat. Modern bots use residential proxies and AI-generated behavior, as described in BotRefund's ad fraud trends report. Your test set should include these advanced bots.
  • You need a scoring system. A single anomaly is not enough to call something a bot. You must combine CPU concurrency with independent browser, network, and behavior signals. A weighted model, rather than a boolean rule, reduces false positives.
  • You need to handle false positives. Privacy tools, corporate networks, virtual private networks, and unusual devices can produce unexpected values for real people. For example, a user on a remote desktop may show a concurrency value that does not match the local GPU. Your model must tolerate these cases.
  • You need a logging and analytics pipeline. You should record the raw value and the computed score for every visit. This allows you to analyze false positives and adapt your model over time.
  • You need to consider privacy regulations. Collecting hardware data may require consent under GDPR or CCPA. Ensure your implementation complies with your legal obligations.

Step-by-Step Implementation

  1. Read the hardware concurrency value. Use navigator.hardwareConcurrency in your client-side script. Store the integer value. Most modern browsers return a number between 2 and 16, but it can be higher. Do not assume a range for humans. Some powerful desktops report 32 or 64 logical processors.
  2. Collect additional hardware signals. Pull other indicators at the same time: navigator.deviceMemory (if available), WebGL renderer info, screen resolution, and platform. These create a hardware fingerprint. Also read navigator.platform, navigator.languages, and the user-agent string. The goal is to have enough context to judge whether the concurrency value is plausible.
  3. Measure timing consistency. Use performance.now() to record the time taken for a short synchronous loop. Real browsers show small natural variations; virtual machines and certain emulators often produce more uniform timings. Do not rely on this alone. Timing is noisy and depends on system load.
  4. Compare the concurrency value with the rest of the fingerprint. For each visit, ask: does an 8-core CPU make sense alongside this GPU model and this memory value? A mismatch is a red flag. For instance, a low-end ARM device should not report 16 cores. A cheap Android phone with 2GB RAM should not claim 12 threads.
  5. Build a score, not a boolean. Assign a weight to the concurrency mismatch. Combine it with other evidence: behavior signals like mouse movement, click timing, and scroll patterns. Also include network signals like IP reputation and TLS fingerprint. The final score should be a continuous value. If too many mismatches appear together, flag the visit as high risk.
  6. Test against real and bot sessions. Run your check on a sample of genuine traffic from different devices and browsers. Then simulate bots using headless browsers and spoofing tools. Record the false positive and false negative rates. Use a holdout set to avoid overfitting.
  7. Verify with a controlled experiment. Change one variable at a time. For example, set a bot's hardwareConcurrency to match its real environment, then see if other signals still catch it. This tells you how much the concurrency check adds to the overall model. Repeat for each signal to measure its contribution.
  8. Deploy with a fallback and monitoring. Once the model is live, monitor its predictions. Set up alerts for sudden changes in the distribution of concurrency values. A spike in unusual values might indicate a new bot technique or a browser update.

Key Facts

FactDetails
What the check doesLooks for a mismatch between the CPU concurrency a browser reports and what a real browsing session would produce.
Signal typeIndependent evidence, one of many checks that contribute to a larger prediction.
Not a verdict aloneA single anomaly is not a bot verdict; it must be cross-checked against browser, network, device, and behavior data.
False positive causesPrivacy tools, travel, corporate networks, and unusual devices can produce unexpected behavior for genuine people.
Accuracy sourceAccuracy comes from corroboration across many signals, not one browser tell.
Implementation costClient-side code is free, but maintenance and model updates require ongoing effort.
Common spoofingBots can override the property, but they often leave other hardware mismatches.
Impact on ad spendBot clicks can steal up to 20% of Google and Meta ad budget, according to BotRefund's homepage.

Common Mistakes and Limitations

Treating the check as a stand-alone verdict. The most common mistake is to block a user because their hardwareConcurrency value is unusual. Real users can have atypical values. You must combine this signal with other evidence.

Ignoring headless browser adaptations. Modern bots can spoof hardwareConcurrency. They can also run in real browsers with real values. If you rely only on the number, you will miss them. That is why the mismatch approach matters.

Assuming a specific range. Some checks try to reject values above a threshold like 8 cores. This will incorrectly flag high-end machines, cloud desktops, and gaming laptops.

Not testing across environments. A check that works on Chrome may behave differently on Firefox, Safari, or mobile browsers. Always test on multiple browsers and devices.

Overlooking privacy tools. Browser extensions like privacy shields can alter hardware values or return fake ones. These are genuine users. Your model must account for them.

Using timing measurements carelessly. CPU timing can vary with load, background tabs, and virtualization. It is noisy. Use it as a weak signal, not a decisive one.

Forgetting to update the model. Bot techniques evolve. A static list of thresholds becomes stale. You need a feedback loop that retrains the model on new data.

Ignoring network and behavior context. CPU concurrency only makes sense when paired with other facts. For example, a mismatch might be normal for a user on a remote desktop or a virtual desktop infrastructure (VDI). Your model should consider the entire session.

Terminology: Threads, Cores, and Concurrency

CPU core: A physical or virtual processing unit

Thread: A sequence of instructions that a core can execute. Modern CPUs often use simultaneous multithreading to handle two threads per core.

hardwareConcurrency: A browser API that reports the number of logical processor cores (threads) available to the page. It is often equivalent to the number of logical processors, not physical cores.

Fingerprint: A collection of device and browser properties that can identify a visitor with high probability.

Concurrency mismatch: A situation where the reported hardware concurrency does not align with other hardware details, such as GPU model, memory, or behavior.

Logical processor: The number of independent threads a CPU can run simultaneously. For example, a quad-core CPU with hyper-threading has 8 logical processors.

Headless browser: A browser without a graphical interface, often used for automation. Examples include Puppeteer, Playwright, and Selenium.

Spoofing: The practice of overriding browser properties to misrepresent the device or environment.

Behavioral signal: Evidence based on user actions, such as mouse movement, scrolling, and typing patterns.

Network signal: Evidence derived from the IP address, TLS handshake, and request headers.

Integrating with Other Bot Detection Signals

CPU concurrency works best when combined with other independent checks. BotRefund uses 106 checks. Some of the most useful partners for CPU concurrency are:

  • Behavioral interactions like mouse movement and click timing. Bots often produce linear paths or superhuman speeds. BotRefund's Impossible Tab Speed check looks for mismatches in tab-switching speed that no human could achieve.
  • Window tampering like the window.open Tamper check, which detects scripts that override window.open for malicious purposes.
  • Network signals such as IP reputation and TLS fingerprint. A residential proxy might have a legitimate IP, but the TLS fingerprint could be from a data center.
  • Timing fingerprints using performance.now() to detect unusual consistency or unrealistic event intervals.

The idea is to look for corroboration. A single anomaly is weak. Two or three independent anomalies create a strong case. For example, a bot might spoof hardwareConcurrency to 8, but its mouse movements are perfectly straight and its tab switching is instant. That combination is almost certainly automated.

When you design your scoring model, assign weights to each signal based on its discriminative power. Use a machine learning classifier if you have labeled data. Otherwise, start with a weighted sum and tune it manually.

Remember that the cost of a false positive is high. Blocking a real user can lose a sale or damage your brand. A conservative model is often better than an aggressive one, especially if you rely on advertising revenue.

Frequently Asked Questions

Is CPU concurrency a reliable bot signal?

By itself, no. It is a useful piece of evidence when combined with other signals. A mismatch between concurrency and other hardware or behavior data raises suspicion, but it does not prove automation.

How do bots spoof hardwareConcurrency?

Many browser automation tools and anti-detection frameworks override the property to return a fixed value. Some even mimic real device profiles. The check works best when you look for inconsistencies rather than a specific number.

What should I do when I detect a mismatch?

Do not block immediately. Add the signal to a scoring model that weighs it alongside click behavior, timing patterns, network data, and other device signals. Only flag the visit as high risk when multiple independent checks agree.

Can I implement this without a third-party service?

Yes, you can build your own client-side script and scoring logic. However, you will need to continuously update your model to keep up with new automation techniques. A managed service like BotRefund runs over a hundred signals and uses AI to combine them.

How much does a CPU concurrency check cost?

If you build it yourself, the code is free. The cost comes from ongoing maintenance, false positives, and missed bots that drain your ad budget. Managed services usually charge based on traffic volume.

What are the consequences of ignoring this check?

Bots may slip through and inflate your conversion data, waste ad spend, and skew your analytics. In paid advertising, bot clicks can steal a significant portion of your Google and Meta ad budget.

How does this check relate to general fingerprinting?

CPU concurrency is one attribute in a device fingerprint. Fingerprinting uses many such attributes to identify a visitor. The CPU concurrency lie is a specific pattern that emerges when a bot fakes one attribute but not others.

What if a legitimate user is on a remote desktop or VM?

Remote desktops and VMs can produce mismatches. For example, a user on a thin client may report the server's CPU concurrency, while the GPU reflects a different machine. Your model should treat these as lower confidence and rely on other signals like network and behavior.

Further reading and comparison sources

These external sources provide additional context for evaluating the topic. Their inclusion is not an endorsement.

Further reading and comparison sources

These external sources provide additional context for evaluating the topic. Their inclusion is not an endorsement.

Learn more

Visit the website for more information.

Learn more