Self-hosted browser fingerprinting and bot detection with real-world constraints in mind.
Self-hosted browser fingerprinting and bot detection with real-world constraints in mind.
News: After more than 7 years without any updates, the first release of the new FPScanner is here. This version combines fingerprinting and bot detection in a single library. Try the live demo at fpscanner.com. Expect new fingerprinting signals and more detection logic over time.
This project is sponsored by Castle.
This library focuses on self-hosted fingerprinting and bot detection primitives. In real-world fraud and bot prevention, teams often need additional capabilities such as traffic observability, historical analysis, rule iteration, and correlation across device, network, and behavioral signals.
Castle provides a production-grade platform for bot and fraud detection, designed to operate at scale and handle these operational challenges end to end.
For a deeper explanation of what this library intentionally does not cover, see the “Limits and non-goals” section at the end of this README.
A lightweight browser fingerprinting library for bot detection.
Scraping has become mainstream. AI and LLM-driven companies now crawl the web at a scale that was previously limited to specialized actors, often without clearly respecting robots.txt or rate limits. At the same time, fraudsters do not need to rely solely on public frameworks like OpenBullet or generic automation stacks anymore. With LLMs, writing a custom bot tailored to a specific website has become significantly easier, faster, and cheaper.
The result is a much broader and more diverse bot ecosystem:
On the defender side, the situation is much more constrained.
You often have two options:
Not every website can afford enterprise-grade bot management products. And even when cost is not the main issue, you may not want to route all your traffic through a CDN or outsource all detection logic to a third party.
This library exists to fill that gap.
It is a self-hosted, lightweight, and up-to-date browser fingerprinting and bot detection library, designed with real-world constraints in mind. The goal is not to promise perfect detection, but to give you solid building blocks that reflect how bots actually behave today.
This includes practical considerations that are often ignored in toy implementations:
The design and trade-offs behind this library are directly inspired by real production experience and by the ideas discussed in these articles:
Those articles are not documentation for this library, but they reflect the same philosophy: understand what attackers actually do, accept that no single signal is perfect, and build simple, composable primitives that you fully control.
This library is open source, but it is not naive about the implications of being open.
In bot detection, openness cuts both ways. Publishing detection logic makes it easier for attackers to study how they are detected. At the same time, defenders routinely study open and closed automation frameworks, anti-detect browsers, and bot tooling to discover new signals and weaknesses. This asymmetry already exists in the ecosystem, regardless of whether this library is open source or not.
The goal here is not to rely on obscurity. It is to acknowledge that attackers will read the code and still make abuse operationally expensive.
This is why the library combines transparency with pragmatic hardening:
These controls are not meant to be perfect or unbreakable. Their purpose is to remove the easy shortcuts. An attacker should not be able to look at the repository, reimplement a serializer, and start sending convincing fingerprints from a headless script.
More importantly, detection does not stop at a single boolean flag.
Even if an attacker focuses on bypassing individual bot detection checks, producing fully consistent fingerprints over time is significantly harder. Fingerprints encode relationships between signals, contexts, and environments. Maintaining that consistency across sessions, IPs, and accounts requires real execution, careful state management, and stable tooling.
In practice, this creates leverage on the server side:
This is how fingerprinting is used in production systems: not as a one-shot verdict, but as a way to observe structure, reuse, and anomalies at scale.
Open source does not weaken this approach. It makes the trade-offs explicit. Attackers are assumed to be capable and adaptive, not careless. The library is designed accordingly: to force real execution, limit replay, and preserve enough structure in the signals that automation leaves traces once you observe it over time.
| Feature | Description |
|---|---|
| Fast bot detection | Client-side detection of strong automation signals such as navigator.webdriver, CDP usage, Playwright markers, and other common automation artifacts |
| Browser fingerprinting | Short-lived fingerprint designed for attack detection, clustering, and session correlation rather than long-term device tracking |
| Encrypted payloads | Optional payload encryption to prevent trivial forgery, with the encryption key injected at build time |
| Obfuscation | Optional code obfuscation to increase the cost of reverse-engineering and make it harder to forge valid fingerprints without actually executing the collection code |
| Cross-context validation | Detects inconsistencies across different JavaScript execution contexts (main page, iframes, and web workers) |
npm install fpscannerNote: Out of the box, fpscanner uses a default placeholder encryption key and no obfuscation. This is fine for development and testing, but for production deployments you should build with your own key and enable obfuscation. See Advanced: Custom Builds for details.
import FingerprintScanner from 'fpscanner';
const scanner = new FingerprintScanner();
const payload = await scanner.collectFingerprint();
// Send payload to your server
fetch('/api/fingerprint', {
method: 'POST',
body: JSON.stringify({ fingerprint: payload }),
headers: { 'Content-Type': 'application/json' }
});…That's it! For most use cases, this is all you need.
collectFingerprint(options?)Collects browser signals and returns a fingerprint.
const scanner = new FingerprintScanner();
// Default: returns encrypted base64 string
const encrypted = await scanner.collectFingerprint();
// Explicit encryption
const encrypted = await scanner.collectFingerprint({ encrypt: true });
// Raw object (no library encryption)
const fingerprint = await scanner.collectFingerprint({ encrypt: false });| Option | Type | Default | Description |
|---|---|---|---|
encrypt |
boolean |
true |
Whether to encrypt the payload |
skipWorker |
boolean |
false |
Skip Web Worker signals (use if CSP blocks blob: URLs) |
When decrypted (or with encrypt: false), the fingerprint contains:
…The library focuses on strong, reliable signals from major automation frameworks:
| Detection | Signal | Frameworks |
|---|---|---|
hasWebdriver |
navigator.webdriver === true |
Selenium, Puppeteer, Playwright |
hasWebdriverWritable |
webdriver property descriptor | Puppeteer, Playwright |
hasSeleniumProperty |
document.$cdc_, $wdc_ |
Selenium WebDriver |
hasCDP |
CDP runtime markers | Chrome DevTools Protocol |
hasPlaywright |
__playwright, __pw_* |
Playwright |
hasMissingChromeObject |
Missing window.chrome |
Headless Chrome |
headlessChromeScreenResolution |
800x600 default | Headless browsers |
hasHighCPUCount |
Unrealistic core count | VM/container environments |
hasImpossibleDeviceMemory |
Unrealistic memory values | Spoofed environments |
Bots often fail to maintain consistency across execution contexts:
| Detection | Description |
|---|---|
hasWebdriverIframe |
webdriver detected in iframe but not main |
hasWebdriverWorker |
webdriver detected in web worker |
hasMismatchPlatformIframe |
Platform differs between main and iframe |
hasMismatchPlatformWorker |
Platform differs between main and worker |
hasMismatchWebGLInWorker |
WebGL renderer differs in worker |
The fsid is a JA4-inspired, locality-preserving fingerprint identifier. Unlike a simple hash, it's structured into semantic sections, making it both human-readable and useful for partial matching.
FS1________FS1_00000100000000_10010h3f2a_1728x1117c14m08b01011h4e7a9f_f1101011001e00000000p1100h2c8b1e_0h9d3f7a_1h6a2e4c_en4tEurope-Paris_hab12_0000h3e9f| # | Section | Format | Example | Description |
|---|---|---|---|---|
| 1 | Version | FS1 |
FS1 |
Fingerprint Scanner version 1 |
| 2 | Detection | n-bit bitmask (21 bits in FS1) | 000001000000000000000 |
All fastBotDetectionDetails booleans (extensible) |
| 3 | Automation | h |
10010h3f2a |
Automation booleans + hash |
| 4 | Device | xcmbh |
1728x1117c14m08b01011h4e7a9f |
Screen, cpu, memory, device booleans + hash |
| 5 | Browser | feph |
f1101011001e00000000p1100h2c8b1e |
Features + extensions + plugins bitmasks + hash |
| 6 | Graphics | h |
0h9d3f7a |
hasModifiedCanvas + hash |
| 7 | Codecs | h |
1h6a2e4c |
hasMediaSource + hash |
| 8 | Locale | t_h |
en4tEurope-Paris_hab12 |
Language code + count + timezone + hash |
| 9 | Contexts | h |
0000h3e9f |
Mismatch + webdriver flags + hash |
Inspired by JA4+, this format enables:
1728x1117c14m08 = 1728×1117 screen, 14 cores, 8GB RAMBitmask Reference
⚠️ Note: The number of detection b
No open issues yet, or sync has not completed.