← TextbooksThe SSRD textbook: what to learn to build and defend a scam-site respawn detector
Contents
Build Notes / SSRDLearning edition · 02

UNDERSTAND
THE DETECTOR.

A field guide to scam-site respawns

Follow a new domain from certificate log to alert. Learn what the detector sees, where it can fail, and how to defend its results.

Start with the study plan
About this edition Draft · evidence dated Oct 17, 2026

Agent-written from the SSRD repository on Oct 17, 2026. Toy numbers are labeled Illustration. Real numbers come from docs/research.md and the README, measured Oct 17. Contains no flagged domains or seed data. The reading schedule reflects the original project dates.

Chapter 0 · Read first · 10 minutes

The study plan

SSRD runs from Oct 19 to Nov 15 at about 10 hours a week. Learning can't take a whole week of that, so this plan gives each idea one evening, just before the week that needs it.

The SPEC lists the week 1 "learning evenings": CT and static CT, favicon mmh3, TLSH, urlscan syntax, precision and base rates, and Phillips & Wilder. Each one has a chapter here. Two more chapters (safe fetching and the VCU memo) cover things you are already doing or will do soon. Every chapter ends with questions. A chapter is done when you can answer them without looking.

Reading schedule by date
WhenReadTimeDone when you can…
Sun Oct 181 · The respawn problem and 4 · Fetching safely75 minExplain to a friend what the fetcher on your box does, what it refuses to do, and why. It is already running, so this goes first.
Mon Oct 192 · Certificate transparency45 minDraw a checkpoint, a full tile and a partial tile, and say why the tailer waits for the tile to fill.
Tue Oct 203 · Names and the filter45 minTurn a punycode name into its registrable label, and explain why recall and pass rate are the two numbers that matter.
Wed Oct 215 · Fingerprints, sections 5.1 to 5.345 minSay why a SHA-256 of the page fails, what normalization removes, and what a TLSH distance of 70 means (and doesn't).
Thu Oct 225 · Fingerprints, 5.4 to 5.7, plus Phillips & Wilder60 minCompute a Jaccard by hand, explain why MinHash estimates it, and recompute a favicon hash with the Shodan recipe.
Fri Oct 237 · Sources and the rules30 minWrite three urlscan searches from memory and say why SSRD never submits a scan.
Sat Oct 248 · Measuring honestly, 8.1 to 8.360 minShow with numbers why a 1% false-positive rate can still mean poor precision, and compute a Wilson interval.
Week 2 · Oct 266 · Kits and the alert rule and Appendix A60 minDecide whether the code's alert rule should match the SPEC exactly (Appendix A, item 1).
Week 3 · Nov 28 · Measuring honestly, 8.4 to 8.745 minBrief the second labeler, keep the threshold sweep separate from the evaluation set, and compute kappa.
Week 4 · Nov 99 · Writing for the VCU30 minWrite a lead with a confidence label and "matches kit X" wording before you draft the memo.

About 7 hours in total, mostly in week 1. The times are estimates for a first read, not measurements. Skip any section you can already answer the questions for.

Fig 0.1

The book follows the pipeline, one chapter per stage

CT logsnames tiles Name filter0.71% pass Queue+20m, +2h, +24h Fetcherfirewalled Fingerprintpure functions Score2 families Reviewlabels Kit libraryCBR · KCDA · DFPI seeds via urlscan EvaluateCI · kappa Ch 2Ch 3Ch 4Ch 4Ch 5Ch 6Ch 8 Ch 6 · Ch 7Ch 8 · Ch 9
Arrows show what each stage passes on. The fetcher is highlighted because it is the one stage that touches scam sites, so it carries the safety rules. Live pages are fingerprinted with the same functions as the seed pages. That is why a live page and a seed page can be compared at all.

Chapter 1 · Sun Oct 18 · 30 minutes

If they rebuild, would anyone see it?

On Oct 14 2026 the Brooklyn DA's Virtual Currency Unit said it had disrupted 241 domains and 112 cloud servers of a crypto investment scam aimed at Russian speakers. Its release also said "new scam websites popped up quickly." SSRD turns that sentence into a question you can measure: how fast do new sites that match the same kit appear, and can a passive observer see them?

What you'll learn
The victim funnel, where SSRD can and can't see it, and what a "kit" is.
Why it matters
Every limitation in the memo traces back to this chapter: cloaking, the CT-only view, a thin seed set.
In the repo
SPEC.md Goal, docs/research.md "The VCU case" and "Prior art".

1.1 The funnel, and the one step SSRD can see

The release describes a five-step funnel. Russian-language Facebook ads lead to a phone "advisor". The advisor steers the victim to a fake trading platform. When the victim tries to withdraw, they are charged "fees". Later comes a "recovery" scam that promises to get the money back. The sites referenced US agencies and Elon Musk to look legitimate.

Fig 1.1

SSRD only sees the funnel where a new website gets a public certificate

Facebook adRussian-language Phone "advisor"calls the victim Fake platformsite on a new domain Withdrawal "fees"more payments Recovery scamoften another website Visible to SSRD: new domains that get a TLS certificate Invisible: ads, calls, payments
The platform site is SSRD's main target (highlighted). Recovery sites are often websites too, which is why the name filter has recovery terms. Ads and phone calls never touch a certificate log, so a kit match says nothing about who ran the ads.

1.2 A kit is software, not people

Fake investment sites are rarely built one by one. Operators reuse a kit: the same templates, scripts, icons and copy, re-skinned with a new brand name for each domain. The brand changes, but much of the software underneath stays the same. That reuse is the whole bet. If the software survives a rename, a fingerprint of it can link a brand-new domain to sites already known to be scams.

This is also why SSRD's language rules exist. A shared kit shows the same software. Kits are sold and copied, so it doesn't show the same operator. That is why the project always says "matches kit X" and never "operated by". The memo calls its findings "investigative leads, not attribution".

1.3 What already exists, and what is new

Most of SSRD's parts have been done before. Knowing the prior art keeps the claim honest:

  • phishing_catcher scores CT names by keywords. That is SSRD's first filter (chapter 3).
  • dnstwist compares pages with TLSH (--lsh tlsh), SSRD's content signal (chapter 5).
  • Phillips & Wilder 2020 clustered crypto-scam pages from urlscan snapshots with TF-IDF and DBSCAN, after normalizing the HTML. This is the published baseline. Read its method section on Oct 22.
  • Commercial tools (urlscan Pro "Similar Pages", Validin, DomainTools, Silent Push) already pivot on page structure and favicons.

The likely new part is narrow: a respawn metric (time from a dated takedown to the first matching new domain), and an open, auditable precision number for one network that law enforcement cares about. Using the Bank of Russia (CBR) blacklist as a near-daily ground-truth stream may also be new. The research pass found no published use of it, but that is unverified.

1.4 Three facts that shape every later chapter

  1. Cloaking is the default. Investment-scam sites often show a harmless "white page" to visitors who don't look like victims. Infoblox and Confiant counted about 15.5k investment-scam domains doing this through Keitaro. So "decoy" is its own outcome, reported next to precision (chapters 4 and 8).
  2. The takedown hit the backend. Live respawns from Oct 19 to Nov 15 may be rare. The CBR forward check and the seed backtest exist so a precision number can exist even if few new sites appear (chapter 8).
  3. The KCDA seed set is thin. Only 13 seeds, and the pre-seizure pages recovered from the Wayback Machine are generic WordPress + Elementor sites. Asset hashes can't separate them from ordinary Elementor sites. The page copy can, which is why the copy fingerprint exists (chapter 5.6).

Check yourself

A site matches kit-01-KCDA. Can the memo say the same people run it as the seized sites?
No. It can say the site matches that kit's software on specific signals, at a stated confidence. Kits are sold and copied. Attribution is the VCU's job, with evidence SSRD doesn't have.
Name two funnel steps SSRD can never observe, and one consequence for the memo.
The ads and the phone calls (and the payments). The memo must say SSRD sees only a CT-only slice of a funnel that starts with Facebook ads. A low count of new sites doesn't mean low activity.
What is the one-sentence claim SSRD can honestly make if it works?
The SPEC's pitch: "Over N days it flagged X sites at Y% precision (95% CI a–b)", plus time from the takedown to the first matching domain. It is not a new detection method.
Go deeper: Brooklyn DA release, Oct 14 2026 (quote the release, not press paraphrases) · Infoblox/Confiant on Keitaro cloaking · Sophos CryptoRom

Chapter 2 · Mon Oct 19 · 45 minutes

How a public log tells you a domain was born

Before a browser trusts a certificate, the certificate has to appear in a public, append-only log. Scam operators need HTTPS for their platform to look real. So nearly every new scam domain announces itself in a certificate transparency (CT) log, usually minutes before the site goes live.

What you'll learn
Merkle-tree logs, checkpoints, tiles, names tiles, precertificates and the tailer's algorithm.
Why it matters
Time to flag starts at the CT timestamp, and ingest bandwidth decides whether the box can keep up.
In the repo
src/ssrd/ct.py: Tailer.poll_log, tile_path, handle_entry.

2.1 Why the logs exist

CT was built so that anyone can spot a certificate a CA should never have issued. Certificate authorities submit each certificate to several logs, and browsers require proof of logging (signed certificate timestamps, SCTs). To put those proofs inside the certificate itself, the CA first logs a precertificate, a copy marked unusable, and only then issues the real one. The precertificate is why the log entry arrives seconds after issuance, and often before the site is serving anything.

SSRD uses the logs for a job they weren't designed for: a near-real-time feed of newly certified names. Anyone can read them, and the CA logs certificates for every domain it issues to, so a scam domain on a CA that logs (all public CAs do) can't avoid appearing.

2.2 Merkle trees, checkpoints and tiles

A log is a Merkle tree. Each entry is a leaf. Each parent node is the hash of its two children, so the single root hash commits to every entry below it. Change one old entry and the root changes, so a log can't quietly rewrite history. The log publishes a signed checkpoint: its name, the tree size and the root hash.

Older logs answered queries through an API (get-entries), which was expensive to run. Static CT logs (Sunlight is the main implementation) publish the tree as plain files instead, cut into tiles of 256 entries. A full tile never changes, so it can be cached forever. Let's Encrypt now runs only these tiled logs, so an old-API reader misses every Let's Encrypt certificate.

Fig 2.1

The tailer reads only full tiles. The partial one waits until it fills Illustration

root hash checkpointorigin · tree size 11 · root · signature 0123 4567 8910empty tile 0 · already read tile 1 · full · read next tile 2 · partial · waits saved position next_index = 4
Toy log with 4-entry tiles. Real tiles hold 256 entries. The checkpoint says the tree has 11 entries. Tile 1 is full, so the tailer fetches it, processes entries 4 to 7 and saves 8 as its new position. Tile 2 has only three entries, so the tailer waits. The cost is latency: at about 25 entries a second, a Let's Encrypt tile fills in about 10 seconds.

2.3 Names tiles: the reason this runs on home Wi-Fi

A normal data tile carries whole certificates. Some static-CT logs also serve a compact names tile: one JSON line per entry, with just the DNS names, the subject common name and a timestamp. This is an extra endpoint, not part of the core spec. On Oct 17 the Let's Encrypt Sycamore and Willow logs and Geomys Tuscolo served it. Google's and IPng's logs did not.

Back-of-envelope: is the bandwidth affordable?

  • Measured: about 76 KB per 256-entry names tile, about 6× smaller than a data tile. That is about 0.3 KB per entry.
  • Measured: about 25 entries a second per Let's Encrypt log.
  • 25 × 0.3 KB ≈ 7.5 KB/s per log ≈ 650 MB/day per log. Two LE logs plus Tuscolo come to a few GB a day at most.
  • The alternative, certstream-server-go reading every log, was estimated at about 14.5 Mbit/s (≈ 4.7 TB/month; likely, not measured). That is why SSRD has its own tailer.

2.4 The tailer, step by step

  1. GET <log>/checkpoint. The second line is the tree size.
  2. First run only: start at the current head, rounded down to a tile boundary. The tailer never backfills further back than where it first started.
  3. While the next tile is full: fetch /tile/names/<path>. The path encodes the tile number in groups of three digits, so tile 1234067 is x001/x234/067.
  4. For each entry, collect its names (SANs plus the common name), reduce each to its registrable domain (chapter 3), skip names already in the seen-set and run the filter.
  5. Save the new position in ct_state after every tile, so a sleeping box resumes where it stopped.
  6. On HTTP 429, back off 30 s and try the next log. Count bytes, entries, names and filter passes for metrics.jsonl.

Two details are easy to miss. Wildcard names (*.example.com) lose the *., so SSRD sees the registrable domain but not the subdomains the site will use. And about 1 in 1,000 registrable names is kept unfiltered as a background sample, picked by crc32(name) % 1000 == 0. These are the negatives that trained the name classifier. Because the choice is a hash and not a random draw, a given name is always in or always out of the sample, whichever log it came from and however often the tailer restarts.

Fig 2.2

The first fetch waits 20 minutes after the log entry, because precertificates arrive before sites do

1 s10 s1 min10 min1 h1 day tile fills ≈ 10 s first fetch +20 min retry +2 h retry +24 h CT entry time-to-flag target: under 30 min, for sites live at the first fetch
Log scale, so equal gaps mean equal ratios. Retries happen only if the first visit found a parked page, a blank page or an error. A first visit still unrun 24 hours after it was due is marked expired and counted, never dropped silently. Because of the deliberate 20-minute delay, the time-to-flag floor is about 20 minutes.

Check yourself

Why does a Merkle root stop a log from rewriting an old entry?
The root hash depends on every leaf. A changed leaf changes its parent, and so on up to the root, so the signed checkpoints people already saw would no longer match.
What would break if the tailer read the partial tile 2 in Fig 2.1 and moved on?
It would save position 11 and never come back for entry 11 when it arrives. Or, if it re-read, it would process 8–10 twice. Reading only full tiles keeps the position simple, and the cost is about 10 s of latency.
A scam site uses a wildcard certificate made months ago. Does SSRD see its new subdomain?
No. No new certificate means no new log entry. This is one of the memo's stated limitations (wildcard certs, and the CT-only view).
Why use a hash for the 1-in-1,000 background sample instead of random()?
It is deterministic. The same name gets the same decision on every log and after every restart, so the sample doesn't drift or double-count.

Chapter 3 · Tue Oct 20 · 45 minutes

Which new names are worth a visit?

The logs carry over a thousand new registrable names a minute. The fetcher manages about four. The name filter decides which ones get a visit, so it sets both SSRD's workload and the share of scam sites it could ever catch.

What you'll learn
Public suffixes, eTLD+1, punycode, keyword matching and a character n-gram classifier.
Why it matters
A site the filter drops is never fetched, so filter recall caps everything after it.
In the repo
names.py (registrable, keyword_matches, passes) and name_model.py.

3.1 The part of a name an operator chooses

The operator chooses one part of a hostname: the label just left of the public suffix. Everything left of that is subdomains they can make up for free. Everything right is a suffix anyone can register under. The Public Suffix List (PSL) says where the suffix ends. It isn't always the last dot: co.uk is a suffix, and so are private suffixes such as vercel.app, where every customer gets their own name.

Fig 3.1

Keywords are matched only against the registrable label Illustration

app. quantum-invest .co.uk subdomainfree to invent, ignored registrable labelwhat the filter reads public suffixfrom the PSL registrable domain (eTLD+1): one per operator purchase, the unit SSRD dedupes and visits
A synthetic name. Subdomains on established sites (assets., learn.) turned out to be mostly noise, so only the registrable label is matched. Private suffixes count as public, so my-site.vercel.app is its own registrable domain.

3.2 Punycode: what xn-- means

DNS only carries ASCII. Internationalized names are stored in punycode, ASCII starting with xn--. xn--e1afmkfd.xn--p1ai is пример.рф, and инвест-капитал becomes xn----8sbafpqeomm1aunf. A keyword such as инвест can only match after decoding, so names.to_unicode decodes each label first. The SPEC also says to judge language from the page, not the domain, because CBR seeds are mostly English-named .com sites. Only 102 of the 2,601 from 2026 are .ru.

3.3 The keyword filter, and why it wasn't enough

The first filter was a keyword list in four groups in config/ssrd.toml: investment terms in English, transliterated and Cyrillic Russian, recovery terms, and bait (regulators and brands such as nydfs, musk, gazprom). Terms of four or more letters match anywhere in the label. Shorter ones, and a list of boundary_terms, must stand alone between separators or digits, so fx matches fx-pro but not effect. Infrastructure suffixes such as amazonaws.com are skipped.

Then it was measured. Of 5,020 CBR-listed domains from 2026, the keyword list passed 1,650 (33%). Most scam names are invented brands that contain no investment word at all. That finding is what led to a model.

3.4 A character n-gram classifier

The model doesn't look for words. It looks at how a name is spelled. Wrap the label in start and end markers and cut it into every 2-, 3-, 4- and 5-character piece. For fx-bot, the 2-grams are ^f fx x- -b bo ot t$ and the 3-grams are ^fx fx- x-b -bo bot ot$. Each piece is hashed into one of 220 buckets (the "hashing trick", so there's no vocabulary to store), and the counts are scaled to length 1. A logistic regression learns one weight per bucket. The score is 1 / (1 + e−z), where z is the bias plus the weighted sum.

