Skip to content

Optional check for disguised indicators and hidden code (--obfuscated) - #24

Closed
HaveMindHive wants to merge 1 commit into
interplains:mainfrom
HaveMindMedia:mirror-and-hidden-code-check
Closed

HaveMindHive wants to merge 1 commit into
interplains:mainfrom
HaveMindMedia:mirror-and-hidden-code-check

Conversation

@HaveMindHive

Copy link
Copy Markdown

Thank you for Zero Breach. We don't know if this is something you want, so please treat it as an offer. It's opt-in, off by default, and easy to drop or reshape.

What it adds (--obfuscated)

The current checks find an indicator only when it is written forwards. Loaders that want an address to survive a string search store it some other way. YIPPHB kept its URL reversed, and the March 2026 plain-crypto-js / axios npm compromise shipped its payload reversed. This check looks for every domain and IP in the set written:

  • reversed
  • in reverse-DNS order (the way macOS bundle IDs and Android package names would carry it)
  • bit-inverted (XOR 0xFF)
  • reversed and bit-inverted

In script files it also looks for ways of hiding code that need no indicator at all:

  • text-direction overrides left open at the end of a line (Trojan Source)
  • long runs of invisible characters (GlassWorm, os-info-checker-es6)
  • Unicode tag "ASCII smuggling"
  • Hangul-filler names
  • reversed URLs and reversed base64 literals

Why we think it may be useful

  • These hide from plain string searches. A forward search, which is what the existing checks do, can't see any of them.

  • The hits are graded apart from contact. Two new evidence grades, encoded and hidden-code, mean "worth a look, not contact, not infection". The report text says exactly that.

  • We tuned out the false alarms on a real Mac first. We ran a wider prototype over about 130,000 files. Every hit was honest software:

    • KaTeX's regex ranges;
    • a browser extension's text-direction detector;
    • Arabic locale strings, including Edge Wallet's i18n-ec folder;
    • JavaScript like r%=0x7fff… that a loose base64 rule mistook for data.

    Each one is now a regression test, and the final check found nothing on that machine. Those cases are also why the direction rule only fires on an override left open at the end of a line, not on any raw direction character.

It keeps to your rules

  • It reads only the browser's cache, storage and Extensions folders, plus the folders the hash check already walks.
  • Cookie, login and history databases are never opened, and a test enforces that.
  • It's stdlib only, runs under the network guard, and reports files it skipped as gaps.
  • It is included in the single-file build. The build stays reproducible, and build.py --check is clean.

Tests: 311 pass (29 of them new) with 9 skipped, the same 9 as before. We only had Python 3.12 locally. The new code avoids 3.9+ APIs, but CI's 3.8 job is the real test.

Things you may want changed

  • On by default or not: we left it off by default, following --patterns, because it reads many more files and the code rules are heuristics rather than published indicators.
  • Exit code: hidden-code hits currently count toward "indicators found" and exit code 2, the same as pattern hits. You may prefer to keep them out of that verdict.
  • node_modules: the user-folder walk reuses the hash check's pruning, so node_modules is not walked, even though that is where the 2025 npm attacks lived.

Separately, we posted #23 about the tracker cookie values, in case it's of use.

HaveMindMedia

🤖 Generated with Claude Code

The stock checks match an indicator only when it is written forwards. This
opt-in check also looks for each domain/IP stored reversed, in reverse-DNS
order, bit-inverted, or reversed and bit-inverted, in the browser cache,
storage and extension folders and the user-writable roots. In script files it
flags open text-direction overrides (Trojan Source), long invisible-character
runs (GlassWorm-style), Unicode tag smuggling, Hangul fillers, reversed URLs
and reversed base64 literals.

Two new evidence grades (encoded, hidden-code) keep these hits apart from
contact. Every false positive seen on a real Mac is pinned as a test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@interplains

Copy link
Copy Markdown
Owner

Thanks for this, it's a thoughtful idea. This repo is the old one, though, and we don't merge outside code into a security tool without rebuilding it ourselves. We'll look at bringing the idea into the current toolkit. Closing this one for now.

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.

2 participants