Lion Cipher Lab

Extract a C2 beacon configuration from a payload and turn it into IOCs — recover the XOR key with no key, parse the TLV, emit indicators

Why it matters

A file hash changes for free every time an operator rebuilds. The C2 host, the URI, the user-agent and the campaign-level traffic key do not — they are reused across a whole family because standing up new infrastructure is expensive. Those indicators are baked into the payload as an obfuscated config, and the analyst who can pull them out turns one unknown blob into a block-list, a hunt query, and a cluster of related samples. Config extraction is daily bread for a malware-focused CTI analyst and the whole reason automated parser frameworks exist. The single-byte-XOR-plus-TLV case you…

What you'll learn

Steps in this lab

  1. The idea in plain language: a beacon carries its orders as an obfuscated TLV blob
  2. Safety and scope: you build the only thing you analyse
  3. Set up: confirm Python and make a scratch folder
  4. Define the TLV format and build the synthetic payload (make_beacon.py)
  5. The analyst's problem: no key, no source, just bytes
  6. Write the extractor and run the 256-key search (extract_config.py)
  7. Read Phase A: why 'most printable' is a trap
  8. Read Phase B: the sentinel picks the one true key
  9. The honest negative: a short sentinel lets false keys survive
  10. Parse the TLV and emit the IOCs
  11. Try the same recovery by hand in CyberChef (optional)
  12. Honest limits — single-byte XOR is the easy case

Open the full interactive lab →