Positives are CBR-listed labels. Negatives are the CT background sample from chapter 2. Training needs scikit-learn, but scoring is a few lines of pure Python with mmh3, so the ingest container stays small.

The split is by time, not at random

The model trains on CBR names listed before 2026-07-01 and is tested on names listed after. A random split would let near-duplicate names from the same campaign sit on both sides and inflate the score. A temporal split asks the question SSRD actually faces: does what we learned from past scams catch future ones?

Fig 3.2

At ≥ 0.93 the model catches more future scam names than keywords (0.55 vs 0.44) and passes 40% fewer names

0%0.5%1.0% pass rate on CT background names (share of all new names sent to the fetch queue) 00.20.40.6 recall on future CBR names ≈ fetch capacity (derived) keywords · 0.44 at 1.19% model ≥ 0.90 · 0.61 at 1.17% model ≥ 0.93 · 0.55 at 0.71% (live)
Up and to the left is better. Test set: n = 1,217 CBR names listed on or after 2026-07-01, and 7,423 background names, measured Oct 17. The capacity line is derived from two measurements (README, Oct 17): the live filter sends about 325 candidates an hour, while the fetcher completes about 250 visits an hour. So capacity is about 0.71% × 250 / 325 ≈ 0.55%. Even the live threshold overflows, and the priority queue plus counted expiry absorb the difference. Model ≥ 0.90 would send about twice what the fetcher can visit.
FilterRecall (future CBR)Pass rate (background)Read as
Keyword list0.441.19%Misses invented brand names
Model ≥ 0.900.611.17%Best recall, over capacity
Model ≥ 0.93 (live)0.550.71%Live. Still about 30% over fetch capacity

