Skip to content

feat(stealth): harden CDP debugger detection countermeasures#644

Merged
jackwener merged 1 commit intomainfrom
claude/fervent-euler
Mar 31, 2026
Merged

feat(stealth): harden CDP debugger detection countermeasures#644
jackwener merged 1 commit intomainfrom
claude/fervent-euler

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • Add 6 new anti-detection patches to stealth.ts to hide CDP debugger fingerprints
  • Add CDP-level Debugger.setBreakpointsActive(false) in extension to neutralize debugger; statement traps
  • Add 18 unit tests for stealth module

New Stealth Patches

# Patch Detection Vector
Shared Function.prototype.toString disguise via WeakMap Function.hasOwnProperty('toString'), Function.prototype.toString.call(fn) bypass
8 Anti-debugger statement trap debugger; timing side-channel (JS-level Function/eval patching + CDP Debugger.setBreakpointsActive)
9 Console method fingerprinting CDP Runtime.enable replaces console methods with bound functions that have different toString()
10 Window dimension defense outerWidth - innerWidth / outerHeight - innerHeight delta detection
11 Performance API cleanup performance.getEntries() leaking debugger/devtools entries
12 document.$cdc_ cleanup ChromeDriver properties on document (backup for existing window cleanup)
13 Iframe contentWindow.chrome Cross-frame window.chrome consistency check

Test plan

  • 18 stealth unit tests pass (including syntax validity check)
  • TypeScript compiles clean
  • All existing unit tests unaffected
  • Manual test on Xiaohongshu to verify reduced risk control triggers

Add 6 new anti-detection patches to stealth.ts and CDP-level debugger
statement neutralization to reduce risk of bot detection on platforms
like Xiaohongshu.

New patches:
- Shared toString disguise via WeakMap (undetectable by anti-bot scripts)
- Anti-debugger statement trap (Function/eval patching + CDP Debugger.setBreakpointsActive)
- Console method fingerprinting defense (re-wrap CDP-bound console methods)
- Window dimension detection defense (outerWidth/outerHeight normalization)
- Performance API entry filtering (remove debugger/devtools entries)
- document.$cdc_ property cleanup (backup for window-level cleanup)
- Iframe contentWindow.chrome consistency
@jackwener jackwener merged commit 7ea3f6d into main Mar 31, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant