@anonympins/fingerprint 0.3.8 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +331 -256
- package/README.md +62 -53
- package/composer.json +38 -38
- package/index.js +4 -4
- package/package.json +103 -103
- package/phpunit.xml +20 -20
- package/public/fp.js +1 -1
- package/public/fp.wasm +0 -0
- package/src/js/build-client.js +1 -1
- package/src/js/fingerprint.client.js +2 -0
- package/src/js/fingerprint.js +4429 -4381
- package/src/js/mongodb-store.js +79 -79
- package/src/js/pow.solver.inline.js +31 -0
- package/src/js/pow.solver.js +31 -0
- package/src/js/tests/fingerprint.builder.test.js +79 -0
- package/src/js/tests/fingerprint.client.init.test.js +120 -0
- package/src/js/tests/fingerprint.client.test.js +105 -0
- package/src/js/tests/fingerprint.engine.test.js +371 -0
- package/src/js/tests/fingerprint.isMalicious.test.js +117 -0
- package/src/js/tests/fingerprint.test.js +2319 -0
- package/src/js/tests/ip-reputation.test.js +132 -0
- package/src/js/tests/ja3AnomalyDetector.test.js +135 -0
- package/src/js/tests/library.test.js +96 -0
- package/src/js/tests/metrics.test.js +104 -0
- package/src/js/tests/pow.solver.test.js +198 -0
- package/src/js/tests/problem-manager.test.js +323 -0
- package/src/js/tests/stores.test.js +118 -0
- package/src/php/Challenge/ChallengeUtils.php +361 -361
- package/src/php/Config/SecurityProfiles.php +271 -266
- package/src/php/FingerprintBuilder.php +185 -185
- package/src/php/FingerprintClient.php +131 -131
- package/src/php/FingerprintEngine.php +1006 -1006
- package/src/php/Ja3AnomalyDetector.php +227 -227
- package/src/php/Optimization/FunctionRegistry.php +62 -62
- package/src/php/Optimization/Optimization.php +255 -255
- package/src/php/Optimization/OptimizationOperators.php +304 -304
- package/src/php/Store/InMemoryStore.php +66 -66
- package/src/php/Store/MongoDbStore.php +104 -104
- package/src/php/Store/RedisStore.php +53 -53
- package/src/php/Tests/ChallengeUtilsTest.php +81 -81
- package/src/php/Tests/FingerprintBuilderTest.php +57 -57
- package/src/php/Tests/FingerprintClientTest.php +71 -0
- package/src/php/Tests/FingerprintEngineTest.php +299 -299
- package/src/php/Tests/IpReputationTest.php +156 -156
- package/src/php/Tests/Ja3AnomalyDetectorTest.php +179 -179
- package/src/php/Tests/MetricsTest.php +45 -45
- package/src/php/Tests/PowTest.php +39 -39
- package/src/php/Tests/ProblemManagerTest.php +296 -296
- package/src/php/Tests/RequestUtilsTest.php +253 -145
- package/src/php/Tests/TLSClientHelloParserTest.php +118 -0
- package/src/php/Tests/problems.config.json +8 -8
- package/src/php/Utils/BigInt.php +144 -144
- package/src/php/Utils/Logger.php +29 -29
- package/src/php/Utils/MaliciousPatterns.php +58 -58
- package/src/php/Utils/MetricsManager.php +166 -166
- package/src/php/Utils/RequestUtils.php +1169 -1169
- package/src/php/Utils/TLSClientHelloParser.php +117 -0
- package/src/php/bin/auto-tune.php +117 -117
package/CHANGELOG.md
CHANGED
|
@@ -1,257 +1,332 @@
|
|
|
1
|
-
## Version 0.
|
|
2
|
-
|
|
3
|
-
###
|
|
4
|
-
- **
|
|
5
|
-
- **
|
|
6
|
-
|
|
7
|
-
###
|
|
8
|
-
- **
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
-
|
|
80
|
-
- **
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
###
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
### 🚀
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
*
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
* **
|
|
176
|
-
*
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
* **
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
*
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
* **
|
|
190
|
-
* **
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
* **
|
|
228
|
-
*
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
* **
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
* **
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
1
|
+
## Version 0.4.0
|
|
2
|
+
|
|
3
|
+
### ⚡ WebAssembly (WASM) v2 Client-Side Solver & Autoloader
|
|
4
|
+
- **WASM by Default**: WebAssembly acceleration is now active by default (`wasm: true`). The client library automatically attempts to load the WASM modules from the public library path (`/fp.js` and `/fp.wasm`), falling back to pure JavaScript only if loading fails.
|
|
5
|
+
- **Full WASM v2 Solver**: Re-engineered the client-side solvers (`solveCpuTargetInline`, `solveMemory`) to execute fully inside WebAssembly, ensuring high-speed cryptographic evaluations and significantly increasing resistance to client-side reverse engineering and tampering.
|
|
6
|
+
|
|
7
|
+
### 🧬 Native PHP TLS Fingerprinting & `TLSClientHelloParser`
|
|
8
|
+
- **Introducing TLSClientHelloParser**: Added native binary parser in PHP to inspect raw TLS Client Hello packets. This enables real-time extraction and computation of JA3 and JA4 TLS fingerprints directly inside PHP.
|
|
9
|
+
- **Asynchronous PHP Support**: Built-in support for event-driven PHP runtimes (Swoole, ReactPHP, Workerman). This allows intercepting the raw TCP socket stream, parsing the TLS handshake, and attaching the calculated TLS fingerprint before upgrading to SSL/TLS.
|
|
10
|
+
- **Architectural Documentation**: Added detailed guides on why standard PHP (PHP-FPM, Apache) cannot extract TLS fingerprints natively (due to TLS termination at Nginx/CDN layer) and how to bypass this using modern asynchronous PHP application servers.
|
|
11
|
+
|
|
12
|
+
### 📊 Documentation & Monitoring Updates
|
|
13
|
+
- **Prometheus Metrics**: Updated `prometheus_metrics.md` to reflect newer indicators and score metrics.
|
|
14
|
+
- **Home Documentation**: Updated `home.md` with guidelines on WASM integrations and native PHP event-loop setups.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Why can't PHP calculate TLS fingerprints natively?
|
|
19
|
+
|
|
20
|
+
Unlike Node.js, which often acts as a direct web server terminating TLS connections itself and exposing socket metadata (like `socket.clientHello`), standard PHP (PHP-FPM, Apache `mod_php`) runs behind a web server or a reverse proxy.
|
|
21
|
+
|
|
22
|
+
1. **TLS Termination**: Your web server (Nginx, Apache) or CDN (Cloudflare) terminates the TLS connection. It performs the cryptographic handshake and decrypts the traffic.
|
|
23
|
+
2. **FastCGI / SAPI Abstraction**: The web server forwards a clean, plain-text HTTP request to PHP. By the time PHP gets the request, the raw **TLS Client Hello** packet (which contains the cipher suites and extensions order needed to compute JA3/JA4) has already been processed and discarded.
|
|
24
|
+
|
|
25
|
+
### Alternatives to compiling server modules:
|
|
26
|
+
If you cannot install custom modules like `ngx_http_ssl_ja3_module` on your server, you can use one of the following approaches:
|
|
27
|
+
|
|
28
|
+
* **Cloudflare**: Cloudflare automatically calculates the JA3 signature and forwards it in the `CF-JA3-Sig` header. You can map this header to `X-JA3-Hash` in your configuration.
|
|
29
|
+
* **AWS Cloudfront**: Cloudfront can be configured to forward TLS client handshakes headers.
|
|
30
|
+
* **PHP Application Servers (Swoole / ReactPHP / Workerman)**: By bypassing standard reverse proxies and handling sockets directly, you can use the built-in native `TLSClientHelloParser` to intercept the binary handshake directly inside PHP's Event Loop.
|
|
31
|
+
|
|
32
|
+
### Native TLS Extraction inside PHP Event Loops (e.g., Workerman)
|
|
33
|
+
|
|
34
|
+
If you run a raw TCP worker, you can peek at the first incoming bytes of the stream connection (the raw **Client Hello** payload) before upgrading the connection stream to SSL/TLS.
|
|
35
|
+
|
|
36
|
+
Here is a concrete example using the native `TLSClientHelloParser` within a Workerman connection listener:
|
|
37
|
+
|
|
38
|
+
```php
|
|
39
|
+
<?php
|
|
40
|
+
|
|
41
|
+
use Workerman\Worker;
|
|
42
|
+
use Workerman\Connection\TcpConnection;
|
|
43
|
+
use Anonympins\Fingerprint\Utils\TLSClientHelloParser;
|
|
44
|
+
|
|
45
|
+
$worker = new Worker('tcp://0.0.0.0:443');
|
|
46
|
+
|
|
47
|
+
$worker->onConnect = function(TcpConnection $connection) {
|
|
48
|
+
// Intercept the first chunk of data (the raw TLS handshake)
|
|
49
|
+
$connection->onMessage = function(TcpConnection $connection, $rawData) {
|
|
50
|
+
// Parse the binary payload to calculate JA3 natively in PHP
|
|
51
|
+
$tlsData = TLSClientHelloParser::parse($rawData);
|
|
52
|
+
if ($tlsData) {
|
|
53
|
+
// Attach the fingerprint directly to the connection context
|
|
54
|
+
$connection->ja3Hash = $tlsData['ja3_hash'];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Clear the temporary plain-text parser callback
|
|
58
|
+
$connection->onMessage = null;
|
|
59
|
+
|
|
60
|
+
// Dynamically upgrade the socket transport layer to SSL (initiates cryptographic handshake)
|
|
61
|
+
$connection->transport = 'ssl';
|
|
62
|
+
|
|
63
|
+
// Bind your final application logic/HTTP router
|
|
64
|
+
$connection->onMessage = function($conn, $httpPayload) {
|
|
65
|
+
// $conn->ja3Hash is available here for real-time security score checks!
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Pipe back the buffered bytes so the SSL engine can consume the Client Hello
|
|
69
|
+
$connection->consumeFirstLocalBuffer($rawData);
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
Worker::runAll();
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Version 0.3.8
|
|
77
|
+
|
|
78
|
+
### 🎫 Opaque Tickets Implementation (JS/PHP)
|
|
79
|
+
- **Opaque Clearance Tickets**: Upgraded clearance tickets to use cryptographically secure, random, and opaque token identifiers. This completely mitigates client-side prediction, token tampering, and replay/unauthorized reuse.
|
|
80
|
+
- **PHP Parity**: Implemented secure opaque ticket handling and validation inside the PHP engine to match the Node.js architecture.
|
|
81
|
+
|
|
82
|
+
### 🌐 Independent Subnet Score (JS/PHP)
|
|
83
|
+
- **Independent Subnet Scoring**: Decoupled and isolated the subnet activity and reputation calculation from individual host/device threat vectors. This ensures distributed crawler attacks on specific IP ranges are mitigated at the subnet level without cascading penalties to unaffected neighboring residential IPs.
|
|
84
|
+
|
|
85
|
+
### 🛡️ Reverse Proxy Header Spoofing Protection (JS)
|
|
86
|
+
- **Trusted Proxies verification**: Added `trustedProxies` configuration to restrict proxy-injected headers (`X-JA3-Hash`, `X-JA4-Hash`, `X-HTTP2-Fingerprint`, `X-TCP-Fingerprint`, `X-JA3-Raw`) only to requests originating from configured trusted proxy IPs/networks. Unauthenticated clients attempting to send these headers will have them automatically stripped.
|
|
87
|
+
|
|
88
|
+
## Version 0.3.7
|
|
89
|
+
|
|
90
|
+
### 📊 Prometheus Metrics & Monitoring (JS/PHP)
|
|
91
|
+
- **Prometheus metrics export support**:
|
|
92
|
+
- Implemented a metrics generator using the standard Prometheus format (`text/plain`).
|
|
93
|
+
- Exported active configuration indicators: weight (`fingerprint_security_weight`) and thresholds (`fingerprint_security_threshold`).
|
|
94
|
+
- Real-time export of Auto-Tuner performance metrics: false positive rate (`fingerprint_autotuning_false_positive_rate`) and false negative rate (`fingerprint_autotuning_false_negative_rate`).
|
|
95
|
+
- Secured access via a customizable authorization callback (`metricsAuthorizationCallback`) supporting blocking and secure redirects.
|
|
96
|
+
|
|
97
|
+
### ⚙️ Background Pareto-Optimal TTL Tuning (JS)
|
|
98
|
+
- **Non-blocking asynchronous optimization**:
|
|
99
|
+
- Added `runBackgroundTtlOptimization`, which runs periodically in the background without blocking the event loop.
|
|
100
|
+
- Utilized a multi-objective genetic algorithm to dynamically calculate a Pareto front of optimal TTLs based on suspicion scores.
|
|
101
|
+
- Implemented instant linear interpolation from the optimization cache for efficient ticket TTL assignment (`determineOptimalTicketTtl`).
|
|
102
|
+
|
|
103
|
+
### 🚀 Maintenance
|
|
104
|
+
- **Repository cleanup**:
|
|
105
|
+
- Removed obsolete temporary specification files (`enhancements.md`).
|
|
106
|
+
|
|
107
|
+
## Version 0.3.6
|
|
108
|
+
|
|
109
|
+
### 🛡️ Sybil Protection & Auto-Tuner Hardening (JS/PHP)
|
|
110
|
+
- **Auto-Tuner Freeze Vulnerability Fix (Anti-Flood)**:
|
|
111
|
+
- Resolved a vulnerability allowing an attacker to indefinitely freeze the auto-tuner by flooding it with simple requests (`request_passed`), causing the high-confidence log ratio to plummet below the 5% threshold.
|
|
112
|
+
- Enhanced `sanitizeTrafficData` to balance, shuffle, and cap the proportion of clean logs (`request_passed`) relative to suspicious logs.
|
|
113
|
+
- Added an absolute fallback trigger condition (`MIN_HIGH_CONFIDENCE_COUNT = 10`) in the optimizer to bypass the 5% minimum ratio when a sufficiently strong signal is present.
|
|
114
|
+
- **Defense Against Sybil Attacks (Data Poisoning)**:
|
|
115
|
+
- Limited the contribution of each `deviceId` to a maximum of 2% of the total dataset within the traffic sanitizer, preventing a single attacker from manipulating safety threshold optimization calculations.
|
|
116
|
+
- **Cryptographic Securing of Challenge Context (HMAC)**:
|
|
117
|
+
- Systematic HMAC-SHA256 signing of the challenge payload (`clientSecret`, `cpuTarget`, `fingerprint`, `memDifficulty`, `originalPath`, and client IP) using the global secret.
|
|
118
|
+
- Strict validation of challenge context integrity upon submission to counter injection or storage tampering attacks.
|
|
119
|
+
|
|
120
|
+
### ✨ New Features & Improvements
|
|
121
|
+
- **Sequential Path Enumeration Detection (Scraping)**:
|
|
122
|
+
- Integrated a detection system for requests with identical, incremental structures (e.g., `/product/1`, `/product/2`, `/product/3`).
|
|
123
|
+
- Automatically applies an enumeration penalty score (`enumerationScore`) of 80% of the pattern weight during unique sequential requests on the same URL pattern.
|
|
124
|
+
- **Network Roaming Tolerance & Strict Hardware Identity**:
|
|
125
|
+
- Upgraded `isTicketValid` to tolerate legitimate user IP changes (roaming) within the same network block (IPv4/IPv6 subnet).
|
|
126
|
+
- Automatic fallback to robust hardware identity validation (`deviceId` and `deviceHash` cryptographically verified via HMAC) if the user completely switches networks (e.g., moving from Wi-Fi to 4G).
|
|
127
|
+
|
|
128
|
+
## Version 0.3.5 (Hotfix)
|
|
129
|
+
|
|
130
|
+
### 🛡️ Critical Fixes & Security Hardening:
|
|
131
|
+
- **IPv6 DNS Lookup for SEO Bots (JS/PHP)**:
|
|
132
|
+
- Fixed DNS validation (reverse + forward lookup) for legitimate search engine crawlers (Googlebot, Bingbot, etc.) connecting over IPv6.
|
|
133
|
+
- Added explicit queries for IPv6 (`AAAA` records) in both the Node.js and PHP engines, preventing false positives and ensuring SEO indexing crawlers are never blocked or challenged.
|
|
134
|
+
- **Enhanced JA4 & JA3 Spoofing Detectors (JS/PHP)**:
|
|
135
|
+
- Added detection of sophisticated JA4 fingerprints (`spoofedJa4s` blacklist) representing automated scraper clients (e.g., `curl-impersonate`, `tls-client`).
|
|
136
|
+
- Hardened JA3 anomaly detection to analyze raw JA3 signatures (`x-ja3-raw`), strictly validating GREASE mechanisms and ALPN HTTP version negotiations.
|
|
137
|
+
- **Firefox TE Header Anomaly Detection**:
|
|
138
|
+
- Refined header analysis to detect mismatches on the `TE` header. Legitimate desktop Firefox clients expect `TE: trailers`, whereas other desktop browsers or automated tools trying to mimic Firefox are now appropriately penalized.
|
|
139
|
+
|
|
140
|
+
## Version 0.3.4
|
|
141
|
+
|
|
142
|
+
### ✨ Improvements :
|
|
143
|
+
- **Client Hints Inconsistency Score (JS/PHP)** :
|
|
144
|
+
- Implementation of cross-analysis between the traditional `User-Agent` header and the new Client Hints headers (`Sec-CH-UA`).
|
|
145
|
+
- Calculation of a progressive anomaly score upon inconsistency: a penalty of `90` for a mismatched browser change, `80` for a major version gap exceeding 5 versions, and `40` for a minor gap exceeding 1 version.
|
|
146
|
+
- **Support for JA4, JA4S, and JA4H (PHP)** :
|
|
147
|
+
- Integration of modern TLS JA4 transport fingerprints into the composite application fingerprint calculation (`getCompositeDeviceHash`).
|
|
148
|
+
- Prioritization of spoofing analysis via the JA4 database (`JA4_FINGERPRINT_DB`) to intercept sophisticated User-Agent impersonation attempts before falling back to JA3.
|
|
149
|
+
- **Subnet-based activity score (JS/PHP)** :
|
|
150
|
+
- Grouping of hosts by their respective IP subnets (using `/24` CIDR masking for IPv4 and `/48` for IPv6).
|
|
151
|
+
- Tracking of an internal reputation score (`subnetScore`) to mitigate distributed attacks from rotating proxies by analyzing the proliferation of new `deviceIds` and the violation history of an entire network block.
|
|
152
|
+
- **Optional GMP support** :
|
|
153
|
+
- Optimization of arithmetic operations on 256-bit integers (BigInt) for PoW difficulty target calculation (`calculateTarget`) using the native PHP `GMP` extension, with a seamless fallback if the extension is missing. - **PHP `imul` simulation (`test imul`)** :
|
|
154
|
+
- Added strict emulation of JavaScript's 32-bit signed integer multiplication (`Math.imul`) in PHP to ensure the Proof-of-Work memory allocation algorithm behaves identically.
|
|
155
|
+
- **WebAssembly solver dynamic loader (`wasmPath loader`)** :
|
|
156
|
+
- Integrated a configurable loader to facilitate the dynamic and secure loading of the compiled WASM module via a URI or local path option (`wasmPath`).
|
|
157
|
+
- **WebAssembly nonce (`wasm nonce`)** :
|
|
158
|
+
- Secured the algorithm's resolution and cryptographic evaluation handshake within the WebAssembly module by implementing a unique execution nonce to prevent replay attacks.
|
|
159
|
+
- Added ipReputationScore by flagging requests
|
|
160
|
+
|
|
161
|
+
## Version 0.3.3
|
|
162
|
+
|
|
163
|
+
This release introduces significant enhancements to client-side behavioral analysis, adds a crucial "dry run" mode for safe production testing, and improves the overall developer experience with an event-driven client library and better packaging.
|
|
164
|
+
|
|
165
|
+
### ✨ New Features
|
|
166
|
+
|
|
167
|
+
* **Advanced Behavioral Analysis: Click Variance**:
|
|
168
|
+
* The client-side library now tracks the exact coordinates of user clicks on interactive elements.
|
|
169
|
+
* A new `clickVarianceScore` is calculated on the server-side (for both PHP and Node.js) to penalize unnaturally precise, bot-like clicking patterns (e.g., always hitting the exact same pixel). This adds a powerful new dimension to detecting sophisticated automation.
|
|
170
|
+
|
|
171
|
+
* **"Dry Run" Mode**:
|
|
172
|
+
* A `dryRun: true` option can now be added to the security configuration. When enabled, the engine performs all calculations and logs the action it *would* have taken (`block`, `challenge`) but never actually interrupts the request.
|
|
173
|
+
* This is invaluable for safely testing new or stricter configurations in a live production environment without affecting real users.
|
|
174
|
+
|
|
175
|
+
* **Client-Side Event Emitter**:
|
|
176
|
+
* The client library now emits events for key actions (e.g., `challenge_issued`, `challenge_solved`, `honeypot_triggered`). This allows developers to easily hook into the library's lifecycle to trigger custom UI changes, analytics, or logging.
|
|
177
|
+
|
|
178
|
+
### 🚀 Improvements
|
|
179
|
+
|
|
180
|
+
* **Enhanced Mouse Tracking Analysis**: The server-side analysis of mouse movement data has been refined to better distinguish between natural, human-like cursor paths and the linear or predictable movements typical of bots.
|
|
181
|
+
* **PHP Code Quality**: The entire PHP codebase has undergone a syntax normalization pass, improving consistency and long-term maintainability.
|
|
182
|
+
* **Test Suite Reliability**:
|
|
183
|
+
* Unit tests for the client-side `initializeClient` function have been added and improved.
|
|
184
|
+
* New unit tests cover the "Dry Run" mode functionality.
|
|
185
|
+
* Fixed existing unit tests for the `ProblemManager` to ensure the stability of the Useful-Proof-of-Work system.
|
|
186
|
+
|
|
187
|
+
### 📦 Build & Internals
|
|
188
|
+
|
|
189
|
+
* **Corrected NPM Package Files**: The `files` array in `package.json` has been updated to ensure all necessary JavaScript source files (`library.js`, `fingerprint.builder.js`, etc.) are correctly included in the published package, fixing potential `import` issues for users.
|
|
190
|
+
* **Project Structure**: The JavaScript source files have been consolidated into the `src/js` directory for a cleaner and more organized project structure.
|
|
191
|
+
|
|
192
|
+
## Version 0.3.2
|
|
193
|
+
|
|
194
|
+
This release brings major new capabilities to both the Node.js and PHP versions of the library. Key highlights include the full implementation of the "Useful Proof-of-Work" (uPoW) system in PHP, client-side acceleration via WebAssembly (WASM), direct JA3 fingerprinting in Node.js, and significant reliability improvements to the auto-tuner.
|
|
195
|
+
|
|
196
|
+
### ✨ New Features
|
|
197
|
+
|
|
198
|
+
* **Useful Proof-of-Work (uPoW) in PHP**: The PHP version now has full feature parity with Node.js for uPoW.
|
|
199
|
+
* The `ProblemManager` is now fully implemented in PHP, allowing it to load, manage, and dispatch complex optimization problems (e.g., TSP, Portfolio Allocation) to suspicious clients.
|
|
200
|
+
* Client solutions are integrated back into the system, enabling distributed, collaborative problem-solving.
|
|
201
|
+
|
|
202
|
+
* **WASM-Accelerated Client**: The client-side library can now be accelerated with a WebAssembly module for high-performance hashing.
|
|
203
|
+
* The build process (`build-client.js`) now includes a step to compile the C++ hashing utility into a WASM module.
|
|
204
|
+
* The client library (`fingerprint.client.js`) can dynamically load the WASM module if available, falling back gracefully to the pure JavaScript implementation. This makes client-side fingerprinting faster and harder to tamper with.
|
|
205
|
+
|
|
206
|
+
* **Direct JA3 Fingerprinting in Node.js**: The Node.js engine can now calculate the JA3 fingerprint directly from the raw TLS `clientHello` object. This is a major enhancement, as it removes the hard dependency on a reverse proxy (like Nginx or Cloudflare) to provide the JA3 hash, making the library more versatile and easier to deploy in various environments.
|
|
207
|
+
|
|
208
|
+
* **Auto-Tuner Solution API**: A new `getBestTuningSolution()` function has been added to the Node.js version. This allows developers to programmatically retrieve and inspect the optimal configuration (`weights`, `thresholds`, `patterns`) found by the auto-tuner, which is useful for auditing and "FinOps".
|
|
209
|
+
|
|
210
|
+
### 🚀 Improvements
|
|
211
|
+
|
|
212
|
+
* **Probationary Tickets in PHP**: The PHP engine now supports issuing short-lived "probationary" tickets for moderately suspicious users who solve a challenge. This forces a quicker re-evaluation, increasing security for borderline cases.
|
|
213
|
+
* **Auto-Tuner Reliability**: The auto-tuning mechanism has been made more robust, with fixes to default score calculations to improve its initial learning phase and overall stability.
|
|
214
|
+
* **PHP 64-Bit Compatibility**: The PHP implementation of the `cyrb53` hashing algorithm and other arithmetic operations has been improved using the `gmp` extension to ensure correct and consistent results on 64-bit systems, matching the JavaScript output.
|
|
215
|
+
* **Expanded PHP Test Coverage**: The PHPUnit test suite has been significantly expanded to cover the new `ProblemManager`, uPoW logic, and other core engine features, increasing overall reliability.
|
|
216
|
+
|
|
217
|
+
## Version 0.3.1
|
|
218
|
+
|
|
219
|
+
This release marks a major expansion of the library, introducing a full-featured PHP version that mirrors the capabilities of the Node.js module. It also adds GraphQL operation whitelisting and an obfuscated client build for enhanced security.
|
|
220
|
+
|
|
221
|
+
### ✨ New Features
|
|
222
|
+
|
|
223
|
+
* **Full PHP Support**: The library is now available for PHP 8.0+ with a feature set equivalent to the Node.js version.
|
|
224
|
+
* **Direct Integration**: A `DirectFingerprint` class allows for easy integration into any PHP application, including legacy codebases, by interacting directly with PHP's superglobals.
|
|
225
|
+
* **PSR-15 Middleware**: A `FingerprintMiddleware` is provided for modern, framework-agnostic integration with applications that follow PSR-7, PSR-15, and PSR-17 standards (e.g., Slim, Laminas).
|
|
226
|
+
* **Pluggable Datastores**: The PHP version supports the same pluggable store architecture, allowing state to be persisted in Redis, databases, or other external systems.
|
|
227
|
+
* **Security Profiles**: The same pre-configured security profiles (`balanced`, `strict`, `api`, etc.) are available in PHP via `SecurityProfiles::createSecurityProfile()`.
|
|
228
|
+
* **Client-Side Helper**: A `FingerprintClient` class is included to simplify the injection of the client-side JavaScript library and honeypot fields into PHP-rendered HTML pages.
|
|
229
|
+
|
|
230
|
+
* **GraphQL Whitelisting**: You can now whitelist specific GraphQL operations to bypass security checks. This is ideal for allowing public queries (like `GetPublicPosts`) while protecting sensitive mutations. This is supported in both Node.js and PHP.
|
|
231
|
+
* Example rule: `{ type: 'graphql_operation_allowlist', entries: ['query:GetPublicPosts', 'mutation:*'] }`
|
|
232
|
+
|
|
233
|
+
### 🚀 Improvements
|
|
234
|
+
|
|
235
|
+
* **Obfuscated Client Script**: The build process now generates an obfuscated version of the client-side JavaScript library (`fingerprint.client.obfuscated.js`). This makes it significantly more difficult for attackers to reverse-engineer the client-side fingerprinting and behavioral analysis logic.
|
|
236
|
+
* **Expanded PHP Test Coverage**: The new PHP module includes a comprehensive suite of PHPUnit tests, ensuring the reliability and correctness of the `FingerprintEngine`, challenge verification, and scoring logic.
|
|
237
|
+
* **Unified Documentation**: The `README.md` has been updated with dedicated sections and quick-start guides for both Node.js and the new PHP integrations, providing clear instructions for both platforms.
|
|
238
|
+
|
|
239
|
+
### 📦 Build & Internals
|
|
240
|
+
|
|
241
|
+
* The project structure now includes a `src/php` directory containing the full PHP library implementation.
|
|
242
|
+
* A `phpunit.xml` configuration has been added to manage the PHP test suite.
|
|
243
|
+
|
|
244
|
+
## Version 0.3.0
|
|
245
|
+
|
|
246
|
+
This is a major release focused on security hardening, distributed system capabilities, and overall robustness. It introduces advanced TLS spoofing detection, protection against various resource exhaustion and data poisoning attacks, and makes the "Useful Proof-of-Work" system truly scalable.
|
|
247
|
+
|
|
248
|
+
### 🔒 Security Enhancements
|
|
249
|
+
|
|
250
|
+
* **Advanced TLS Spoofing Detection**: The engine now performs a much deeper analysis to detect when a client is faking its identity. It cross-references the TLS JA3 fingerprint against an internal database of known browser and library signatures. A request with a `User-Agent` for Chrome but a JA3 fingerprint for a Python `requests` library will now be heavily penalized.
|
|
251
|
+
* **uPoW Resource Drain Protection**: Implemented a hard cap on the difficulty of "Useful Proof-of-Work" (uPoW) tasks. This prevents a malicious client from being assigned a computationally impossible task that could drain server resources during verification.
|
|
252
|
+
* **Memory PoW DoS Protection**: A hard cap has been added to the memory allocation size for the memory-based PoW challenge, preventing a malicious client from forcing the server to allocate excessive amounts of memory.
|
|
253
|
+
* **Auto-Tuner Data Poisoning Protection**: The auto-tuner is now more robust against data poisoning attacks. It better distinguishes between legitimate traffic patterns and malicious attempts to skew its learning process, ensuring the optimized parameters remain effective.
|
|
254
|
+
* **Invalid Nonce Protection**: The challenge-response mechanism is now hardened. Any attempt to submit a solution for an invalid or expired nonce is immediately flagged as a high-risk honeypot interaction, resulting in a block or a maximum-difficulty challenge.
|
|
255
|
+
* **Cryptographically Secure Randomness**: The internal library now uses `crypto.randomBytes` instead of `Math.random` for all security-sensitive operations, ensuring higher quality randomness for tasks like genetic algorithm mutations and selection.
|
|
256
|
+
|
|
257
|
+
### ✨ New Features
|
|
258
|
+
|
|
259
|
+
* **Distributed uPoW State**: The state of "Useful Proof-of-Work" problems (e.g., the best solution found for a TSP problem) is now persisted through the configured datastore (e.g., Redis, MongoDB). This allows a cluster of server instances to collaborate on solving the same complex problems, making the system truly distributed and more powerful.
|
|
260
|
+
|
|
261
|
+
### 🚀 Improvements
|
|
262
|
+
|
|
263
|
+
* **Smarter Fingerprint Comparison**: The `FingerprintBuilder.compare()` method is now more precise. It applies a penalty for unknown or missing keys in a fingerprint, making it better at detecting subtle differences between a legitimate user and an attacker attempting to mimic a fingerprint.
|
|
264
|
+
* **Configuration Validation**: The engine now checks for unknown keys in the `securityConfig` object upon initialization and will log a warning. This helps developers quickly identify typos or misconfigurations.
|
|
265
|
+
* **Asynchronous Problem Loading**: The `problems.config.json` file is now read asynchronously and debounced at startup, improving application start time and preventing race conditions.
|
|
266
|
+
* **Optional Peer Dependencies**: The `package.json` has been updated to mark datastore drivers (`ioredis`, `mongodb`, `knex`, `sqlite3`) as optional `peerDependencies`. This provides a cleaner installation for users who do not need a specific external store.
|
|
267
|
+
|
|
268
|
+
## Version 0.2.3
|
|
269
|
+
|
|
270
|
+
This release introduces major improvements in ease of use and flexibility. It adds pre-configured security profiles for rapid setup, more granular whitelisting controls, and expands the "Useful Proof-of-Work" system with a new range of complex optimization problems.
|
|
271
|
+
|
|
272
|
+
### ✨ New Features
|
|
273
|
+
|
|
274
|
+
* **Security Profiles & Quick Init**:
|
|
275
|
+
* To simplify setup, you can now use the `createSecurityProfile()` helper to load pre-configured profiles tailored for common use cases: `balanced` (default), `strict`, `api`, `blog`, and `ecommerce`.
|
|
276
|
+
* These profiles provide a solid starting point and can be easily customized with your own overrides.
|
|
277
|
+
|
|
278
|
+
* **Advanced Whitelisting Controls**:
|
|
279
|
+
* **`path_allowlist`**: A new whitelisting rule to bypass checks for specific URL paths. It's perfect for public API endpoints, webhooks, or static content that doesn't require protection. Supports wildcards (e.g., `/api/public/*`).
|
|
280
|
+
* **`host_path_allowlist`**: Provides even more granular control by whitelisting a path only when it's on a specific host. This is ideal for multi-tenant applications or for securing an API on one domain but not another (e.g., `api.example.com/v1/webhooks/*`).
|
|
281
|
+
|
|
282
|
+
* **Expanded Useful Proof-of-Work (uPoW) Problems**:
|
|
283
|
+
* The `ProblemManager` is now more powerful, with support for a wider range of real-world optimization tasks that can be offloaded to suspicious clients.
|
|
284
|
+
* The `problems.config.json` has been updated with new examples, including:
|
|
285
|
+
* **Fraud Detection Tuning**: Finding optimal thresholds for fraud detection systems.
|
|
286
|
+
* **Facility Location**: Solving complex logistical placement problems.
|
|
287
|
+
* **Security Auto-Tuning**: Using client CPU to dynamically optimize the library's own security parameters.
|
|
288
|
+
* **CPC Optimization**: Finding optimal Cost-Per-Click values in a simulated ad-tech environment.
|
|
289
|
+
* The `FunctionRegistry` in `problem-manager.js` has been updated to support these new problem types.
|
|
290
|
+
|
|
291
|
+
### 🚀 Improvements
|
|
292
|
+
|
|
293
|
+
* **Documentation**: The `README.md` has been updated to reflect the new security profiles and whitelisting options, with clear examples for each.
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
## Version 0.2.2
|
|
297
|
+
|
|
298
|
+
This version marks a significant evolution from simple Proof-of-Work (PoW) to "Useful Proof-of-Work" (uPoW). Instead of solving arbitrary computational puzzles, clients now contribute to solving complex optimization problems, making the work done to verify a client's legitimacy valuable.
|
|
299
|
+
|
|
300
|
+
### ✨ New Features
|
|
301
|
+
|
|
302
|
+
* **Useful Proof-of-Work (uPoW) System**:
|
|
303
|
+
* Introduced the `ProblemManager` to oversee long-running optimization problems (e.g., Traveling Salesperson Problem, Portfolio Optimization).
|
|
304
|
+
* Clients' PoW challenges now consist of running optimization algorithms (like Simulated Annealing or Genetic Algorithms) for a specific number of iterations/generations.
|
|
305
|
+
* Solutions submitted by clients are integrated back into the system, continuously improving the best-known solution for each problem over time.
|
|
306
|
+
|
|
307
|
+
* **Dynamic Problem Configuration**:
|
|
308
|
+
* The `problems.config.json` file now supports dynamic data generation. You can specify functions like `generate:randomPoints` or `generate:randomAssets` to create new problem instances on startup without manual data entry.
|
|
309
|
+
|
|
310
|
+
* **Best Solution API**:
|
|
311
|
+
* A new method, `fingerprint.getBestSolutions(problemId?)`, has been added. This allows you to retrieve the best solution found so far for a specific problem or for all active problems. This makes the results of the uPoW system accessible and useful.
|
|
312
|
+
|
|
313
|
+
* **Re-challenge for High-Suspicion Clients**:
|
|
314
|
+
* Clients with a very high `suspicionFactor` are now automatically issued a second challenge upon successful completion of the first. This significantly increases the cost of verification for highly suspicious actors without affecting legitimate users.
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
### 🚀 Improvements
|
|
318
|
+
|
|
319
|
+
* **Smarter Challenge Difficulty**:
|
|
320
|
+
* The difficulty of optimization challenges now scales more intelligently with the client's `suspicionFactor`.
|
|
321
|
+
* A minimum difficulty has been established for challenges to ensure they are always meaningful, preventing trivial PoW tasks even for low-suspicion clients.
|
|
322
|
+
* Added a linear "decay" mode as an alternative to exponential scaling. If a `scalingFactor` is not defined for a problem, the difficulty increases linearly, providing a gentler curve for low-suspicion clients.
|
|
323
|
+
|
|
324
|
+
* **Data Point Capping**:
|
|
325
|
+
* Added a `maxDataPoints` option to problem configurations to prevent datasets (e.g., TSP points) from growing indefinitely. This ensures stable performance and memory usage over time. (Thanks, @anonympins!)
|
|
326
|
+
* **Enhanced Test Suite**:
|
|
327
|
+
* Added comprehensive unit tests for the new `ProblemManager`, ensuring the reliability of problem loading, work dispatching, solution integration, and the new dynamic configuration features.
|
|
328
|
+
|
|
329
|
+
### Internal & Developer Experience
|
|
330
|
+
|
|
331
|
+
* The core logic for managing, dispatching, and updating optimization problems is now encapsulated within `problem-manager.js`.
|
|
257
332
|
* The project now uses `vitest` for running tests, as configured in `package.json`.
|