ShardBrowser icon indicating copy to clipboard operation
ShardBrowser copied to clipboard

[Bug] Canvas noise breaks grayscale RGB invariant (R===G===B) on anti-aliased edges, causing ~50%-70% of random seeds to be flagged as tampered on BrowserScan

Open c-ceulemans opened this issue 4 days ago • 0 comments

Summary

When noise.canvas.enabled is set to true, roughly 50%–70% of randomly generated noise.canvas.seed values (including newly created profiles) are flagged as Canvas tampered (-5%) on https://www.browserscan.net.

Controlled experiments and pixel-level inspection show that this is caused by independent per-channel ±1 noise on anti-aliased edge pixels, which breaks the grayscale invariant (R === G === B) on pure grayscale canvases. canvastest

Environment

  • OS: Windows 10/11 x64
  • ShardBrowser Launcher: 2.1.6
  • Chromium Runtime: 158.0.8127.36 (installed_engine_build: 4)
  • Detection site: https://www.browserscan.net

Controlled Reproduction (Single-Variable Test)

Using the exact same freshly created Windows profile (identical fingerprint fields, clean user-data, only changing noise.canvas.enabled / noise.canvas.seed):

noise.canvas.enabled noise.canvas.seed BrowserScan Canvas Hash BrowserScan Result Non-gray pixels on 120x30 grayscale text probe (R!==G || G!==B)
false (disabled) A802BE06 Pass (No tamper) 0
true 2136230566 (auto-generated) D79BF6F5 Flagged: Canvas tampered (-5%) 50 (max channel diff 1)
true 111111111 E60DFE9D Flagged: Canvas tampered (-5%) 45 (max channel diff 1)
true 222222222 56FBA672 Flagged: Canvas tampered (-5%) 44 (max channel diff 1)
true 333333333 B53EE7EE Pass (No tamper) 48 (max channel diff 1)
true 4088939783 0B7FB822 Pass (No tamper) 45 (max channel diff 1)

Key observations:

  1. Toggling only noise.canvas.seed on the same profile immediately switches between Pass and Canvas tampered.
  2. Even seeds that currently pass BrowserScan still produce ~40–50 chromatic (R !== G or G !== B) edge pixels; they only avoid detection because their perturbed coordinates happen not to hit BrowserScan's probe check points (so any future Chromium/Skia upgrade or probe update re-rolls the ~50% failure rate).

Minimal Repro Snippet (DevTools Console)

Run the following on about:blank in a profile with noise.canvas.enabled = false vs true:

(() => {
  const c = document.createElement('canvas');
  c.width = 120;
  c.height = 30;
  const ctx = c.getContext('2d');
  ctx.fillStyle = '#ffffff';
  ctx.fillRect(0, 0, 120, 30);
  ctx.fillStyle = '#000000';
  ctx.font = '16px Arial';
  ctx.fillText('BrowserScan 123', 4, 22);

  const { data } = ctx.getImageData(0, 0, 120, 30);
  const nonGray = [];
  for (let i = 0; i < data.length; i += 4) {
    const r = data[i], g = data[i + 1], b = data[i + 2], a = data[i + 3];
    if (r !== g || g !== b) {
      const px = i / 4;
      nonGray.push({ x: px % 120, y: Math.floor(px / 120), rgba: [r, g, b, a] });
    }
  }
  console.log({ nonGrayCount: nonGray.length, samples: nonGray.slice(0, 5) });
})();
  • Expected (and actual when noise.canvas.enabled = false): nonGrayCount: 0 (every pixel on a pure black-on-white default 2D canvas satisfies R === G === B).
  • Actual when noise.canvas.enabled = true: nonGrayCount: 40–50, where grayscale anti-aliased edge pixels are perturbed on a single RGB channel by ±1 (e.g., (101, 101, 101, 151) becomes (101, 100, 101, 151)).

BrowserScan appears to render a small grayscale anti-aliased glyph probe (e.g., 21x120) and checks for non-gray single-channel perturbation / statistical anomalies that cannot occur in native rendering.


Suggested Fix

  1. Preserve grayscale invariants (R === G === B): When perturbing an achromatic pixel (R === G === B), apply a uniform luminance delta (Δ, Δ, Δ) to all three RGB channels together (or skip pure grayscale pixels) rather than perturbing a single channel independently.
  2. Preserve geometric/gradient consistency where possible: Avoid independent per-pixel (x, y) noise that breaks expected invariance on simple grayscale text probes and uniform 1D gradients.

c-ceulemans avatar Nov 29 '26 23:11 c-ceulemans