Counter-Surveillance Security Skill
Trail of Bits-style defensive security assessment focused on surveillance resistance,
metadata minimization, and operational security hardening.
When to Use
- Auditing privacy-sensitive applications
- Reviewing journalist/activist threat models
- Hardening communications platforms
- Assessing metadata leakage in protocols and applications
- Evaluating anonymous communication systems
- Reviewing data retention and logging policies
- Assessing exposure to lawful intercept and legal compulsion
Threat Model Tiers
Structure analysis by adversary capability. Each tier subsumes the capabilities of all lower tiers.
| Tier |
Adversary |
Capabilities |
| 1 |
Passive network observer |
ISP, coffee shop WiFi, upstream AS. Sees DNS, IP flows, unencrypted traffic. |
| 2 |
Active network attacker |
MITM, DNS manipulation, BGP hijack, certificate compromise via rogue CA. |
| 3 |
Platform-level adversary |
Cloud provider, app store, OS vendor. Access to plaintext data at rest, push notification content, software update channel. |
| 4 |
State-level |
Lawful intercept (CALEA), FISA orders, national security letters with gag orders, IMSI catchers (Stingray), device exploit vendors (NSO Group). |
| 5 |
Global passive adversary |
Traffic analysis across jurisdictions, correlation attacks on anonymity networks, upstream cable taps (UPSTREAM/PRISM-class). |
Always define the threat tier before beginning an audit. Controls adequate for Tier 1 are meaningless against Tier 4.
Surveillance Surface Taxonomy
Network Metadata
- DNS queries (reveal browsing intent even with HTTPS)
- TLS SNI field (reveals destination hostname in plaintext pre-ECH)
- Connection timing and duration patterns
- Packet sizes and inter-arrival times (traffic fingerprinting)
- IP address correlation across sessions
Application Metadata
- Push notification payloads (visible to Apple/Google)
- App store analytics and telemetry
- Crash reports containing device state
- Update check frequency and timing
- OAuth token exchanges revealing service usage
Device Fingerprinting
- Browser fingerprint (canvas, WebGL, fonts, screen resolution)
- Hardware identifiers (IMEI, MAC address, serial numbers)
- Sensor data (accelerometer, gyroscope uniqueness)
- Installed font and plugin enumeration
- TLS client fingerprint (JA3/JA4)
Location Tracking
- GPS and GNSS precise positioning
- Cell tower triangulation (passive, no user consent needed)
- WiFi positioning (BSSID databases)
- Bluetooth beacons and BLE scanning
- IP geolocation databases
Communications Metadata
- Who-talks-to-whom social graph (contact chaining)
- Timing and frequency of communication
- Message size and duration patterns
- Group membership inference
- Presence and online status indicators
Financial Tracking
- Payment processor transaction logs
- Blockchain analysis and address clustering
- Loyalty program purchase correlation
- ATM and POS location tracking
- Subscription service usage patterns
Audit Methodology
Map data flows — Diagram all metadata emission points from client to server to third party. Include DNS resolvers, CDNs, analytics, crash reporting, and push notification services.
Assess encryption coverage — Evaluate protection for data in transit (TLS 1.3, certificate pinning), at rest (full-disk encryption, per-record encryption), and in use (enclaves, MPC, FHE where applicable).
Evaluate authentication without identification — Can users authenticate to the service without revealing real-world identity? Review account creation flow, recovery mechanisms, and payment requirements.
Review logging and data retention — What identifiers are logged server-side? For how long? Under what legal jurisdiction? Can logs be compelled via subpoena, NSL, or FISA order?
Test traffic analysis resistance — Are encrypted messages padded to uniform size? Is timing randomized? Is cover traffic generated? Can an observer distinguish message types by size or pattern?
Assess supply chain integrity — Are builds reproducible? Are dependencies pinned and audited? Is the signing key air-gapped? Can users verify binary-to-source correspondence?
Review jurisdiction and legal compulsion exposure — Map server locations, corporate domicile, and applicable legal frameworks. Identify single points of legal compulsion (one subpoena reveals all user data).
Code Review Patterns
Look for these anti-patterns in privacy-sensitive codebases:
# FINDING: Unnecessary logging of user identifiers
logger.info(f"Request from user {user_id} at {ip_address}")
# FIX: Log only what is operationally necessary; use rotating pseudonyms
# FINDING: Unpadded encrypted messages reveal content type
encrypted = encrypt(message)
# FIX: Pad all messages to fixed size buckets before encryption
encrypted = encrypt(pad_to_bucket(message))
# FINDING: Timestamps with unnecessary precision
created_at = datetime.utcnow() # microsecond precision
# FIX: Round to reduce temporal fingerprinting
created_at = datetime.utcnow().replace(minute=0, second=0, microsecond=0)
# FINDING: Device identifiers transmitted to server
analytics.send(device_id=get_hardware_id())
# FIX: Use unlinkable session tokens; never transmit hardware IDs
# FINDING: DNS queries leaking browsing intent
requests.get("https://sensitive-site.org/resource")
# FIX: Enforce DNS-over-HTTPS/TLS; consider Tor for DNS resolution
# FINDING: Push notification content visible to platform provider
send_push(user, title="New message from Alice")
# FIX: Send empty/tombstone push; fetch content via E2E encrypted channel
# FINDING: Certificate pinning absent or bypassable
session = requests.Session() # no pin validation
# FIX: Pin leaf or intermediate cert; detect and alert on pin failure
Hardening Checklist
Related Skills
static-security-analyzer — Automated code scanning for security vulnerabilities
webapp-testing — Web application penetration testing methodology
secure-workflow-guide — Secure development lifecycle and CI/CD hardening
1---2name: counter-surveillance3description: Assess and harden operational security (OPSEC) posture for applications, communications, and infrastructure. Identifies surveillance exposure, metadata leakage, and tracking vectors. Use when auditing privacy-sensitive applications, reviewing OPSEC for threat models involving state-level adversaries, or hardening communications infrastructure.4---56# Counter-Surveillance Security Skill78Trail of Bits-style defensive security assessment focused on surveillance resistance,9metadata minimization, and operational security hardening.1011## When to Use1213- Auditing privacy-sensitive applications14- Reviewing journalist/activist threat models15- Hardening communications platforms16- Assessing metadata leakage in protocols and applications17- Evaluating anonymous communication systems18- Reviewing data retention and logging policies19- Assessing exposure to lawful intercept and legal compulsion2021## Threat Model Tiers2223Structure analysis by adversary capability. Each tier subsumes the capabilities of all lower tiers.2425| Tier | Adversary | Capabilities |26|------|-----------|-------------|27| **1** | Passive network observer | ISP, coffee shop WiFi, upstream AS. Sees DNS, IP flows, unencrypted traffic. |28| **2** | Active network attacker | MITM, DNS manipulation, BGP hijack, certificate compromise via rogue CA. |29| **3** | Platform-level adversary | Cloud provider, app store, OS vendor. Access to plaintext data at rest, push notification content, software update channel. |30| **4** | State-level | Lawful intercept (CALEA), FISA orders, national security letters with gag orders, IMSI catchers (Stingray), device exploit vendors (NSO Group). |31| **5** | Global passive adversary | Traffic analysis across jurisdictions, correlation attacks on anonymity networks, upstream cable taps (UPSTREAM/PRISM-class). |3233Always define the threat tier before beginning an audit. Controls adequate for Tier 1 are meaningless against Tier 4.3435## Surveillance Surface Taxonomy3637### Network Metadata38- DNS queries (reveal browsing intent even with HTTPS)39- TLS SNI field (reveals destination hostname in plaintext pre-ECH)40- Connection timing and duration patterns41- Packet sizes and inter-arrival times (traffic fingerprinting)42- IP address correlation across sessions4344### Application Metadata45- Push notification payloads (visible to Apple/Google)46- App store analytics and telemetry47- Crash reports containing device state48- Update check frequency and timing49- OAuth token exchanges revealing service usage5051### Device Fingerprinting52- Browser fingerprint (canvas, WebGL, fonts, screen resolution)53- Hardware identifiers (IMEI, MAC address, serial numbers)54- Sensor data (accelerometer, gyroscope uniqueness)55- Installed font and plugin enumeration56- TLS client fingerprint (JA3/JA4)5758### Location Tracking59- GPS and GNSS precise positioning60- Cell tower triangulation (passive, no user consent needed)61- WiFi positioning (BSSID databases)62- Bluetooth beacons and BLE scanning63- IP geolocation databases6465### Communications Metadata66- Who-talks-to-whom social graph (contact chaining)67- Timing and frequency of communication68- Message size and duration patterns69- Group membership inference70- Presence and online status indicators7172### Financial Tracking73- Payment processor transaction logs74- Blockchain analysis and address clustering75- Loyalty program purchase correlation76- ATM and POS location tracking77- Subscription service usage patterns7879## Audit Methodology80811. **Map data flows** — Diagram all metadata emission points from client to server to third party. Include DNS resolvers, CDNs, analytics, crash reporting, and push notification services.82832. **Assess encryption coverage** — Evaluate protection for data in transit (TLS 1.3, certificate pinning), at rest (full-disk encryption, per-record encryption), and in use (enclaves, MPC, FHE where applicable).84853. **Evaluate authentication without identification** — Can users authenticate to the service without revealing real-world identity? Review account creation flow, recovery mechanisms, and payment requirements.86874. **Review logging and data retention** — What identifiers are logged server-side? For how long? Under what legal jurisdiction? Can logs be compelled via subpoena, NSL, or FISA order?88895. **Test traffic analysis resistance** — Are encrypted messages padded to uniform size? Is timing randomized? Is cover traffic generated? Can an observer distinguish message types by size or pattern?90916. **Assess supply chain integrity** — Are builds reproducible? Are dependencies pinned and audited? Is the signing key air-gapped? Can users verify binary-to-source correspondence?92937. **Review jurisdiction and legal compulsion exposure** — Map server locations, corporate domicile, and applicable legal frameworks. Identify single points of legal compulsion (one subpoena reveals all user data).9495## Code Review Patterns9697Look for these anti-patterns in privacy-sensitive codebases:9899```100# FINDING: Unnecessary logging of user identifiers101logger.info(f"Request from user {user_id} at {ip_address}")102# FIX: Log only what is operationally necessary; use rotating pseudonyms103104# FINDING: Unpadded encrypted messages reveal content type105encrypted = encrypt(message)106# FIX: Pad all messages to fixed size buckets before encryption107encrypted = encrypt(pad_to_bucket(message))108109# FINDING: Timestamps with unnecessary precision110created_at = datetime.utcnow() # microsecond precision111# FIX: Round to reduce temporal fingerprinting112created_at = datetime.utcnow().replace(minute=0, second=0, microsecond=0)113114# FINDING: Device identifiers transmitted to server115analytics.send(device_id=get_hardware_id())116# FIX: Use unlinkable session tokens; never transmit hardware IDs117118# FINDING: DNS queries leaking browsing intent119requests.get("https://sensitive-site.org/resource")120# FIX: Enforce DNS-over-HTTPS/TLS; consider Tor for DNS resolution121122# FINDING: Push notification content visible to platform provider123send_push(user, title="New message from Alice")124# FIX: Send empty/tombstone push; fetch content via E2E encrypted channel125126# FINDING: Certificate pinning absent or bypassable127session = requests.Session() # no pin validation128# FIX: Pin leaf or intermediate cert; detect and alert on pin failure129```130131## Hardening Checklist132133- [ ] **Network anonymity** — Tor/onion routing for metadata-resistant connectivity134- [ ] **E2E encrypted messaging** — Signal protocol or equivalent with forward secrecy135- [ ] **Metadata-resistant protocols** — Sealed Sender, Private Information Retrieval, oblivious HTTP136- [ ] **Encrypted DNS** — DNS-over-HTTPS or DNS-over-TLS with trusted resolver; ECH for SNI137- [ ] **Reproducible builds** — Deterministic compilation; users can verify binary matches source138- [ ] **Air-gapped signing** — Software release signing keys on offline hardware139- [ ] **Memory-safe crypto** — Rust, Go, or formally verified C for cryptographic implementations140- [ ] **Minimal logging** — Log only what is operationally essential; auto-expire within days141- [ ] **Jurisdiction diversity** — Distribute infrastructure across non-cooperating legal jurisdictions142- [ ] **Warrant canary** — Publish regular signed statements of non-compromise; absence signals compulsion143- [ ] **Anonymous account creation** — No phone number, no email, no payment required144- [ ] **Forward secrecy** — Compromise of long-term keys does not reveal past communications145146## Related Skills147148- `static-security-analyzer` — Automated code scanning for security vulnerabilities149- `webapp-testing` — Web application penetration testing methodology150- `secure-workflow-guide` — Secure development lifecycle and CI/CD hardening