Two numbers matter here, and precision isn't one of them. Recall is coverage: the share of real scam names that get a visit. Pass rate is workload: the share of all names sent to the fetcher. The filter doesn't have to be precise, because fingerprinting decides later. It has to keep enough scams in while fitting the fetcher's capacity.

One caution about the 0.55

The 0.93 threshold was picked by looking at this same test table, so 0.55 is a slightly optimistic estimate of recall on truly new names. It isn't wrong, but it isn't clean either. The clean check is the next monthly retrain: score names CBR lists after Oct 17 with the frozen threshold, and report that number too. Chapter 8.5 has the general rule.

A priority score orders the queue when it backs up: points for the model score above 0.9, one per keyword group, two more for bait terms, and one for a TLD common in the seeds (online, live, pro, top and so on).

Check yourself

What is the registrable domain of login.secure.trade-elon.online, and which groups match?
trade-elon.online. trade matches (investment). elon is a boundary term, and it stands between a hyphen and the end of the label, so bait matches too. That gives a high priority.
Why is precision the wrong number to optimize for this filter?
Its job is to keep scams in while staying under fetch capacity. Fingerprints and the two-family rule decide what is a match. A precise but low-recall filter would cap the whole system's catch rate.
Why hash n-grams into buckets instead of keeping a vocabulary?
No vocabulary to store or keep in sync, a fixed-size model, and pure-Python scoring in the ingest container. The cost is occasional collisions between n-grams, which a linear model tolerates.
A friend says "just split the CBR names randomly into train and test." What goes wrong?
Campaign siblings (brandx-pro, brandx-trade) land on both sides, so the test measures memory, not generalization. The temporal split asks whether the past predicts the future.

Chapter 4 · Sun Oct 18 · 45 minutes · read this first, it's already running

How to visit a scam site from your own box

The fetcher downloads pages that criminals control, from the machine you use every day, on your home network. Each rule in this chapter answers one specific way that could hurt you. If you know which rule answers which threat, you can explain the design to an advisor, and you'll notice if a change would quietly weaken it.

What you'll learn
SSRF, DNS rebinding, IP pinning, an egress firewall, container hardening, response limits, pacing and cloaking.
Why it matters
Hard rules 1 to 3, 6 and 7 live here. tests/test_safety.py must keep passing.
In the repo
safety.py, fetch.py (SafeFetcher.get, Visitor), docker/egress.nft, SAFETY.md.

4.1 What could actually go wrong

ThreatWhat it looks likeAnswered by
SSRF: being steered at your own networkA scam domain resolves to your router, the Docker host (172.17.0.1), your tailnet (100.64/10) or a metadata address (169.254.169.254).Layer 1 IP guard + layer 2 firewall (4.2, 4.3)
DNS rebindingThe name looks public when you check it, then points somewhere private when you connect.Resolve once, pin the IP, recheck on every redirect (4.2)
Malicious contentExploits aimed at browsers, JS engines or image decoders.No browser, no JS, images never decoded, raw HTML never opened (4.4)
Tarpits and huge bodiesA server drips one byte a second, or sends 5 GB.20 s total cap per body, abort over 2 MB (4.5)
Wrong networkThe laptop is on campus, where the UMich network policy applies.Egress ASN check refuses to start (4.4)
Looking like an attackerBursts, many IPs, evading blocks.20 requests/min, one UA, no proxies, blocks recorded and not retried (4.6)

4.2 Layer 1: resolve it yourself, then pin it

A naive fetcher checks the IP, then hands the hostname to an HTTP library, which resolves it again. If an attacker controls the DNS, the second answer can differ. That gap between the check and the use is what DNS rebinding exploits.

Fig 4.1

Rebinding works when the check and the connection resolve separately. Pinning makes them use one answer Illustration

Naive fetcher 1 · check: resolve → 203.0.113.7 (public) ✓ 2 · library resolves again → 10.0.0.1 3 · GET reaches your router ✗ The attacker's DNS answers with a 0-second TTL, so the two lookups can differ. SSRD (safety.resolve_public) 1 · resolve via 1.1.1.1 / 8.8.8.8 → all A records 2 · any non-global answer → refuse the whole name 3 · connect to the pinned IP · Host + SNI = name Repeated on every redirect hop (at most 3), and only ports 80 and 443. Literal-IP URLs and user:password@ URLs are refused outright.
Addresses are from documentation ranges, not real hosts. Pinning means SSRD dials the address it checked. The Host header and TLS SNI still carry the hostname, so virtual hosting and certificates work as normal.

4.3 Layer 2: a firewall that doesn't trust layer 1

Layer 1 is Python code, and code has bugs. A library might follow a redirect on its own, or a future edit might bypass resolve_public. So the fetcher container installs docker/egress.nft in its own network namespace before Python starts. The default policy is drop. It allows DNS only to 1.1.1.1 and 8.8.8.8, and TCP 80/443 only to addresses outside the blocked set. The blocked set is 10/8, 172.16/12, 192.168/16, 100.64/10, 169.254/16, 127/8, the documentation and benchmark ranges, multicast and reserved. All IPv6 is dropped. Either layer alone would stop the router request in Fig 4.1, so both would have to fail together.

Fig 4.2

Both guards must fail before a request reaches your LAN

fetcher containerUID 10001 · read-only root · cap_drop ALL · no-new-privileges · 1 GB · 2 CPUs · only ./data mounted fetch.pyGET only Layer 1resolve_public + pin Layer 2nftables, default drop 80/443 Public sitesglobal addresses only LAN · Docker host · tailnet · metadata · loopback · IPv6
The two highlighted guards are independent: one is application code, the other is the kernel's packet filter. The entrypoint verifies the firewall is active, writes a marker file, then drops every capability through setpriv before ssrd runs. ssrd safety-check re-tests all of this from inside the container.

