{"id":28701,"date":"2026-11-28T07:54:58","date_gmt":"2026-11-28T07:54:58","guid":{"rendered":"https:\/\/capskip.com\/?p=28701"},"modified":"2026-11-28T07:54:58","modified_gmt":"2026-11-28T07:54:58","slug":"ja3-fingerprint-nodejs","status":"publish","type":"post","link":"https:\/\/capskip.com\/zh\/ja3-fingerprint-nodejs\/","title":{"rendered":"Node.js \u4e2d\u7684 JA3 \u6307\u7eb9\uff1a\u54ea\u4e9b\u80fd\u6539\uff0c\u54ea\u4e9b\u4e0d\u80fd\u6539"},"content":{"rendered":"<p>To read a JA3 fingerprint in Node.js, capture the ClientHello that your own code sends: run a small listener, connect to it with global fetch, https.request and tls.connect, and hash what arrives. On Windows 11 each client kept one JA3, the TLS options moved it without ever reaching the Chrome hash, and Chrome sent a new JA3 on every connection. Below are the listener, the numbers, a client that impersonates a browser, and where CapSkip enters: it solves the CAPTCHA you are served after the handshake passes and never changes a fingerprint.<\/p>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">What you need<\/h2>\n<ul>\n<li>Node.js 20 or later: the impit package declares 20 in its engines field and the capskip package 1.8.0 declares 18. I ran the blocks on Node.js 20.11.1, 24.22.0 (OpenSSL 3.5.8) and 25.2.1, apart from the Chrome capture (24.22.0 only) and one block that needs 24, and none on 18.<\/li>\n<li>Install both packages with the command in step 1. On Windows impit loads a prebuilt binary from an optional package named impit-win32-x64-msvc. My install on npm 11.19.1 added three packages and printed no warning.<\/li>\n<li>Google Chrome on the same PC for the browser capture. I used 157.0.8103.78, headless, with a new profile per start.<\/li>\n<li>CapSkip 5.7.0 on a Windows PC for the last step, installed as the setup guide describes. No CapSkip server answered on 127.0.0.1:8080 while I wrote this, so every CapSkip result comes from a mock of in.php and res.php that I wrote.<\/li>\n<li>An address for CapSkip. In Local mode CapSkip answers only on 127.0.0.1. Server mode also accepts other machines on your network or a public IP, so the script may run elsewhere, as described in the <a href=\"https:\/\/capskip.com\/setup-guide\/#connection-settings\">connection settings<\/a> section of the setup guide.<\/li>\n<\/ul>\n<p>Every rule below that blocks or accepts a handshake is a mock rule of mine, standing in for whatever a real site does. I sent nothing to a real CAPTCHA site. Cloudflare <a href=\"https:\/\/developers.cloudflare.com\/bots\/additional-configurations\/ja3-ja4-fingerprint\/\" rel=\"noopener nofollow\" target=\"_blank\">documents JA3 and JA4<\/a>, and JA4 is specified in the <a href=\"https:\/\/github.com\/FoxIO-LLC\/ja4\" rel=\"noopener nofollow\" target=\"_blank\">FoxIO repository<\/a>. For the Python version, which swaps the library and reads a public echo, see the <a href=\"https:\/\/capskip.com\/tls-fingerprinting-python\/\">Python guide<\/a>.<\/p>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">Step 1: read your own ClientHello<\/h2>\n<p>A TLS library parses the ClientHello and keeps it from you, so read the bytes before any TLS code runs. JA3 is the MD5 of five fields of the hello with GREASE values removed. JA4 sorts the ciphers and the extensions before hashing and adds the signature algorithms in sent order, so extension order does not matter to it.<\/p>\n<div data-no-translation>\n<pre data-enlighter-language=\"bash\" class=\"EnlighterJSRAW\"># In PowerShell, in a new empty folder\nnpm init -y\nnpm install capskip impit<\/pre>\n<\/div>\n<p>Save the next three blocks as one file named hello.mjs, in order. The listener needs no certificate, so every client below ends with a failed handshake.<\/p>\n<div data-no-translation>\n<pre data-enlighter-language=\"js\" class=\"EnlighterJSRAW\">\/\/ hello.mjs (part 1 of 3): read a ClientHello out of the raw bytes of the first TLS record.\nimport net from &quot;node:net&quot;;\nimport { createHash } from &quot;node:crypto&quot;;\n\nconst grease = (v) =&gt; (v &amp; 0x0f0f) === 0x0a0a; \/\/ 0x0a0a, 0x1a1a ... 0xfafa\nconst u16 = (b, at) =&gt; b.readUInt16BE(at);\n\nfunction parse(b) {\n  let p = 43; \/\/ 5 record header + 4 handshake header + 2 version + 32 random\n  p += 1 + b[p]; \/\/ session id\n  const n = u16(b, p);\n  p += 2;\n  const ciphers = [];\n  for (let i = 0; i &lt; n; i += 2) ciphers.push(u16(b, p + i));\n  p += n;\n  p += 1 + b[p]; \/\/ compression methods\n  const end = p + 2 + u16(b, p);\n  p += 2;\n  const ext = []; \/\/ extension ids in wire order\n  const data = {};\n  while (p + 4 &lt;= end) {\n    const id = u16(b, p);\n    const len = u16(b, p + 2);\n    ext.push(id);\n    data[id] = b.subarray(p + 4, p + 4 + len);\n    p += 4 + len;\n  }\n  const list = (id, skip) =&gt; {\n    const out = [];\n    const d = data[id];\n    if (d) for (let i = skip; i + 1 &lt; d.length; i += 2) out.push(u16(d, i));\n    return out;\n  };\n  return {\n    version: u16(b, 9), ciphers, ext, sni: Boolean(data[0]),\n    groups: list(10, 2), sigalgs: list(13, 2), versions: list(43, 1),\n    points: data[11] ? [...data[11].subarray(1)] : [],\n    alpn: data[16] ? data[16].subarray(3, 3 + data[16][2]).toString() : &quot;&quot;,\n  };\n}<\/pre>\n<\/div>\n<div data-no-translation>\n<pre data-enlighter-language=\"js\" class=\"EnlighterJSRAW\">\/\/ hello.mjs (part 2 of 3, same file): JA3 and JA4 from the parsed hello.\nconst md5 = (s) =&gt; createHash(&quot;md5&quot;).update(s).digest(&quot;hex&quot;);\nconst sha = (s) =&gt; createHash(&quot;sha256&quot;).update(s).digest(&quot;hex&quot;).slice(0, 12);\nconst hex = (v) =&gt; v.toString(16).padStart(4, &quot;0&quot;);\nconst keep = (list) =&gt; list.filter((v) =&gt; !grease(v));\nconst two = (n) =&gt; String(Math.min(n, 99)).padStart(2, &quot;0&quot;);\n\nfunction fingerprints(h) {\n  const c = keep(h.ciphers);\n  const e = keep(h.ext);\n  \/\/ JA3: five fields, GREASE removed, extensions in the order they were sent\n  const ja3 = md5([h.version, c.join(&quot;-&quot;), e.join(&quot;-&quot;), keep(h.groups).join(&quot;-&quot;), h.points.join(&quot;-&quot;)].join(&quot;,&quot;));\n  \/\/ JA4, as the FoxIO spec defines it: a_b_c\n  const top = Math.max(0, ...keep(h.versions)) || h.version;\n  const version = { 0x304: &quot;13&quot;, 0x303: &quot;12&quot;, 0x302: &quot;11&quot;, 0x301: &quot;10&quot; }[top] || &quot;00&quot;;\n  const alpn = h.alpn ? h.alpn[0] + h.alpn.at(-1) : &quot;00&quot;; \/\/ h2 or h1 (the spec has extra rules for odd values)\n  const a = `t${version}${h.sni ? &quot;d&quot; : &quot;i&quot;}${two(c.length)}${two(e.length)}${alpn}`;\n  const b = sha(c.map(hex).sort().join(&quot;,&quot;)); \/\/ ciphers sorted\n  const sorted = e.filter((v) =&gt; v !== 0 &amp;&amp; v !== 16).map(hex).sort().join(&quot;,&quot;); \/\/ no SNI, no ALPN\n  const sig = keep(h.sigalgs).map(hex).join(&quot;,&quot;); \/\/ signature algorithms stay in sent order\n  return { ja3, ja4: `${a}_${b}_${sha(sig ? `${sorted}_${sig}` : sorted)}` };\n}<\/pre>\n<\/div>\n<div data-no-translation>\n<pre data-enlighter-language=\"js\" class=\"EnlighterJSRAW\">\/\/ hello.mjs (part 3 of 3, same file): listen, read the first record, report, close.\nexport function listen(port, onHello) {\n  const server = net.createServer((socket) =&gt; {\n    let buf = Buffer.alloc(0);\n    socket.on(&quot;error&quot;, () =&gt; {});\n    socket.on(&quot;data&quot;, (chunk) =&gt; {\n      buf = Buffer.concat([buf, chunk]);\n      if (buf.length &lt; 5 || buf.length &lt; 5 + u16(buf, 3)) return; \/\/ wait for the whole record\n      socket.destroy(); \/\/ no certificate here: the hello is all we need\n      onHello(fingerprints(parse(buf)));\n    });\n  });\n  return new Promise((resolve) =&gt; server.listen(port, &quot;127.0.0.1&quot;, () =&gt; resolve(server)));\n}<\/pre>\n<\/div>\n<p>Two checks. The JA4 specification publishes a worked example, and these blocks gave exactly its value from raw bytes: t13d1516h2_8daaf6152771_e5627efa2ab1. For JA3 I cross-checked three clients once against the public echo at tls.browserleaks.com (Node.js 24.22.0, curl 8.21.0 with Schannel): global fetch matched on JA3 and JA4, curl.exe matched once it trusted my test certificate, and impit matched on JA4 with a JA3 my listener had also recorded.<\/p>\n<p>Save this as measure.mjs and run node measure.mjs to connect with the three clients that ship with Node.js.<\/p>\n<div data-no-translation>\n<pre data-enlighter-language=\"js\" class=\"EnlighterJSRAW\">\/\/ measure.mjs: start the listener, then connect with each built-in Node client five times.\nimport https from &quot;node:https&quot;;\nimport tls from &quot;node:tls&quot;;\nimport { listen } from &quot;.\/hello.mjs&quot;;\n\nconst PORT = 12600;\nconst seen = [];\nawait listen(PORT, (fp) =&gt; seen.push(fp));\n\n\/\/ Each client fails at the handshake, because the listener hangs up. That is fine.\nconst clients = {\n  &quot;fetch&quot;: () =&gt; fetch(`https:\/\/localhost:${PORT}\/`),\n  &quot;https.request&quot;: () =&gt; new Promise((done) =&gt; https.get(`https:\/\/localhost:${PORT}\/`, { agent: false }).on(&quot;error&quot;, done)),\n  &quot;tls.connect&quot;: () =&gt; new Promise((done) =&gt; tls.connect({ host: &quot;localhost&quot;, port: PORT }).on(&quot;error&quot;, done)),\n};\n\nfor (const [name, connect] of Object.entries(clients)) {\n  const from = seen.length;\n  for (let i = 0; i &lt; 5; i++) await connect().catch(() =&gt; {});\n  const mine = seen.slice(from);\n  const distinct = (key) =&gt; new Set(mine.map((fp) =&gt; fp[key])).size;\n  console.log(name.padEnd(14), `${mine.length} hellos, JA3 x${distinct(&quot;ja3&quot;)}, JA4 x${distinct(&quot;ja4&quot;)}`, mine[0].ja3, mine[0].ja4);\n}\nprocess.exit(0);<\/pre>\n<\/div>\n<p>Each client gave one JA3 and one JA4 over five connections (Windows 11, first 8 characters of each JA3).<\/p>\n<table>\n<thead>\n<tr>\n<th>Client<\/th>\n<th>JA3, Node.js 24.22.0<\/th>\n<th>JA4 part a, 24.22.0<\/th>\n<th>JA3, Node.js 20.11.1<\/th>\n<th>JA4 part a, 20.11.1<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Global fetch<\/td>\n<td>d67b0948<\/td>\n<td>t13d5212h1<\/td>\n<td>1a28e690<\/td>\n<td>t13d5911h1<\/td>\n<\/tr>\n<tr>\n<td>https.request<\/td>\n<td>944d1e18<\/td>\n<td>t13d521100<\/td>\n<td>0cce74b0<\/td>\n<td>t13d591000<\/td>\n<\/tr>\n<tr>\n<td>tls.connect<\/td>\n<td>e29263fb<\/td>\n<td>t13i521000<\/td>\n<td>6521bd74<\/td>\n<td>t13i590900<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The three differ in two things Node.js leaves to the caller. Global fetch offers ALPN http\/1.1 and the others offer none, and tls.connect sends no SNI unless you pass a servername. Without those, the cipher and extension blocks of the JA4 are identical across all three: b262b3658495 and 8e6e362c5eac on 24.22.0. Node.js 20.11.1 runs on OpenSSL 3.0.13 and offers 59 suites against 52, so one JA3 describes a client on one Node.js build, not &quot;Node.js&quot;.<\/p>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">Step 2: see which options move which hash<\/h2>\n<p>The tls.connect options are the levers Node.js gives you, and https.request passes them through. Save this as knobs.mjs next to hello.mjs and run node knobs.mjs. It changes one option per connection and compares with the default.<\/p>\n<div data-no-translation>\n<pre data-enlighter-language=\"js\" class=\"EnlighterJSRAW\">\/\/ knobs.mjs: change one tls.connect option at a time and see which hash moves.\nimport tls from &quot;node:tls&quot;;\nimport { constants } from &quot;node:crypto&quot;;\nimport { listen } from &quot;.\/hello.mjs&quot;;\n\nconst PORT = 12600;\nconst seen = [];\nawait listen(PORT, (fp) =&gt; seen.push(fp));\n\nconst reversed = tls.DEFAULT_CIPHERS.split(&quot;:&quot;).reverse().join(&quot;:&quot;);\nconst variants = {\n  &quot;default&quot;: {},\n  &quot;ciphers, reversed order&quot;: { ciphers: reversed },\n  &quot;ciphers, one TLS 1.2 suite&quot;: { ciphers: &quot;ECDHE-RSA-AES128-GCM-SHA256&quot; },\n  &quot;ecdhCurve P-256&quot;: { ecdhCurve: &quot;P-256&quot; },\n  &quot;sigalgs, two entries&quot;: { sigalgs: &quot;rsa_pss_rsae_sha256:ecdsa_secp256r1_sha256&quot; },\n  &quot;maxVersion TLSv1.2&quot;: { maxVersion: &quot;TLSv1.2&quot; },\n  &quot;minVersion TLSv1.3&quot;: { minVersion: &quot;TLSv1.3&quot; },\n  &quot;ALPNProtocols h2&quot;: { ALPNProtocols: [&quot;h2&quot;, &quot;http\/1.1&quot;] },\n  &quot;SSL_OP_NO_TICKET&quot;: { secureOptions: constants.SSL_OP_NO_TICKET },\n  &quot;requestOCSP&quot;: { requestOCSP: true },\n  &quot;rejectUnauthorized false&quot;: { rejectUnauthorized: false },\n  &quot;servername, another name&quot;: { servername: &quot;example.test&quot; },\n};\n\nconst rows = [];\nfor (const [name, options] of Object.entries(variants)) {\n  const socket = tls.connect({ host: &quot;localhost&quot;, servername: &quot;localhost&quot;, port: PORT, ...options });\n  await new Promise((done) =&gt; socket.on(&quot;error&quot;, done));\n  rows.push([name, seen.at(-1)]);\n}\nconst base = rows[0][1];\nfor (const [name, fp] of rows) {\n  const moved = [fp.ja3 !== base.ja3 &amp;&amp; &quot;JA3&quot;, fp.ja4 !== base.ja4 &amp;&amp; &quot;JA4&quot;].filter(Boolean).join(&quot; and &quot;) || &quot;nothing&quot;;\n  console.log(name.padEnd(28), &quot;moves&quot;, moved.padEnd(12), fp.ja4);\n}\nprocess.exit(0);<\/pre>\n<\/div>\n<p>On Node.js 24.22.0, and the same on 25.2.1:<\/p>\n<table>\n<thead>\n<tr>\n<th>Option<\/th>\n<th>JA3<\/th>\n<th>JA4<\/th>\n<th>What changed in the hello<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>&quot;ciphers&quot;, reversed order<\/td>\n<td>moves<\/td>\n<td>same<\/td>\n<td>Order of the 52 suites only<\/td>\n<\/tr>\n<tr>\n<td>&quot;ciphers&quot;, one TLS 1.2 suite<\/td>\n<td>moves<\/td>\n<td>moves<\/td>\n<td>52 suites become 4<\/td>\n<\/tr>\n<tr>\n<td>ecdhCurve<\/td>\n<td>moves<\/td>\n<td>same<\/td>\n<td>The groups list only<\/td>\n<\/tr>\n<tr>\n<td>sigalgs<\/td>\n<td>moves<\/td>\n<td>moves<\/td>\n<td>Signature list, and 52 suites fell to 44<\/td>\n<\/tr>\n<tr>\n<td>maxVersion TLSv1.2<\/td>\n<td>moves<\/td>\n<td>moves<\/td>\n<td>No TLS 1.3: 49 suites and 8 extensions<\/td>\n<\/tr>\n<tr>\n<td>minVersion TLSv1.3<\/td>\n<td>moves<\/td>\n<td>moves<\/td>\n<td>Only the 3 TLS 1.3 suites, and no renegotiation_info extension<\/td>\n<\/tr>\n<tr>\n<td>ALPNProtocols<\/td>\n<td>moves<\/td>\n<td>moves<\/td>\n<td>Adds one extension, the first value gives h2 or h1<\/td>\n<\/tr>\n<tr>\n<td>secureOptions with SSL_OP_NO_TICKET<\/td>\n<td>moves<\/td>\n<td>moves<\/td>\n<td>Drops the session ticket extension<\/td>\n<\/tr>\n<tr>\n<td>requestOCSP<\/td>\n<td>moves<\/td>\n<td>moves<\/td>\n<td>Adds the status request extension<\/td>\n<\/tr>\n<tr>\n<td>rejectUnauthorized, the servername text<\/td>\n<td>same<\/td>\n<td>same<\/td>\n<td>Certificate checks only<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Node.js 20.11.1 showed the same pattern, except that it threw ERR_CRYPTO_OPERATION_FAILED for the group X25519MLKEM768 in ecdhCurve, which 24.22.0 and 25.2.1 accepted. No option reordered the extensions, which kept the order OpenSSL chose, and options only removed or added some. None of them adds GREASE, encrypted client hello, ALPS or certificate compression.<\/p>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">Step 3: measure Chrome, then see how far options get you<\/h2>\n<p>Capture Chrome with the same code. Save this as watch.mjs and run node watch.mjs &gt; hellos.txt in one window. The second block, in another PowerShell window, starts Chrome twelve times and counts the lines. Chrome retries after a hang-up, so each start gives several hellos.<\/p>\n<div data-no-translation>\n<pre data-enlighter-language=\"js\" class=\"EnlighterJSRAW\">\/\/ watch.mjs: print one line per ClientHello that reaches the listener.\nimport { listen } from &quot;.\/hello.mjs&quot;;\n\nawait listen(12600, (fp) =&gt; console.log(fp.ja3, fp.ja4));\nconsole.error(&quot;listening on 12600&quot;); \/\/ stderr, so a redirect keeps only the hellos<\/pre>\n<\/div>\n<div data-no-translation>\n<pre data-enlighter-language=\"bash\" class=\"EnlighterJSRAW\"># Window 1: node watch.mjs &gt; hellos.txt\n# Window 2: twelve separate Chrome starts, then a count of what the listener saw.\n$chrome = &quot;C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe&quot;\n1..12 | ForEach-Object {\n  $profileDir = Join-Path $env:TEMP &quot;ja3-profile-$_&quot; # a new profile each time: no saved session\n  $p = Start-Process $chrome -ArgumentList &quot;--headless=new&quot;, &quot;--user-data-dir=$profileDir&quot;, &quot;https:\/\/localhost:12600\/&quot; -PassThru\n  Start-Sleep -Seconds 4\n  taskkill \/PID $p.Id \/T \/F | Out-Null\n}\n$hellos = Get-Content hellos.txt\n$ja3 = $hellos | ForEach-Object { ($_ -split &quot; &quot;)[0] } | Sort-Object -Unique\n$ja4 = $hellos | ForEach-Object { ($_ -split &quot; &quot;)[1] } | Sort-Object -Unique\n&quot;{0} hellos, {1} distinct JA3, {2} distinct JA4&quot; -f $hellos.Count, $ja3.Count, $ja4.Count<\/pre>\n<\/div>\n<p>My results on Windows 11 with Chrome 157.0.8103.78 installed, headless. The two harness rows use a harness with a full TLS answer, not shown here, and hello counts depend on the machine.<\/p>\n<table>\n<thead>\n<tr>\n<th>Setup<\/th>\n<th>Hellos<\/th>\n<th>Different JA3<\/th>\n<th>Different JA4<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Twelve Chrome starts, block above (four runs on one machine)<\/td>\n<td>153 to 174<\/td>\n<td>153 to 174, never a repeat<\/td>\n<td>1 each run<\/td>\n<\/tr>\n<tr>\n<td>One Chrome, twelve requests to twelve new host names, my full harness<\/td>\n<td>12<\/td>\n<td>12<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>One Chrome, twelve requests to one host name, my full harness<\/td>\n<td>12<\/td>\n<td>12<\/td>\n<td>2<\/td>\n<\/tr>\n<tr>\n<td>Node.js 24.22.0 fetch, five connections<\/td>\n<td>5<\/td>\n<td>1<\/td>\n<td>1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Chrome never repeated a JA3 and Node.js never changed one. Each Chrome hello carried GREASE values in its cipher, extension, group and signature algorithm lists, which both hashes drop, and the same extensions in a new order, which is why JA3 changes and JA4 does not. The single host name gave a second JA4 because in my runs 10 or 11 of the 12 connections resumed a session and carried a pre-shared-key extension. Cloudflare says a resumed connection gets no new fingerprint, so never copy a JA4 from one.<\/p>\n<p>A JA4 holds for one build, not for all of Chrome. The installed Chrome had 158.0.8127.37 staged for its next restart, so yours may differ. Twelve connections each, one JA4 per row:<\/p>\n<table>\n<thead>\n<tr>\n<th>Client<\/th>\n<th>JA4<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Chrome 157.0.8103.78, installed<\/td>\n<td>t13d1517h2_8daaf6152771_cb7bf5808d99<\/td>\n<\/tr>\n<tr>\n<td>Chrome for Testing 157.0.8103.78, same version number, one extra extension (12e0)<\/td>\n<td>t13d1518h2_8daaf6152771_4980c97edce0<\/td>\n<\/tr>\n<tr>\n<td>Chrome for Testing 149.0.7827.22<\/td>\n<td>t13d1517h2_8daaf6152771_dcad5a053991<\/td>\n<\/tr>\n<tr>\n<td>Chromium 145.0.7632.6, Playwright build<\/td>\n<td>t13d1517h2_8daaf6152771_dcad5a053991<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Can options alone build that hello? The next block sets everything I found that helps. It needs Node.js 24 or later, because 20.11.1 throws error:00000000:lib(0)::reason(0) on the sigalgs option. Stop watch.mjs with Ctrl+C first, as every later block listens on the same port.<\/p>\n<div data-no-translation>\n<pre data-enlighter-language=\"js\" class=\"EnlighterJSRAW\">\/\/ tuned.mjs: the closest hello that plain tls.connect options can build to Chrome.\nimport tls from &quot;node:tls&quot;;\nimport { constants } from &quot;node:crypto&quot;;\nimport { listen } from &quot;.\/hello.mjs&quot;;\n\n\/\/ Chrome cipher suites, in the order Chrome sends them (the first three are TLS 1.3).\nconst ciphers = [\n  &quot;TLS_AES_128_GCM_SHA256&quot;, &quot;TLS_AES_256_GCM_SHA384&quot;, &quot;TLS_CHACHA20_POLY1305_SHA256&quot;,\n  &quot;ECDHE-ECDSA-AES128-GCM-SHA256&quot;, &quot;ECDHE-RSA-AES128-GCM-SHA256&quot;,\n  &quot;ECDHE-ECDSA-AES256-GCM-SHA384&quot;, &quot;ECDHE-RSA-AES256-GCM-SHA384&quot;,\n  &quot;ECDHE-ECDSA-CHACHA20-POLY1305&quot;, &quot;ECDHE-RSA-CHACHA20-POLY1305&quot;,\n  &quot;ECDHE-RSA-AES128-SHA&quot;, &quot;ECDHE-RSA-AES256-SHA&quot;,\n  &quot;AES128-GCM-SHA256&quot;, &quot;AES256-GCM-SHA384&quot;, &quot;AES128-SHA&quot;, &quot;AES256-SHA&quot;,\n].join(&quot;:&quot;);\nconst sigalgs = [\n  &quot;mldsa44&quot;, &quot;mldsa65&quot;, &quot;mldsa87&quot;, &quot;ecdsa_secp256r1_sha256&quot;, &quot;rsa_pss_rsae_sha256&quot;,\n  &quot;rsa_pkcs1_sha256&quot;, &quot;ecdsa_secp384r1_sha384&quot;, &quot;rsa_pss_rsae_sha384&quot;,\n  &quot;rsa_pkcs1_sha384&quot;, &quot;rsa_pss_rsae_sha512&quot;, &quot;rsa_pkcs1_sha512&quot;,\n].join(&quot;:&quot;);\n\nlet fp;\nawait listen(12600, (found) =&gt; (fp = found));\nconst socket = tls.connect({\n  host: &quot;localhost&quot;, servername: &quot;localhost&quot;, port: 12600,\n  ciphers,\n  sigalgs, \/\/ Node.js 24 and 25 accept the mldsa names, Node.js 20.11.1 refuses them\n  ecdhCurve: &quot;X25519MLKEM768:X25519:P-256:P-384&quot;,\n  ALPNProtocols: [&quot;h2&quot;, &quot;http\/1.1&quot;],\n  secureOptions: constants.SSL_OP_NO_ENCRYPT_THEN_MAC, \/\/ drops one extension Chrome lacks\n  requestOCSP: true, \/\/ adds status_request, which Chrome sends\n});\nsocket.on(&quot;error&quot;, () =&gt; {});\nawait new Promise((done) =&gt; socket.on(&quot;close&quot;, done));\nconsole.log(fp.ja3, fp.ja4);\nprocess.exit(0);<\/pre>\n<\/div>\n<p>On 24.22.0 and 25.2.1 this gave the same 15 suites in the same order as Chrome, the same groups and the same signature algorithms apart from GREASE, so the cipher block of its JA4 equals the Chrome one. It still lacked five extensions that no tls.connect option can add: signed certificate timestamp, certificate compression, ALPS, encrypted client hello and trust anchor IDs (id ca34). Its JA4 was t13d1512h2_8daaf6152771_480f8f85d31b against t13d1517h2_8daaf6152771_cb7bf5808d99. Those pieces are not on any cipher list, which is why editing that list never produces the Chrome hash.<\/p>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">Step 4: use a client that builds the hello itself<\/h2>\n<p>A client has to build its own hello to get closer. I tried one package, impit 0.14.9, which installed cleanly on Windows and whose README says it switches TLS fingerprints and headers behind the same API as fetch. Its types list profiles up to chrome151. The block makes a new client per connection, because one client reuses its connection.<\/p>\n<div data-no-translation>\n<pre data-enlighter-language=\"js\" class=\"EnlighterJSRAW\">\/\/ impit_hello.mjs: how steady is the impersonating client? A new Impit per connection.\nimport { Impit } from &quot;impit&quot;;\nimport { listen } from &quot;.\/hello.mjs&quot;;\n\nconst PORT = 12600;\nconst seen = [];\nawait listen(PORT, (fp) =&gt; seen.push(fp));\n\nfor (const browser of [&quot;chrome&quot;, &quot;chrome151&quot;]) {\n  const from = seen.length;\n  for (let i = 0; i &lt; 30; i++) {\n    \/\/ one Impit keeps its connection pool, so a fresh one makes a fresh handshake\n    await new Impit({ browser }).fetch(`https:\/\/localhost:${PORT}\/`).catch(() =&gt; {});\n  }\n  const mine = seen.slice(from);\n  const distinct = (key) =&gt; new Set(mine.map((fp) =&gt; fp[key])).size;\n  console.log(browser.padEnd(10), `${mine.length} hellos, JA3 x${distinct(&quot;ja3&quot;)}, JA4 x${distinct(&quot;ja4&quot;)}`, mine[0].ja4);\n}\nprocess.exit(0);<\/pre>\n<\/div>\n<p>Against my listener, identical on Node.js 20.11.1, 24.22.0 and 25.2.1:<\/p>\n<table>\n<thead>\n<tr>\n<th>impit setup<\/th>\n<th>Clients<\/th>\n<th>Different JA3<\/th>\n<th>Different JA4<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Profile chrome151<\/td>\n<td>30<\/td>\n<td>6<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>Profile chrome151, longer run<\/td>\n<td>150<\/td>\n<td>6<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>Profile chrome<\/td>\n<td>30<\/td>\n<td>2<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>No browser option<\/td>\n<td>10<\/td>\n<td>10<\/td>\n<td>1<\/td>\n<\/tr>\n<tr>\n<td>Profile firefox<\/td>\n<td>10<\/td>\n<td>1<\/td>\n<td>1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>The chrome151 profile sends the same 15 suites in the same order as Chrome 157, the same groups and signature algorithms, and speaks HTTP\/2. It shuffles only a few extensions, so it makes six JA3 values where Chrome makes a new one each time. It sends two GREASE values against four in the cipher, extension and group lists, and impit 0.14.9 lacks ca34, so its JA4 was t13d1516h2_8daaf6152771_806a8c22fdea. The cipher block matched Chrome 157 and the rest did not, and the newest profile is 151 against my 157.<\/p>\n<p>My mock site refuses any handshake whose JA3 is not on a short list. The list holds the six values of the chrome151 profile. Against the mock on Node.js 24.22.0:<\/p>\n<table>\n<thead>\n<tr>\n<th>Client<\/th>\n<th>GET of the page<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Global fetch<\/td>\n<td>403, empty body<\/td>\n<\/tr>\n<tr>\n<td>https.request<\/td>\n<td>403, empty body<\/td>\n<\/tr>\n<tr>\n<td>curl.exe 8.21.0<\/td>\n<td>403<\/td>\n<\/tr>\n<tr>\n<td>impit, profile firefox<\/td>\n<td>403, empty body<\/td>\n<\/tr>\n<tr>\n<td>impit, profile chrome151<\/td>\n<td>200 with the form<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>A JA3 rule is the weak one. Mine had to hold every permutation the profile makes, and real Chrome would need a new entry per connection. With a JA4 rule of one entry the same client passed.<\/p>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">Step 5: solve the CAPTCHA you are served, with the same client<\/h2>\n<p>CapSkip solves the widget in its own browser and returns a token, and your client has to carry the token to the form. Save these three blocks as one file named signup.mjs, in order. The first block reads the sitekey from the data-sitekey attribute of the widget div, in the HTML that the impersonating client fetched. A widget that a script draws, untested here, needs another read.<\/p>\n<div data-no-translation>\n<pre data-enlighter-language=\"js\" class=\"EnlighterJSRAW\">\/\/ signup.mjs (part 1 of 3): one impersonating client for the page, the solve and the form post.\nimport { Impit } from &quot;impit&quot;;\nimport { CapSkip, ApiException, NetworkException, TimeoutException, ValidationException } from &quot;capskip&quot;;\n\nconst SITE = process.env.SITE || &quot;https:\/\/example.com\/&quot;;\nconst POST_WITH = process.env.POST_WITH || &quot;impit&quot;; \/\/ &quot;fetch&quot; shows the wrong way\n\/\/ CapSkip listens on 8080 by default. In Server mode, use the address of the server as host.\nconst solver = new CapSkip({ host: &quot;127.0.0.1&quot;, port: Number(process.env.CAPSKIP_PORT || 8080) });\n\/\/ ignoreTlsErrors is on only for a test site with a self-signed certificate.\nconst client = new Impit({ browser: &quot;chrome151&quot;, ignoreTlsErrors: process.env.SELF_SIGNED === &quot;1&quot; });\n\nasync function readSitekey() {\n  const page = await client.fetch(SITE);\n  const html = await page.text();\n  if (page.status === 403 &amp;&amp; html === &quot;&quot;) throw new Error(&quot;blocked before any HTML: check the handshake first&quot;);\n  const found = html.match(\/data-sitekey=[&quot;']([^&quot;']+)[&quot;']\/);\n  if (!found) throw new Error(`no data-sitekey on the page (HTTP ${page.status})`);\n  return found[1];\n}<\/pre>\n<\/div>\n<p>The form post leaves through the same client that fetched the page, with the Referer and Origin headers a browser would add, because global fetch sends neither. Change login and the email field to the action and field names of your own form.<\/p>\n<div data-no-translation>\n<pre data-enlighter-language=\"js\" class=\"EnlighterJSRAW\">\/\/ signup.mjs (part 2 of 3, same file): the form post goes out through the same client.\nasync function submit(token, email) {\n  const body = new URLSearchParams({ email, &quot;g-recaptcha-response&quot;: token }).toString();\n  const headers = {\n    &quot;content-type&quot;: &quot;application\/x-www-form-urlencoded&quot;,\n    referer: SITE,\n    origin: new URL(SITE).origin,\n  };\n  const send = POST_WITH === &quot;fetch&quot; ? fetch : (url, init) =&gt; client.fetch(url, init);\n  const res = await send(new URL(&quot;login&quot;, SITE), { method: &quot;POST&quot;, headers, body });\n  return { status: res.status, text: await res.text() };\n}<\/pre>\n<\/div>\n<p>The last block solves once, right before the form post. The call is recaptcha(sitekey, url, options) from capskip 1.8.0 and it resolves to an object with captchaId and code. The token is in result.code, for the g-recaptcha-response field.<\/p>\n<div data-no-translation>\n<pre data-enlighter-language=\"js\" class=\"EnlighterJSRAW\">\/\/ signup.mjs (part 3 of 3, same file): read the sitekey, solve once, post right away.\ntry {\n  const sitekey = await readSitekey();\n  const started = Date.now();\n  \/\/ recaptcha(sitekey, url, options): timeout is in seconds, the SDK default is 300.\n  const result = await solver.recaptcha(sitekey, SITE, { timeout: 120 });\n  console.log(`token of ${result.code.length} characters after ${((Date.now() - started) \/ 1000).toFixed(1)} s`);\n  console.log(await submit(result.code, &quot;alice@example.com&quot;)); \/\/ the token is single use\n} catch (err) {\n  if (err instanceof ValidationException) console.log(&quot;refused before sending:&quot;, err.message);\n  else if (err instanceof ApiException) console.log(&quot;CapSkip answered:&quot;, err.message);\n  else if (err instanceof TimeoutException) console.log(&quot;no token in time:&quot;, err.message);\n  else if (err instanceof NetworkException) console.log(&quot;CapSkip not reachable:&quot;, err.message);\n  else console.log(&quot;failed:&quot;, err.message);\n  process.exitCode = 1;\n}<\/pre>\n<\/div>\n<div data-no-translation>\n<pre data-enlighter-language=\"bash\" class=\"EnlighterJSRAW\"># PowerShell: name the page that shows the reCAPTCHA v2 form, then run the script\n$env:SITE = &quot;https:\/\/example.com\/signup&quot;\nnode signup.mjs<\/pre>\n<\/div>\n<p>Against my mock of CapSkip on Node.js 24.22.0, with a mock solve time of 2 seconds, the token arrived 3.8 seconds after the call, because the SDK polls at growing intervals. The form post through impit got HTTP 200. With POST_WITH set to fetch the same flow got 403 and an empty body, because my rule refuses the handshake before it reads the form. My mock did not spend the token then, and a second form post through impit was accepted once and refused as a repeat. A real site may spend it on any form post that reaches it, so solve right before posting.<\/p>\n<p>The recaptchaTimeout default is 300 seconds in the SDK source, and the timeout option, in seconds, replaces it. Against a mock that never answered, a timeout of 4 threw TimeoutException after 7.80 seconds and a timeout of 12 after 12.81, because the SDK tests the clock only after each sleep. A userAgent option for reCAPTCHA v2 is refused with ValidationException before anything is sent. A wrong sitekey or page address returned ApiException with ERROR_GOOGLEKEY or ERROR_PAGEURL from my mock, and the API documentation lists both for the real app.<\/p>\n<h2 style=\"font-size:1.6rem;line-height:1.35;\">FAQ<\/h2>\n<details style=\"border:1px solid #e2e5ee;border-radius:10px;padding:14px 18px;margin:0 0 12px;\">\n<summary style=\"cursor:pointer;\">\n<h3 style=\"font-size:1.15rem;line-height:1.4;display:inline;margin:0;\">Will CapSkip alter the handshake my script sends?<\/h3>\n<\/summary>\n<p style=\"margin:12px 0 0;\">No, and it cannot change a JA3 or a JA4. CapSkip solves the CAPTCHA you were served and hands you a token. The handshake of your form post belongs to your client.<\/p>\n<\/details>\n<details style=\"border:1px solid #e2e5ee;border-radius:10px;padding:14px 18px;margin:0 0 12px;\">\n<summary style=\"cursor:pointer;\">\n<h3 style=\"font-size:1.15rem;line-height:1.4;display:inline;margin:0;\">Can the script run on another machine than CapSkip?<\/h3>\n<\/summary>\n<p style=\"margin:12px 0 0;\">Yes. Server mode lets a Windows machine you control answer the API for other machines, so put its address in host. Once Server mode starts it accepts connections from any address, so a narrower allow rule restricts nothing. To keep out machines you do not expect, add a Windows Firewall block rule for their addresses. I did not try a second machine.<\/p>\n<\/details>\n<details style=\"border:1px solid #e2e5ee;border-radius:10px;padding:14px 18px;margin:0 0 12px;\">\n<summary style=\"cursor:pointer;\">\n<h3 style=\"font-size:1.15rem;line-height:1.4;display:inline;margin:0;\">What does a matching handshake not fix?<\/h3>\n<\/summary>\n<p style=\"margin:12px 0 0;\">Your IP address, which the <a href=\"https:\/\/capskip.com\/captcha-solver-proxy\/\">CAPTCHA solver proxy<\/a> guide covers, and bot-like behaviour after the handshake. A 403 with an empty body, as my mock sends, is a block with no widget in it, so CapSkip has nothing to solve there, and the <a href=\"https:\/\/capskip.com\/captcha-or-block\/\">CAPTCHA or block<\/a> guide tells the two apart. I captured no HTTP\/2 frames or header order and tested no real site.<\/p>\n<\/details>\n<p>If the page serves a challenge after the handshake passes, a flat-license <a href=\"https:\/\/capskip.com\/\">unlimited captcha solver<\/a> on your own PC turns it into a token, and a refused form post costs seconds and no fee. The <a href=\"https:\/\/capskip.com\/recaptcha-v2-nodejs\/\">reCAPTCHA v2 in Node.js<\/a> guide covers that solve in more depth, and the <a href=\"https:\/\/capskip.com\/nodejs-captcha-solver\/\">Node.js CAPTCHA solver<\/a> page lists the other types.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Node.js \u7684 fetch\u3001https.request \u548c tls.connect \u5404\u81ea\u53d1\u51fa\u81ea\u5df1\u7684 JA3\u3002\u4e00\u4e2a\u5c0f\u578b\u76d1\u542c\u5668\u80fd\u663e\u793a\u54ea\u4e9b\u9009\u9879\u4f1a\u6539\u53d8\u5b83\u3001\u4e3a\u4ec0\u4e48\u6ca1\u6709\u4e00\u4e2a\u80fd\u8fbe\u5230 Chrome \u7684\u6c34\u5e73\uff0c\u4ee5\u53ca CapSkip \u5728\u54ea\u91cc\u4ecb\u5165\u3002<\/p>","protected":false},"author":1,"featured_media":28700,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"JA3 Fingerprint in Node.js: Measured, Not Guessed | CapSkip","rank_math_description":"Measure your ja3 fingerprint in Node.js with a listener you run, see which options move it and which never can, then switch client. Copy the code.","rank_math_focus_keyword":"ja3 fingerprint in node.js","footnotes":""},"categories":[70],"tags":[],"class_list":["post-28701","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-captcha"],"_links":{"self":[{"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/posts\/28701","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/comments?post=28701"}],"version-history":[{"count":1,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/posts\/28701\/revisions"}],"predecessor-version":[{"id":29156,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/posts\/28701\/revisions\/29156"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/media\/28700"}],"wp:attachment":[{"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/media?parent=28701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/categories?post=28701"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/capskip.com\/zh\/wp-json\/wp\/v2\/tags?post=28701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}