@anonympins/fingerprint 0.7.0 → 0.7.1
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 +17 -0
- package/README.md +1 -1
- package/composer.json +8 -1
- package/package.json +1 -1
- package/public/fingerprint-wordpress.zip +0 -0
- package/src/js/build-client.js +8 -10
- package/src/js/fingerprint.builder.js +37 -38
- package/src/js/fingerprint.client.js +1531 -1463
- package/src/js/fingerprint.client.obfuscated.js +1 -0
- package/src/js/fingerprint.js +152 -10
- package/src/js/fingerprint.utils.js +213 -213
- package/src/js/library.js +340 -376
- package/src/js/mongodb-store.js +1 -1
- package/src/js/optimization.worker.js +27 -27
- package/src/js/pow.solver.inline.js +154 -56
- package/src/js/pow.solver.js +180 -92
- package/src/js/pow.worker.js +48 -48
- package/src/js/redis-store.js +1 -1
- package/src/js/tests/fingerprint.client.init.test.js +146 -143
- package/src/js/tests/fingerprint.test.js +34 -7
- package/src/js/tests/ip-reputation.test.js +1 -0
- package/src/js/upow-model-task.js +14 -15
- package/src/php/AutoTuner.php +34 -34
- package/src/php/Challenge/ChallengeUtils.php +56 -10
- package/src/php/Config/SecurityProfiles.php +20 -0
- package/src/php/DirectFingerprint.php +190 -145
- package/src/php/FingerprintBuilder.php +29 -30
- package/src/php/FingerprintClient.php +147 -148
- package/src/php/FingerprintEngine.php +7 -5
- package/src/php/Ja3AnomalyDetector.php +33 -32
- package/src/php/Optimization/FunctionRegistry.php +7 -7
- package/src/php/Optimization/Optimization.php +24 -24
- package/src/php/Optimization/OptimizationOperators.php +26 -25
- package/src/php/Optimization/ProblemInitializers.php +52 -52
- package/src/php/ProblemManager.php +31 -34
- package/src/php/RequestContext.php +8 -1
- package/src/php/Store/IStore.php +7 -8
- package/src/php/Store/InMemoryStore.php +66 -66
- package/src/php/Store/MongoDbStore.php +5 -5
- package/src/php/Store/RedisStore.php +5 -5
- package/src/php/Store/StoreManager.php +35 -35
- package/src/php/Tests/ChallengeUtilsTest.php +453 -453
- package/src/php/Tests/DnsCircuitBreakerTest.php +105 -105
- package/src/php/Tests/FingerprintEngineTest.php +662 -662
- package/src/php/Tests/IpReputationTest.php +10 -0
- package/src/php/Tests/MaliciousPatternsTest.php +103 -103
- package/src/php/Tests/MetricsTest.php +97 -97
- package/src/php/Tests/ProblemManagerTest.php +376 -376
- package/src/php/Tests/QuicFingerprintTest.php +53 -53
- package/src/php/Tests/RequestUtilsTest.php +471 -471
- package/src/php/Tests/TLSClientHelloParserTest.php +177 -177
- package/src/php/Tests/config/ed25519_key.json +3 -3
- package/src/php/Utils/Env.php +49 -49
- package/src/php/Utils/MaliciousPatterns.php +74 -74
- package/src/php/Utils/MetricsManager.php +209 -209
- package/src/php/Utils/RequestUtils.php +129 -7
- package/src/php/Utils/TLSClientHelloParser.php +369 -369
- package/src/php/WordPress/WpDbStore.php +155 -0
- package/src/php/WordPress/fingerprint-wordpress.php +217 -0
- package/src/php/WordPress/package.php +123 -0
- package/src/php/bin/auto-tune.php +118 -118
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## Version 0.7.1
|
|
2
|
+
|
|
3
|
+
- 🔌 **Native WordPress Plugin Integration (`fingerprint-wordpress`)**:
|
|
4
|
+
- Full official WordPress plugin integration (`fingerprint-wordpress.php`) without external runtime dependencies, leveraging `$wpdb` through a dedicated `WpDbStore` adapter.
|
|
5
|
+
- Automatic SQL cache table provisioning and periodic cleanup of expired tickets via WP-Cron (`fingerprint_prune_expired_entries`).
|
|
6
|
+
- Automated packaging script (`package.php`) generating a ready-to-deploy ZIP archive (`fingerprint-wordpress.zip`).
|
|
7
|
+
- Cross-environment honeypot tripwires: immediately detects and drops automated scanners probing for non-WordPress entrypoints (Laravel, Symfony, Django, Spring Boot `/actuator`, phpMyAdmin, `.env`, `.git`).
|
|
8
|
+
- Admin dashboard security notice if running over unencrypted HTTP (warning about modern browsers disabling native `crypto.subtle` APIs in insecure contexts).
|
|
9
|
+
- 🔬 **JavaScript Prototype Tampering Detection (`detectTamperedPrototypes`)**:
|
|
10
|
+
- Added runtime integrity inspection on critical browser APIs (`HTMLCanvasElement.prototype.toDataURL`, `CanvasRenderingContext2D.prototype.getImageData`, `WebGLRenderingContext.prototype.getParameter`, and `window.fetch`).
|
|
11
|
+
- Accurately detects function hooks and proxies injected by evasion frameworks (Puppeteer Stealth, Frida, Selenium) and applies an aggressive penalty (`+80` to `behaviorScore`) via the `prototypeTampered` indicator.
|
|
12
|
+
- 📱 **Device Motion Variance Tracking (`motionVariance`)**:
|
|
13
|
+
- Analyzed accelerometer and gyroscope micro-variations via the `devicemotion` API.
|
|
14
|
+
- Distinguishes authentic handheld mobile devices from rack-mounted phone farms or automated rigs (detecting active touch interactions with zero natural sensor tremor, `motionVariance === 0`).
|
|
15
|
+
- 📝 **Code Standardization & Internationalization**:
|
|
16
|
+
- Harmonized and fully translated technical comments into English across optimization modules (`library.js`), PoW solvers, and build scripts.
|
|
17
|
+
|
|
1
18
|
## Version 0.7.0
|
|
2
19
|
|
|
3
20
|
- 🛡️ **Targeted Re-Challenge Strategy (`mustReChallenge`)**: Re-introduced and hardened the re-challenge workflow specifically targeted at honeypot triggers and critical indicators (e.g., `honeypotScore >= mediumThreshold` or any indicator score reaching $\ge 100$). Legitimate sessions with valid clearance tickets are preserved, while active attack attempts immediately invalidate existing tickets and force verification.
|
package/README.md
CHANGED
package/composer.json
CHANGED
|
@@ -36,5 +36,12 @@
|
|
|
36
36
|
"config": {
|
|
37
37
|
"sort-packages": true
|
|
38
38
|
},
|
|
39
|
-
"minimum-stability": "stable"
|
|
39
|
+
"minimum-stability": "stable",
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build:wordpress": "@php src/php/WordPress/package.php",
|
|
42
|
+
"package:wordpress": "@php src/php/WordPress/package.php"
|
|
43
|
+
},
|
|
44
|
+
"scripts-descriptions": {
|
|
45
|
+
"build:wordpress": "Empaquette et génère le fichier zip du plugin WordPress dans public/"
|
|
46
|
+
}
|
|
40
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anonympins/fingerprint",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "Advanced anti-bot library for Node.js using multi-layer fingerprinting (JA3, client-side, headers), behavioral analysis, and adaptive Proof-of-Work (PoW) challenges to mitigate scraping, scalping, and automated threats.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
Binary file
|
package/src/js/build-client.js
CHANGED
|
@@ -8,8 +8,8 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
8
8
|
const __dirname = dirname(__filename);
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Attempts to run the build command for the WASM module.
|
|
12
|
+
* Does not fail the build if the command fails (e.g. em++ not found).
|
|
13
13
|
*/
|
|
14
14
|
function buildWasm() {
|
|
15
15
|
return new Promise((resolve) => {
|
|
@@ -22,7 +22,7 @@ function buildWasm() {
|
|
|
22
22
|
} else {
|
|
23
23
|
console.log('WASM module built successfully.');
|
|
24
24
|
}
|
|
25
|
-
resolve(); //
|
|
25
|
+
resolve(); // Always resolve the promise so the main build is not blocked.
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -36,14 +36,12 @@ async function buildClientScript() {
|
|
|
36
36
|
console.log('Obfuscating client script...');
|
|
37
37
|
const obfuscationResult = JavaScriptObfuscator.obfuscate(clientScriptContent, {
|
|
38
38
|
compact: true,
|
|
39
|
-
controlFlowFlattening: true, //
|
|
40
|
-
deadCodeInjection: true, //
|
|
39
|
+
controlFlowFlattening: true, // Flattens control flow
|
|
40
|
+
deadCodeInjection: true, // Injects dead code
|
|
41
41
|
stringArray: true,
|
|
42
|
-
stringArrayRotate: true, //
|
|
43
|
-
stringArrayShuffle: true, //
|
|
44
|
-
//
|
|
45
|
-
// pour une même entrée. Pour une obfuscation unique à chaque build, on peut utiliser
|
|
46
|
-
// une graine aléatoire, par exemple : seed: Math.random()
|
|
42
|
+
stringArrayRotate: true, // Rotates the string array
|
|
43
|
+
stringArrayShuffle: true, // Shuffles the string array
|
|
44
|
+
// Using a fixed seed yields deterministic obfuscation. For unique builds, use Math.random()
|
|
47
45
|
seed: Math.random(),
|
|
48
46
|
selfDefending: true,
|
|
49
47
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* cyrb53 hashing algorithm (fast with low collision rate).
|
|
3
3
|
*/
|
|
4
|
-
//
|
|
4
|
+
// Exported for fallback usage by fingerprint.client.js
|
|
5
5
|
export const cyrb53 = (str, seed = 0) => {
|
|
6
6
|
const safeStr = (typeof str === 'string' ? str : String(str || '')).slice(0, 10000);
|
|
7
7
|
let h1 = 0xdeadbeef ^ seed,
|
|
@@ -21,25 +21,25 @@ export const cyrb53 = (str, seed = 0) => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* Class for constructing a composite fingerprint (Multi-Hash).
|
|
25
|
+
* Output format: "grp1:hash1|grp2:hash2|grp3:hash3"
|
|
26
26
|
*/
|
|
27
27
|
export class FingerprintBuilder {
|
|
28
28
|
constructor() {
|
|
29
|
-
//
|
|
29
|
+
// The hasher is an instance property so it can be overridden by the WASM client.
|
|
30
30
|
this.components = new Map();
|
|
31
|
-
//
|
|
31
|
+
// Default hasher set to the JavaScript cyrb53 implementation.
|
|
32
32
|
this.hasher = cyrb53;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @param {string} group -
|
|
38
|
-
* @param {string|number|boolean} value -
|
|
36
|
+
* Adds a component to the global hash.
|
|
37
|
+
* @param {string} group - Component group identifier (e.g. 'hw', 'screen', 'geo').
|
|
38
|
+
* @param {string|number|boolean} value - Raw value to hash.
|
|
39
39
|
*/
|
|
40
40
|
add(group, value) {
|
|
41
41
|
if (value === undefined || value === null) return this;
|
|
42
|
-
//
|
|
42
|
+
// Hash the value individually to anonymize and normalize length
|
|
43
43
|
this.components.set(group, this.hasher(String(value)));
|
|
44
44
|
return this;
|
|
45
45
|
}
|
|
@@ -57,8 +57,8 @@ export class FingerprintBuilder {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
* @param {string} [title='FingerprintBuilder Components'] -
|
|
60
|
+
* Prints current components to the console.
|
|
61
|
+
* @param {string} [title='FingerprintBuilder Components'] - Title for output display.
|
|
62
62
|
*/
|
|
63
63
|
log(title = 'FingerprintBuilder Components') {
|
|
64
64
|
console.log(`--- ${title} ---`);
|
|
@@ -71,12 +71,12 @@ export class FingerprintBuilder {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
74
|
+
* Produces the final serialized signature string.
|
|
75
|
+
* Keys are sorted to guarantee deterministic serialization.
|
|
76
76
|
*/
|
|
77
77
|
toString() {
|
|
78
78
|
return Array.from(this.components.entries())
|
|
79
|
-
.sort((a, b) => a[0].localeCompare(b[0])) //
|
|
79
|
+
.sort((a, b) => a[0].localeCompare(b[0])) // Alphabetical key ordering
|
|
80
80
|
.map(([key, hash]) => `${key}:${hash}`)
|
|
81
81
|
.join("|");
|
|
82
82
|
}
|
|
@@ -118,30 +118,29 @@ export class FingerprintBuilder {
|
|
|
118
118
|
'x_forwarded_for', 'x_real_ip', 'cf_connecting_ip'
|
|
119
119
|
]);
|
|
120
120
|
|
|
121
|
-
//
|
|
122
|
-
//
|
|
121
|
+
// Entropy / stability reliability weights
|
|
122
|
+
// Strongly invariant signals receive higher weighting
|
|
123
123
|
const weights = {
|
|
124
|
-
// ---
|
|
125
|
-
cvs: 5.0, // Canvas:
|
|
126
|
-
gpu: 4.0, // GPU:
|
|
127
|
-
ja3: 3.5, // JA3:
|
|
128
|
-
ja4: 4.0, // JA4:
|
|
124
|
+
// --- High-entropy invariants (tamper-resistant) ---
|
|
125
|
+
cvs: 5.0, // Canvas: High entropy (GPU/driver rendering quirks)
|
|
126
|
+
gpu: 4.0, // GPU: High entropy (Physical graphics chipset)
|
|
127
|
+
ja3: 3.5, // JA3: TLS client stack fingerprint
|
|
128
|
+
ja4: 4.0, // JA4: Modern TLS fingerprint including HTTP/2
|
|
129
129
|
h2: 3.0, // HTTP/2 settings frame fingerprint
|
|
130
130
|
tcp: 2.5, // TCP/IP fingerprint
|
|
131
|
-
ua: 2.0, // User-Agent
|
|
131
|
+
ua: 2.0, // User-Agent string
|
|
132
132
|
|
|
133
|
-
// ---
|
|
134
|
-
client_fp_hash: 3.0, //
|
|
135
|
-
browser: 1.5, //
|
|
136
|
-
os_version: 1.5, //
|
|
137
|
-
device_type: 1.0, //
|
|
138
|
-
|
|
139
|
-
// ---
|
|
140
|
-
hw: 1.5, // Hardware (
|
|
141
|
-
scr: 1.0, // Screen:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
geo: 0.5, // Geo/Langue: Peut changer (VPN, voyage)
|
|
133
|
+
// --- Derived / composite signals ---
|
|
134
|
+
client_fp_hash: 3.0, // Client-side fingerprint hash
|
|
135
|
+
browser: 1.5, // Parsed browser family
|
|
136
|
+
os_version: 1.5, // Parsed OS family
|
|
137
|
+
device_type: 1.0, // Device form factor
|
|
138
|
+
|
|
139
|
+
// --- Medium-stability signals ---
|
|
140
|
+
hw: 1.5, // Hardware (cores, RAM): Moderate stability
|
|
141
|
+
scr: 1.0, // Screen geometry: Moderate stability
|
|
142
|
+
os: 0.8, // OS (nav.platform)
|
|
143
|
+
geo: 0.5, // Geo/locale: Subject to VPNs and travel
|
|
145
144
|
};
|
|
146
145
|
|
|
147
146
|
let weightedMatches = 0;
|
|
@@ -150,16 +149,16 @@ export class FingerprintBuilder {
|
|
|
150
149
|
const allKeys = new Set([...map1.keys(), ...map2.keys()]);
|
|
151
150
|
|
|
152
151
|
allKeys.forEach((key) => {
|
|
153
|
-
//
|
|
152
|
+
// Ignore volatile keys during comparative evaluation
|
|
154
153
|
if (volatileKeys.has(key)) {
|
|
155
154
|
return;
|
|
156
155
|
}
|
|
157
156
|
|
|
158
157
|
const weight = weights[key] ?? 0;
|
|
159
|
-
//
|
|
158
|
+
// Only tally total weight if key is present in at least one fingerprint
|
|
160
159
|
if (!map1.has(key) && !map2.has(key)) return;
|
|
161
160
|
|
|
162
|
-
totalWeight += weight;
|
|
161
|
+
totalWeight += weight;
|
|
163
162
|
if (map1.get(key) === map2.get(key)) {
|
|
164
163
|
weightedMatches += weight;
|
|
165
164
|
}
|