4.4 The container and the egress check

  • Non-root, read-only root filesystem, tmpfs /tmp with noexec. Even a parser bug can't drop a persistent file or run a downloaded binary.
  • cap_drop: ALL. NET_ADMIN exists only for the entrypoint to install the firewall, and is dropped before Python starts. A compromised process can't change the firewall.
  • Only ./data is mounted. No $HOME, no Docker socket, so nothing to steal or escalate through.
  • Public resolvers, never the LAN router, so a scam name can't be resolved by your router's view of the network.
  • Egress ASN check. Before fetching, the container asks Cloudflare which IP its DNS query came from (a CHAOS-class TXT lookup of whoami.cloudflare), maps it to an ASN with Team Cymru, and refuses unless the ASN is in allowed_egress_asns (only AS22768, your building's ISP). On campus (AS36375) the fetcher won't start.

4.5 Limits on every response

Connect within 5 s, read within 10 s, and finish the whole body within 20 s. The last limit stops slow-drip tarpits that keep a read timeout alive forever. Bodies are streamed and aborted past 2 MB. The Content-Type must be on an allowlist (HTML, CSS, JS, icon images). At most 3 redirects, http/https only. Binaries are never saved, only their hash and size, and images are never decoded: the favicon is hashed as raw bytes. In passive_visit mode, the favicon and up to 5 same-origin, non-library JS/CSS files are fetched only if the homepage already has ≥ 3 investment terms.

4.6 Pacing: a pacer, not a bucket

SAFETY.md says "token bucket", but fetch.RateLimiter is actually a pacer. Every request, from either worker, waits until next_ok, then pushes next_ok 3 seconds later (60 / 20). A token bucket would let up to its capacity go out at once after a quiet spell. The pacer never bursts. That is stricter than the rule requires, which is fine, but the docs should name it correctly (Appendix A).

Fig 4.3

At 20 requests a minute the pacer starts one request every 3 s. A bucket could fire five at once Illustration

Pacer (SSRD) Token bucket, cap 5not used 0 s6 s12 s18 s24 s30 s 5 at once
Each tick is one request start, on the same time scale in both rows. Two workers share one pacer, so concurrency ≤ 2 caps overlap while the pacer caps the rate. Measured throughput was about 250 visits an hour (about 4 a minute), not 20 a minute. One visit can be several requests (homepage, redirects, favicon, assets), and the median visit took 15 s (p90 48 s).

4.7 Outcomes, and why cloaking is a result, not a failure

Each capture is classified by fingerprint.classify as content, parked, blank, blocked (401/403/406/429/451/503), error or seized. Parked, blank and error pages get retries at +2 h and +24 h. When you review, a page that shows harmless content to SSRD but matches a scam's infrastructure is labeled decoy-cloaked.

Hard rule 3 says a block is recorded, never worked around: no proxies, no rotating IPs, no retry from another network, no headless browser. Evading blocks is also where legal risk rises (chapter 7). One method note: your building's residential IP probably sees less cloaking than a datacenter IP would, because cloakers filter datacenters. So SSRD's decoy share isn't comparable to datacenter-based studies. Say so in the README.

4.8 Evidence you could hand to someone

Raw bytes are stored gzip-compressed as data/captures/<sha256>.gz (mode 0600), so the file name proves the content. Each visit appends one JSON line to data/manifest/YYYY-MM-DD.jsonl: requested and final URL, redirect chain, fetch time, CT time, resolved IP, ASN, request and response headers, certificate SHA-256, body SHA-256, outcome and the tool's git commit. Each day's file gets a SHA-256 in hashes.txt. Past lines are never rewritten. If the VCU ever relies on a lead, this is what shows what you saw, when, and with which version of the code.

Check yourself

A scam domain has two A records: 198.51.100.20 and 192.168.1.1. What does SSRD do?
It refuses the whole name. resolve_public rejects any name with any non-global answer, because mixing public and private answers is a rebinding trick. (Both addresses are blocked by the firewall too: the first is a documentation range.)
Why keep the nftables firewall if resolve_public already refuses private IPs?
Defense in depth. Layer 1 is code that can have bugs or be bypassed by a library or a future edit. Layer 2 is enforced by the kernel and can't be changed by the unprivileged process.
A site returns 403 to SSRD. Should you retry from your phone's hotspot?
No. Record it as blocked or decoy and move on. Retrying from another IP to get past a block breaks hard rule 3 and raises legal risk.
Why is the 20 s total cap needed when there's already a 10 s read timeout?
A read timeout resets every time a byte arrives. A tarpit sending one byte every 9 s would never trip it. The total cap bounds the whole body.

Chapter 5 · Wed Oct 21 and Thu Oct 22 · 45 + 60 minutes

Hashes that survive a rename

A kit is re-skinned for every domain: new brand, new prices, new dates. A fingerprint has to stay the same through those changes and still differ between unrelated sites. Each signal in this chapter is a different guess about what an operator won't bother to change.

What you'll learn
Normalization, TLSH, shingles and Jaccard, MinHash, copy containment, favicon mmh3, asset hashes and the common-value denylist.
Why it matters
Every alert is a claim that two pages share these values. You must be able to say what each value means.
In the repo
fingerprint.py (pure: bytes in, features out), score.compare, config/ssrd.toml [score].

5.1 Why SHA-256 of the page doesn't work

A cryptographic hash is built so that changing one byte changes the whole hash. That makes it perfect for proving a file is unchanged, which is how SSRD names its captures. It is useless for "these two pages are nearly the same", because two copies of a kit differ in the brand, a price ticker and a nonce. SSRD needs two kinds of hash: exact hashes for parts the operator doesn't touch (icons, JS and CSS files, chat-widget snippets), and similarity hashes for parts they edit lightly (the HTML and the copy).

5.2 Normalize first

Before any similarity hash, normalize_html lowercases the page and replaces the parts that change on every load. Here is its real output on a toy fragment:

Fig 5.1

Normalization deletes what changes per page, so the template is what gets compared Illustration

<div class="Price" data-nonce="9f86d081884c7d659a2feaa0c55ad015">BTC 67,214.50 · 2026-10-17</div> <img src="data:image/png;base64,iVBORw0KGgo…">

↓ normalize_html: hex runs ≥ 16 → H · base64-like runs ≥ 40 → B · every digit run → 0 · whitespace collapsed

<div class="price" data-nonce="H">btc 0,0.0 · 0-0-0</div> <img src="data:image/png;base0,B">

The nonce, the price and the date are gone. So is the "64" in "base64". Normalization is blunt, and that's acceptable because it's applied to both pages the same way. Normalization is a decision about what counts as "the same", and section 5.7 shows that decision going wrong once.

5.3 TLSH: a fuzzy hash with a distance

TLSH (Trend Micro's locality-sensitive hash) slides a 5-byte window over the input, counts byte triplets into 128 buckets, and records each bucket as one of four levels relative to the quartiles of all the counts. Add a short header (a checksum, the length and quartile ratios) and you get a hash of about 70 hex characters. Two hashes give a distance: 0 means near-identical, and it grows as the byte statistics drift apart. There's no fixed maximum: the distance can run well past 300.

  • Input must be at least 50 bytes, and some low-variety inputs return no hash (TNULL). That's why tlsh_hash can return None.
  • Published cutoffs come from executables, not web pages. The config's tlsh_max_distance = 70 is a placeholder. The SPEC says to sweep 30 to 150 on your own labeled pages in week 3.
  • TLSH sees bytes, not structure. Two pages from one WordPress theme can be close even with different owners. That's one reason a single content signal never alerts on its own.

5.4 Shingles and Jaccard similarity

The structural signal ignores text and attributes. It walks the HTML and lists tag names in document order: html head meta title … body div nav a …. Then it takes every run of k = 5 consecutive tags, called a shingle. A page becomes a set of shingles, and two sets are compared by Jaccard similarity: shared shingles ÷ all distinct shingles, |A ∩ B| ÷ |A ∪ B|. 1 means the same set; 0 means nothing in common. Try it: change a tag in page B and watch which shingles stop matching.

Fig 5.2

One changed tag breaks up to k shingles, so bigger k is stricter Illustration

Page A's shingles (shared ones highlighted)

Two synthetic pages: B adds a script tag and uses h2 instead of h1. With k = 1 they look almost identical, because a single tag name says little. With k = 5 each change knocks out several shingles. SSRD uses k = 5 (shingle_k) and a placeholder threshold of 0.80 (jaccard_min).

5.5 MinHash: estimating Jaccard without the sets

Comparing a new page against every kit member means comparing many sets. MinHash compresses each set into a short signature. Pick a random hash function, hash every shingle, and keep only the smallest value. For two sets, the minimum is the same exactly when the shingle with the smallest hash in A ∪ B is in both sets. That happens with probability |A ∩ B| ÷ |A ∪ B|, which is the Jaccard. Repeat with 128 hash functions (minhash_perm) and count agreements. The fraction that agree is your estimate.

How noisy is 128?

Each agreement is a coin flip with probability J, so the estimate's standard error is √(J(1 − J) / 128). At J = 0.80 that's about 0.035. A pair whose true Jaccard is 0.78 will show ≥ 0.80 roughly 3 times in 10 (normal approximation). A hard cut-off at 0.80 is noisy for pairs close to it. That's fine when another family has to agree too, and one more reason never to alert on one signal.

5.6 The copy fingerprint: what separated the KCDA pages

The KCDA pages recovered from the Wayback Machine are WordPress + Elementor (Hello theme) behind Cloudflare. Their tag structure, paths and scripts are shared with thousands of ordinary Elementor sites. Once an Elementor background sample was added, they correctly stopped forming a kit on assets. What their builders reused was the sales copy.

copy_shingles takes the visible text, drops words that come from the domain's own brand (the label split on hyphens and digits, words of four or more letters), forms word 5-grams, hashes them with mmh3, and keeps the smallest 4,000 (a bottom-k sample, which estimates overlap consistently). Two pages are compared by containment: shared ÷ the smaller set. Containment, not Jaccard, because a long page containing a short page's whole copy is still a match.

Fig 5.4

KCDA page pairs share 71 to 99 copy 5-grams. Seed-vs-background pairs never share more than 15

Seed vsbackground KCDA page pairs p99 = 5max = 15 7199 strong ≥ 30 (placeholder) medium ≥ 12 0255075100 shared brand-stripped word 5-grams per pair
Measured Oct 17. Containment for the KCDA pairs was 0.11 to 0.23, above copy_min_containment = 0.10. Background means 142 random urlscan scans plus 90 Elementor sites. Only the 99th percentile and the maximum of the background pairs were recorded, so the gray band spans 0 to the maximum. With this signal, kit-01-KCDA forms. Notice that the medium threshold (12) sits below the background maximum (15): a background pair can earn a medium copy signal.

5.7 Exact hashes: favicons, assets and inline scripts

Favicon mmh3. SSRD uses the Shodan recipe so its numbers match other tools: base64-encode the raw icon bytes with a newline every 76 characters (Python's base64.encodebytes), then take MurmurHash3 32-bit, signed. A different encoding of the same icon gives a different number, which makes pivots in Shodan or elsewhere silently fail. Default and CDN icons get zero weight through the denylist.

Try it in uv run python

import base64, mmh3; mmh3.hash(base64.encodebytes(b"\x00\x00\x01\x00toy-icon-bytes")) → -1857383559. Then try base64.b64encode (no newlines) on the same bytes and see the number change.

Assets. SHA-256 of same-origin JS and CSS files, skipping common libraries matched by library_asset_pattern (jQuery, Bootstrap, GSAP, analytics and so on). Free urlscan accounts return 404 on response bodies, so seed favicons can't come from urlscan. Asset SHA-256s from its result JSON still work.

Inline scripts over 200 characters are hashed with whitespace-only normalization. On Oct 17 they had been hashed after full normalization. That turned every chat-widget snippet's account number into 0, so all sites using the same widget got one hash, and kit-01 chained unrelated sites together. Account IDs are exactly what should survive, so now only whitespace is collapsed.

5.8 Page features, and values too common to mean anything

Family C reads the page: a normalized title (≥ 8 characters), Telegram and WhatsApp IDs, crypto-address patterns, response header order and the CMS generator. Contact IDs and addresses are private linking evidence. Hard rule 5: never interact with them.

A value seen on many unrelated sites (the default WordPress favicon, a popular theme's path, "Home") would link everything to everything. score.common_values counts how many distinct background and live hosts carry each value. Above max(3, 2% of hosts) it gets zero weight. Seed pages are deliberately left out of that count. Otherwise a large, genuine kit would denylist its own shared assets.

FamilySignalFires whenStrength
A contenttlshdistance ≤ 70 (placeholder)strong
A contenttag_jaccardMinHash estimate ≥ 0.80 (placeholder)strong
A contentcopy≥ 30 shared and containment ≥ 0.10 · or ≥ 12 sharedstrong · medium
B assetsfavicon_mmh3equal, not commonstrong
B assetsasset_sha256 · inline_scriptany shared hash, not commonstrong
B assetsasset_paths≥ 2 shared paths and ≥ 50% overlapmedium
C pagetelegram · whatsapp · crypto_addressesany shared valuestrong
C pagetitleequal normalized title, ≥ 8 charsmedium
C pageheader_order · generatoridenticalweak
D infraasn · nsidenticalweak

From score.compare in the working tree on Oct 17. Placeholders are set by the week 3 sweep.

Check yourself

Compute the Jaccard of {a, b, c, d} and {b, c, d, e, f}.
Shared {b, c, d} = 3. All distinct {a, b, c, d, e, f} = 6. J = 0.5. Containment = 3 ÷ min(4, 5) = 0.75.
Why does the copy signal use containment instead of Jaccard?
A long landing page that contains a short page's entire copy, plus more, should still match. Jaccard would be dragged down by the extra text, while containment divides by the smaller set.
Why are seed pages excluded when building the common-value denylist?
A genuine kit with many seed members would push its own shared favicon or script over the "common" cut-off and erase the evidence that defines it.
Your favicon hash doesn't match the number in a Shodan search for the same icon. First thing to check?
The encoding: encodebytes (newlines every 76 chars plus a trailing newline), not b64encode. And signed 32-bit output.
A TLSH distance of 70 between two pages. What can you say?
Their normalized byte statistics are fairly close, below the current placeholder cut-off. That isn't the same as "same kit" until the threshold has been swept on labeled pairs, and it must agree with another family.
Go deeper: TLSH repo and paper (Oliver, Cheng & Chen 2013) · datasketch MinHash docs · Broder, "On the resemblance and containment of documents" (1997) · Phillips & Wilder 2020 (compare their TF-IDF clustering with these signals) · Shodan: deep dive into HTTP favicons

Chapter 6 · Week 2, Mon Oct 26 · 45 minutes

When is a match a match?

Any one signal from chapter 5 can be shared by accident: a theme, a widget, a hosting company. SSRD's answer is to require agreement between different kinds of evidence. Two signals that tend to fail together don't count as two.

What you'll learn
Signal families, the alert rule (as specified and as coded), union-find clustering, chaining and the backtest.
Why it matters
False positives go to investigators. The alert rule is the main thing standing between a lookalike site and a wrong lead.
In the repo
score.decide, score.strong_families, kits.cluster, evaluate.backtest.

6.1 Why "different families"

TLSH and tag-Jaccard both measure the HTML template. If two unrelated shops use the same WordPress theme, both fire together. Counting them as two independent confirmations would be double-counting one fact. So signals are grouped by what they measure: A content, B assets, C page features, D infrastructure. The SPEC rule is: alert only on ≥ 2 strong signals from different families among A/B/C; D only adds weight. Infrastructure is weak because the VCU release says the network used "Eastern European and American" hosts. Sharing Cloudflare or a big host's ASN means almost nothing.

6.2 The rule in the code is a little wider

score.decide alerts when there are strong signals in ≥ 2 of A/B/C, or strong signals in exactly one of A/B/C plus ≥ 2 other signals of any strength and any family, D included. The second clause isn't in the SPEC. It means one strong signal plus a shared ASN and shared nameservers alerts. Pick signals below to compare the two rules.

Fig 6.1

Pick the signals two pages share, and compare the code's verdict with the SPEC's

A · content
B · assets
C · page
D · infrastructure

The logic is a copy of score.decide and the SPEC sentence above, run in your browser. Score is the sum of strengths (strong 3, medium 2, weak 1) and only ranks matches; it doesn't decide them. Try "tlsh + asn + ns": the code alerts, the SPEC doesn't. Whether to close that gap is your call (Appendix A, item 1). CLAUDE.md says never to replace the two-family rule with a single-signal shortcut.

6.3 From pairs to kits: union-find

A kit is built from seed pages, not defined by hand. kits.cluster compares every pair of seed pages on different registrable domains. When a pair is linked, their groups merge. Groups are tracked with a disjoint-set union (union-find): each page points to a parent, find follows pointers to a group's root (halving the path as it goes, so later lookups are fast), and union joins two roots. After all pairs, each root is one candidate kit. Groups spanning ≥ 2 registrable domains become kits, named kit-NN, plus -KCDA if any member is a KCDA seed. Kits whose median page has fewer than 3 investment terms are marked excluded-non-investment and never alert. That catches parking and hosting templates.

Fig 6.2

Single linkage chains: one weak bridge can merge two unrelated kits Illustration

p1p2p3q1q2q3 shared chat-widget hash only (one strong family: B) kit 1: copy + favicon on every link kit 2: tlsh + telegram on every link clustering link needs2 strong families
Union-find merges anything connected by any path. If one link were allowed on weaker evidence, p2–q1 would join the two kits, and every later alert against "the kit" would mix two programs. In the working tree, clustering uses the stricter test (len(strong_families(sig)) ≥ 2), not the alert rule. The fix followed the kit-01 chaining seen on Oct 17 (chapter 5.7).

6.4 What the library looks like now

The first library (Oct 17) clustered 212 seed pages on 128 domains into 12 kits holding 72 member pages. The largest held 30 pages on 16 domains, all with the same title about "sustainable wealth through oil, real estate, and agriculture". After the copy fingerprint and the chaining fix, the library holds 22 multi-domain kits, including kit-01-KCDA, plus 138 single-site references (ref-<domain>): investment-content seed domains that didn't cluster, so a live page can still match one known listed site. A reference match is weaker evidence than a kit match and is labeled separately. Most kits are general CBR-listed investment kits, not the KCDA network. The README and memo must keep the two apart.

6.5 The backtest: does the library recognize its own kits?

evaluate.backtest holds out about 20% of kit-member pages (page ID mod 5 = 0), re-clusters the rest, and checks whether each held-out page alerts against a group whose majority kit is the page's original kit. The history is a lesson in itself. It went 14 of 17, then 27 of 31 (87%) after the copy fingerprint. Then one 87-page "kit" turned out to be chaining: 4.8% pair density, held together by one inline-script hash (chapter 5.7). After the fix, the honest result is 13 of 19 (68%, 95% CI 46–85%). The 87% was inflated, because held-out pages were easy to "re-identify" inside one giant chained group.

What the backtest does and doesn't show

  • It shows the rule and thresholds recognize known kits from a partial library. It does not measure precision on live CT traffic, where most candidates aren't in any kit.
  • Only pages that joined a kit in the full library are held out. Seed pages the rule never linked to anything are never tested, so 68% is recognition given a page is linkable. The held-out pages are excluded from re-clustering, but the common-value denylist is shared. Report it as recognition, beside live precision.
  • n = 19 is small, hence the wide interval, which reaches below the 60% target. Chapter 8.3 shows why.

Check yourself

A candidate shares TLSH distance 40 and tag-Jaccard 0.91 with a kit member, and nothing else. Alert?
No, under both rules. Both are family A, so there's one strong family and zero other signals. Same template doesn't mean same kit.
Favicon + Telegram handle shared. Alert?
Yes: strong B plus strong C. That's two families.
Why is clustering stricter than alerting?
Union-find is transitive. One loose link merges whole groups, and errors compound across the library. An alert is one pair, and its error stays local and goes to review.
What does the 68% backtest let you claim in the memo?
That the library re-identified 13 of 19 held-out seed pages to the correct kit (95% CI 46–85%), and that an earlier 87% was inflated by chaining. Nothing about live precision, and nothing about who runs the sites.
Why did the inflated 87% look so good?
A chained mega-group contains almost everything, so a held-out page almost always lands back in "its" kit. Big, loose clusters make recognition easy and meaningless. Check cluster density, not just the catch rate.
Go deeper: cp-algorithms: disjoint set union · on single-linkage chaining, any clustering textbook's chapter on hierarchical clustering (e.g. Manning, Raghavan & Schütze, Introduction to IR, §17.2)

Chapter 7 · Fri Oct 23 · 30 minutes

Where the known scams come from, and the lines you don't cross

The kit library is only as good as its seeds, and every seed source comes with rules: terms of service, quotas, and legal lines about what a private researcher may do. This chapter covers both, because most of the ways SSRD could go wrong legally run through these sources.

What you'll learn
CBR, KCDA, DFPI and urlscan: what each gives you, its limits, and the legal and ethical boundaries.
Why it matters
Hard rules 4 to 6 and the data-handling rules. A mistake here can publish a domain or make you a government agent.
In the repo
seeds.py, urlscan.py, wayback.py, docs/research.md "Seed sources" and "Legal".

7.1 The seed sources

SourceGives youWatch out for
Bank of Russia (CBR) blacklist JSON27,474 entries, 24,665 with a site, newest dated 2026-10-16, about 270–470 new entries a month. The main seed source and a ground-truth stream for the forward check (chapter 8.6).The Site field needs cleaning (Telegram links, comma-separated lists, mail. hosts). Mostly English-named .com forex sites. In the memo they are "listed by CBR": indicators, not court findings.
KCDA seized set13 seeds: domains showing the KCDA seizure banner (title "This Website Has Been Seized", #KCDA, NS at Shadowserver), plus VCU releases.urlscan saw these only after seizure, so fingerprints come from Wayback pre-seizure copies (7 recovered). Seized and sinkholed pages are excluded from fingerprints and from live scoring.
DFPI Crypto Scam TrackerA small US pig-butchering set.No export, so collected by hand.
ChainabuseSpot checks.Free tier is 10 calls a month. Researcher access has been requested.
CFTC RED list, CryptoScamDBDropped.The RED list has no URLs. CryptoScamDB is stale. ScamSniffer and MetaMask lists cover wallet drainers, not investment sites.

One check you can run: the README counts 52,897 CBR domains, while the research notes count 24,665 entries with a site. The likely reason is that one entry can list several sites, and the cleaner splits them. Confirm that in seeds.py before the README quotes either number.

7.2 urlscan: search and fetch, never submit

urlscan.io is a public archive of browser scans other people submitted. SSRD uses it for history: what a seed domain looked like before it was seized or went dark. The free tier allowed 1,000 searches, 10,000 result fetches and some scans per day; the real limits come from GET /user/quotas/. Search sees only public scans, and anonymous result fetches return 403, so the API key in data/.env is required. The searches SSRD actually runs look like this:

urlscan search syntax (Elasticsearch query strings)

  • page.title:"This Website Has Been Seized": every scan with that page title (finds seizure banners, many of them not KCDA).
  • hash:<sha256>: every scan where some response body had this SHA-256. This is how you pivot from one known script or banner to other domains.
  • page.domain:"example.com": the history of one seed domain.
  • Also free: page.asn, ip. Pro only: similar-page search, text.content, dom.hash. There's no mmh3 favicon hash and no TLSH, so SSRD computes those itself.

Hard rule 4 says never write code that submits a scan, in any visibility. A public or unlisted scan publishes the domain, and might warn the operator or expose an investigation. A private scan is urlscan's browser actively visiting the site with JS on, which goes beyond the passive-visit rule. A test enforces that the client has no submission code path. The ToS also say personal, non-commercial use and no "systematic retrieval" without permission. So: email urlscan about the research use before bulk pulls, keep to min_interval_seconds = 2.0, back off on 429, and cache every response locally.

7.3 The legal and ethical lines

You mayYou neverWhy
Make unauthenticated GETs of public pages, at a polite rateLog in, submit forms, run JS, or get around a blockLegal risk for public GETs is low (Van Buren, hiQ, the DOJ's 2022 CFAA charging policy). It rises when you circumvent barriers.
Record crypto addresses and chat handles as private evidenceMessage, pay, look up or "test" themHard rule 5. Contact could tip off operators, harm victims or make you part of the case.
Use HTTP(S), DNS, RDAP/WHOISPort-scan or probe servicesHard rule 6. Your ISP's policy, and scanning looks like an attack.
Run the tool on your own initiative and send findings privatelyTake collection instructions from the VCUOnce law enforcement directs your collection, it may count as state action, with Fourth Amendment limits, and you may become a witness. Stay independent and keep append-only logs.
Publish code, methods and aggregate metricsPublish flagged domains, seeds, captures or labelsEverything under data/ stays private and off third-party services.

The research notes also suggest an optional 30-minute check with UMich OGC or a faculty advisor before launch. It's cheap. Doing it after fetching has started is still worthwhile.

Check yourself

Why is even a private urlscan scan off-limits?
It's an active browser visit with JavaScript, made on your behalf. That goes beyond the passive-visit rule, even though nothing is published.
The VCU replies "great, can you watch for domains with this Telegram handle?" What do you do?
Don't take it as a tasking. Thank them, say the tool runs independently on its own published method, and pass the request to Rahil before doing anything. Changing collection at their direction raises the state-action problem.
Write the search that finds other domains serving a script whose SHA-256 you know.
hash:<the sha256>. Then fetch each result's JSON, cache it, and compute features from the stored DOM. Don't visit the domains from the host.

Chapter 8 · Sat Oct 24 (8.1–8.3) and week 3, Mon Nov 2 (8.4–8.8) · 60 + 45 minutes

How sure are you, really?

The SPEC promises "honest numbers". That means three habits. Say what the denominator is. Show how uncertain a number is. Never let the data you tuned on also grade you. This chapter is the toolkit for each.

What you'll learn
Precision under low base rates, Wilson intervals, Cohen's kappa, leakage, external confirmation, and median and p90.
Why it matters
These are the four headline metrics in the README and the memo. A skeptical analyst will check every one.
In the repo
evaluate.py: wilson, precision, kappa, backtest, time_to_flag, cbr_forward.

8.1 Precision, and why the base rate decides it

Precision is the share of alerts that are real: true alerts ÷ all alerts. It's the headline because every false alert costs an investigator time. Recall is the share of real kit sites that alert. The trap is the base rate. If only 1 in 100 fetched pages is a kit site, even a rare false positive happens to the 99 others, so false alerts can outnumber real ones.

Fig 8.1

110 alerts from 10,000 fetched pages, and 55% of them are real

Illustration
true 60 false 50

The bar is all alerts, split into true (yellow) and false (gray), so the yellow share is the precision. The numbers are made up to show the mechanism. SSRD's real base rate among fetched pages isn't measured yet. Start at 1%, 60% and 0.5%: almost half the alerts are false. The two-family rule and the common-value denylist exist to push the false-positive rate toward zero.

8.2 Six labels, and why decoys don't count as wins

Each alert gets one label in ssrd review: scam-kit, not-scam, decoy-cloaked, parked, error or unsure. Precision is scam-kit ÷ all labeled alerts. A decoy might well be a scam, but you didn't see the scam, so it counts as not confirmed, and the decoy share is reported beside precision. Label from the sanitized text, the matched signals and the nearest kit member. Write down your rules for each label before you start, so the second labeler gets the same instructions.

8.3 Intervals: why 13 of 19 isn't simply "68%"

A proportion from a small sample is uncertain. The textbook interval p ± 1.96·√(p(1 − p)/n) (the Wald interval) misbehaves when n is small or p is near 0 or 1. It can run past 100%, and its real coverage falls well short of 95%. The Wilson interval fixes this by solving for the range of true proportions that would make your result unsurprising. It's what evaluate.wilson computes:

centre = (p + z²/2n) / (1 + z²/n) and half = z·√(p(1−p)/n + z²/4n²) / (1 + z²/n), with z = 1.96.

Fig 8.2

Try your own counts: Wald vs Wilson

WaldWilson 0%25%50%75%100%

Try 10 of 10. Wald says 100% to 100%, which is absurd; Wilson says 72% to 100%. Try 35 of 50, the SPEC's minimum sample at a 70% precision: the interval still spans about 56% to 81%. That's why n ≥ 50 is the floor, not the goal.
Fig 8.3

After the chaining fix the honest backtest is 13 of 19 (68%), and its interval reaches below the 60% target

Chained (inflated)27 / 31 After fix (honest)13 / 19 87% (71–95) 68% (46–85) target ≥ 60% 0%25%50%75%100%
Backtest: held-out seed pages re-identified to the correct kit. Dots are the observed rate, lines the 95% Wilson interval, on one 0–100% scale. Both measured Oct 17, before and after the cluster-chaining fix. The gray row is shown as a warning, not a result: a high catch rate from a loose, chained library measures nothing. The honest interval includes values below the 60% target, so "meets target" isn't supported yet.

8.4 Kappa: do two people agree beyond luck?

If you label your own alerts, a skeptic can say the precision is circular. The SPEC answer: a second labeler independently labels 50 of the same items, and you report Cohen's kappa, κ = (po − pe) ÷ (1 − pe). po is how often you agree. pe is how often you'd agree by chance, given how often each of you uses each label.

Fig 8.4

84% raw agreement is only κ = 0.63 once chance agreement is removed Illustration

Labeler 2: scam-kitLabeler 2: otherTotal
Labeler 1: scam-kit30535
Labeler 1: other31215
Total331750

po = (30 + 12) / 50 = 0.84 · pe = (35·33 + 15·17) / 50² = 0.564 · κ = (0.84 − 0.564) / (1 − 0.564) = 0.63

Two categories for clarity. evaluate.kappa uses all six labels. Common rules of thumb call 0.61–0.80 "substantial", but those bands are a convention, not a test. Report κ, po and n, and list the disagreements, because they show where your label rules are unclear.

8.5 Never let the tuning data grade you

The thresholds marked "placeholder" (TLSH 70, Jaccard 0.80, copy 30) get chosen in week 3 by sweeping values on labeled data. Whatever data you sweep on, you'll fit, including its noise. So the precision you report must come from different alerts, labeled after the threshold was frozen. CLAUDE.md puts it as a rule: never tune thresholds on the evaluation set.

Fig 8.5

Three datasets, three jobs, and the threshold freezes between the first two

Oct 19Oct 26Nov 2Nov 9Nov 15 Tune~100 labeled · sweeps · kappa Evaluate7-day run · reported precision freeze threshold External: CBR adds domains on its own schedule. Any SSRD candidate listed later is an independent confirmation.
The backtest (chapter 6.5) lives on seed pages, separate from all three. The name filter's 0.55 recall breaks this rule a little, because its threshold was picked on its test table (chapter 3). Re-check it on post-Oct 17 CBR names.

8.6 Confirmation you didn't produce: the CBR forward check

evaluate.cbr_forward counts SSRD candidates that CBR lists on or after the day SSRD first saw them, and how many of those SSRD alerted on. It's independent of your labels, so it answers the circularity objection from a different direction. It confirms "a regulator later listed this domain", not "this matches kit X", and CBR's listing delay is unknown, so a short run will undercount.

8.7 Time to flag: median and p90, not the mean

Time to flag runs from the CT timestamp to the first alert. A few sites flagged only on the +24 h retry would drag a mean far from the typical case. So report the median (half the alerts were faster) and p90 (90% were faster). Count only box uptime, and report gaps.

Fig 8.6

Retries make a long tail: median 27.5 min, p90 121 min Illustration

median 27.5 p90 = 121 20 min60 min3 h24 h log scale · minutes from CT entry to alert · 20 made-up values
Twenty invented flag times: most from the +20 min first fetch, two from the +2 h retry and one from +24 h. p90 follows the code's rule (the value at rank ⌈0.9 n⌉, the 18th of 20), so it lands on a retry. The SPEC target (under 30 min) applies only to sites that were live at the first fetch, so report that subset too.

8.8 What the README will report

MetricDefinitionTargetNow (Oct 17)
Precisionscam-kit ÷ labeled alerts above threshold, Wilson 95% CI, n ≥ 50, decoys not confirmed≥ 70%not yet measured
Backtest catch rateheld-out seeds matched to the correct kit≥ 60%68% (13/19, CI 46–85%); earlier 87% was inflated
Time to flagCT entry → alert, median and p90< 30 min if live at first fetchnot yet measured
Weekly volumenew confirmed matches per week, KCDA vs CBRreport as foundnot yet measured
Alsodecoy share, kappa, CBR forward confirmations, filter recall and pass rate—filter: 0.55 recall at 0.71%

Check yourself

Base rate 2%, recall 50%, false-positive rate 1%, 10,000 pages. Precision?
TP = 10,000 × 0.02 × 0.5 = 100. FP = 9,800 × 0.01 = 98. Precision ≈ 100 / 198 ≈ 51%.
Why does a decoy count against precision even if it's probably a scam?
Precision claims what you confirmed. You didn't see the scam content, so the claim isn't supported. Reporting the decoy share separately keeps the information without inflating the headline.
You swept TLSH on the week 3 labels and then reported precision on those same labels. What's wrong, and how do you fix it?
The threshold was fitted to those labels' noise, so precision is optimistic. Freeze the threshold, then report precision only on alerts from the week 4 run, labeled afterwards.
Two labelers agree 90% of the time but κ = 0.2. How?
One label dominates. If almost everything is "not-scam", chance agreement pe is already near 0.9, so agreeing 90% adds little beyond luck.
Go deeper: Brown, Cai & DasGupta, "Interval Estimation for a Binomial Proportion" (Statistical Science, 2001) · Cohen, "A coefficient of agreement for nominal scales" (1960) · Base rate fallacy · Kapoor & Narayanan, "Leakage and the reproducibility crisis in ML-based science" (2023)

Chapter 9 · Week 4, Mon Nov 9 · 30 minutes

Writing a lead an investigator can use

The memo goes to a prosecutor who leads the unit and a senior analyst. They're busy, they'll check your claims, and anything they act on may one day be read aloud in court. Two pages have to tell them what you found, how sure you are, and what you can't see.

What you'll learn
Conclusion-first structure, confidence labels, wording that never overclaims, and the process rules around sending.
Why it matters
It's the project's deliverable. An overclaim here undoes the care taken everywhere else.
In the repo
SPEC.md "VCU memo", CLAUDE.md "Language in code, docs, and output".

9.1 Conclusion first

Put the answer in the first three lines: how many new domains matched which kits, over what window, at what precision with its interval. Everything after supports that paragraph. A reader who stops after it should still have the result and its main limit. This is Barbara Minto's pyramid principle: the governing thought, then the reasons, then the evidence.

9.2 Every claim carries a label

LabelMeansExample
confirmedDirectly observed and re-checkable from your evidence."Domain A served a page whose copy shares 84 5-grams with kit-01-KCDA seed pages (capture SHA-256 in the appendix)."
likelySupported indirectly, or by a small sample."Kit-03-KCDA probably reflects one site builder's template; 3 recovered pages agree."
speculativePlausible, not tested. Include it only if it's useful and plainly marked."The quiet period after Oct 9 may reflect the backend takedown rather than less activity."

The examples are illustrative wording, not findings.

9.3 Words to swap

Don't writeWrite
"operated by the same group", "belongs to the network""matches kit X on favicon and copy signals"
"a scam site""a site matching kit X; listed by CBR on [date]" (where true)
"the criminals rebuilt within days""N new domains matching kit X appeared in CT within D days of the Oct ~7 action"
"proves", "clearly shows""is consistent with", plus the confidence label
"SSRD detects the network's sites""SSRD flags newly certified domains whose pages match recovered kit pages"
"87% accurate""re-identified 13 of 19 held-out seed pages (68%, 95% CI 46–85%)"

9.4 A two-page skeleton

  1. Summary. The result with numbers and intervals, the window, and "investigative leads, not attribution".
  2. What the kits share. One sentence per kit, the signals that define it, KCDA kits separate from general CBR kits.
  3. What appeared, and when. New matches since the takedown, time from takedown to first match, and the time-to-flag median and p90.
  4. Method in five lines. CT → filter → passive visit → fingerprints → two-family rule → human review, with a link to the public repo.
  5. Leads. A table with the domain (defanged), kit, signals matched, confidence label and capture hash. Private, never in the repo.
  6. Limitations. Cloaking and the decoy share, filter recall (0.55 on future CBR names), wildcard certs, a CT-only view of a funnel that starts with Facebook ads, a thin KCDA seed set, and box downtime.

9.5 Process rules

  • Nothing is sent until Rahil approves the final text. Drafts, renders and this book are not approval.
  • Find the intake channel through the DA's office main line. Don't guess email addresses.
  • Send findings; don't offer to collect on request (chapter 7.3).
  • No operator names, no victim data, no addresses or handles in the body. Linking evidence stays in the private appendix.

Check yourself

Rewrite: "These 14 sites are run by the same scammers the VCU took down."
"14 domains first seen in CT after Oct 9 match kit-01-KCDA on at least two signal families (list attached; confidence: likely for 11, confirmed for 3 with copy and favicon matches). Kit matches indicate shared software, not shared operators."
Where does the decoy share go, and why?
Next to precision in the summary and in the limitations. High cloaking means precision undercounts real kit sites, and the reader needs both numbers to judge it.
Go deeper: Barbara Minto, The Pyramid Principle, ch. 1–2 · CISA guidance on sharing threat information with TLP (a vocabulary for "who may see this")

Appendix A · Week 2 · decisions for you

Where the code and the docs disagree

While writing this book, every claim was checked against src/ssrd/ as it stood on Oct 17, including uncommitted changes in the working tree. These are the gaps found. None was changed. Each one is your call.

#What the docs sayWhat the code doesWhy it matters / options
1Alert only on ≥ 2 strong signals from different families among A/B/C. D only adds weight. (SPEC R6, architecture.md)score.decide also alerts on 1 strong family + ≥ 2 other signals of any strength or family, so strong tlsh + asn + ns alerts.That's close to the "single-signal shortcut" CLAUDE.md forbids. Options: drop the second clause; or count only A/B/C medium signals; or keep it and document it in the SPEC with a reason. Then add a test for "strong + D + D → no alert" or the opposite. Try it in Fig 6.1.
2"a global token bucket at 20 requests/min" (SAFETY.md fetch rule 6)fetch.RateLimiter is a fixed-interval pacer: one request per 3 s, no bursts.The behavior is stricter than described, which is safe. Fix the wording so the docs match.
3Thresholds come from sweeps on labeled data (SPEC R6).tlsh_max_distance = 70, jaccard_min = 0.80 and copy_min_shared = 30 are marked placeholders.Expected at this stage. The week 3 sweep must use the tuning labels only (Fig 8.5).
4Name filter: recall 0.55 at 0.71% (README, config)The 0.93 threshold was chosen from the same test table it's reported on.Slightly optimistic. Re-measure on CBR names listed after Oct 17 with the threshold frozen, and report both.
5A medium copy signal needs ≥ 12 shared 5-grams.Seed-vs-background pairs reached a maximum of 15 shared (research.md).A background pair can earn a medium copy signal. Combined with item 1, medium signals can help trigger an alert. Consider raising it above the background maximum in the sweep.
6README: 52,897 CBR domains. research.md: 24,665 entries with a site.Not checked here.Probably entries vs split-out domains. Confirm in seeds.py and use one clearly defined number.
7The fetcher handles the filter's output.Measured: about 325 candidates/h against about 250 visits/h (README, Oct 17).About 75 candidates an hour can't be visited in time. The priority queue serves the highest model scores first, and the rest expire, counted. Report the expired share next to time to flag and recall, because it lowers effective recall below 0.55.

Appendix B · reference

Glossary

ASN
Autonomous System Number: the ID of a network operator on the internet. Your building's ISP is AS22768. Used for the egress check, and as a weak (D) signal.
Base rate
How common the thing you're looking for is in the population you test. It sets how far false positives drag precision down.
Checkpoint
A CT log's signed statement of its current size and root hash.
Cloaking / decoy
Showing a harmless page to visitors who don't look like victims. Labeled decoy-cloaked; never evaded.
Containment
Shared items ÷ the size of the smaller set. Used for the copy fingerprint.
CT (certificate transparency)
Public, append-only logs of TLS certificates. SSRD's source of newly certified names.
DNS rebinding
Making a name resolve to a public address when it's checked and a private one when it's used.
eTLD+1 / registrable domain
The public suffix plus one label, such as quantum-invest.co.uk. The unit SSRD dedupes and visits.
Family (A/B/C/D)
A group of signals that measure the same kind of thing: content, assets, page features, infrastructure.
Jaccard similarity
|A ∩ B| ÷ |A ∪ B| for two sets.
Kappa (Cohen's κ)
Agreement between two labelers beyond what chance alone would give.
Kit
Reused scam-site software (templates, scripts, copy). A kit match means the same software, never the same people.
MinHash
A short signature whose agreement rate estimates Jaccard similarity.
mmh3
MurmurHash3, a fast non-cryptographic hash. Used for favicons (Shodan recipe), n-gram buckets and copy shingles.
Names tile
A compact JSONL tile listing just the DNS names of 256 log entries. A non-core extension some static-CT logs serve.
p90
The value 90% of observations fall at or below.
Pass rate
The share of all new names the filter sends to the fetch queue. A measure of workload.
Precertificate
A logged copy of a certificate, made before issuance so proofs can be embedded. It's why CT entries can come before the site.
Precision / recall
Precision: the share of alerts that are real. Recall: the share of real cases that alert.
PSL
Public Suffix List: where registrable names begin, including private suffixes such as vercel.app.
Punycode (xn--)
The ASCII encoding of internationalized domain labels.
Shingle
A run of k consecutive items (tags or words) used to compare documents as sets.
SSRF
Server-side request forgery: tricking a fetcher into requesting internal addresses.
Static CT / tiles
Logs published as cacheable files in 256-entry tiles instead of an API.
TLSH
Trend Micro locality-sensitive hash. Similar inputs give hashes with a small distance.
Union-find
A data structure that tracks which items are in the same group as links are added.
Wilson interval
A confidence interval for a proportion that behaves well at small n and near 0% or 100%.