Moonlight

Blood Moon C2

Framework analysis

WEASEL

DNS C2 carries encoded data in query names and encrypted tasking in AAAA answers.

Python
11 observablesReviewed 2026-10-314376c3e6679c ↗

Framework Overview

Python beacon/authority framing, key exchange and task modes, including quiet/synchronous completion and result limits. Separate pyaes demonstrations were read as inert text.

Source Version 4376c3e6679c

Architecture

Source Flow01 / 06
Operator Task QueueDNS Authority
Queue Typed Commands: Operator actions enqueue function|arguments in a per-session outbound queue. Replies join queued commands with ^, encrypt and packetize them, then clear the queue without per-command delivery confirmation.1Encode Data into AAAA Queries: The beacon encrypts typed messages, applies modified Base32, splits into at most 16 fragments of 50 encoded characters, and prefixes sequence/count characters. Names carry a two-hex-character stream and four-hex-character session before the configured domain. getaddrinfo uses the system resolver; no direct hardcoded resolver IP is selected here.2Resolve the Encoded Names: Normal DNS resolution delivers the name to the authority. The server parses and reassembles it by session/stream, restores Base32 and decrypts data. Source IP at the authority can be a recursive resolver rather than the victim.3Return Task Bytes as AAAA Answers: Replies travel back through DNS resolution. Ordinary payload records contain one obfuscated sequence byte and up to 15 data bytes, with zero-padding to 16 bytes. The initial session-cookie record uses four ASCII hex characters plus twelve zero bytes instead. The client reassembles and decrypts the data; the AAAA addresses are not connection destinations.4Dispatch Commands and Return Results: Type 8/80 executes Python in-process; 9/90 runs a shell synchronously/asynchronously. Synchronous results are sliced to 400 characters before encoding; quiet Python results to 40. Type 90 does not send an immediate result despite broader server-side descriptions. Results from other paths enter the same DNS query channel.5Save Server Sessions on Request: The server can serialize sessions with dill to a configurable filename, default WEASEL.pkl. Autosave starts disabled in MainMenu. This is server state retention, not victim persistence; acquired serialized files must never be loaded for this review.6Operator task queue: Server commands and sessions
Operator Task QueueServer commands and sessions
DNS authority: Resolver / PacketHandler
DNS AuthorityResolver / PacketHandler
System DNS resolver: AAAA lookup API
System DNS ResolverAAAA lookup API
Server session save: Optional WEASEL.pkl artifact
Server Session SaveOptional WEASEL.pkl artifact
Shell / Python tasks: Victim execution and output
Shell / Python TasksVictim execution and output
Python beacon: DH / AES-CTR / packet codec
Python BeaconDH / AES-CTR / packet codec