rule FortCheck_Stage5_Python_Downloader
{
    meta:
        description = "FortCheck ClickFix stage 5: IronPython downloader fetching timer4 and exec()ing it (UTF-8 or UTF-32LE)"
        author = "DroppingAnvil / anvildevelopment.us"
        reference = "https://anvildevelopment.us/fortcheck-clickfix-fortnite"
        date = "2026-10-22"
        hash = "303dc4c036b970c8b92bd8fa04a857271325e42eb1c06311299c85d11a758ee1"
    strings:
        $a1 = "ssl._create_default_https_context = ssl._create_unverified_context" ascii
        $a2 = "urllib.request.urlopen(" ascii
        $a3 = "/timer4')" ascii
        $a4 = "exec(c)" ascii
        $u1 = { 73 00 00 00 73 00 00 00 6C 00 00 00 2E 00 00 00 5F 00 00 00 63 00 00 00 72 00 00 00 65 00 00 00 61 00 00 00 74 00 00 00 65 00 00 00 5F 00 00 00 75 00 00 00 6E 00 00 00 76 00 00 00 65 00 00 00 72 00 00 00 69 00 00 00 66 00 00 00 69 00 00 00 65 00 00 00 64 00 00 00 5F 00 00 00 63 00 00 00 6F 00 00 00 6E 00 00 00 74 00 00 00 65 00 00 00 78 00 00 00 74 00 00 00 }
        $u2 = { 75 00 00 00 72 00 00 00 6C 00 00 00 6C 00 00 00 69 00 00 00 62 00 00 00 2E 00 00 00 72 00 00 00 65 00 00 00 71 00 00 00 75 00 00 00 65 00 00 00 73 00 00 00 74 00 00 00 2E 00 00 00 75 00 00 00 72 00 00 00 6C 00 00 00 6F 00 00 00 70 00 00 00 65 00 00 00 6E 00 00 00 28 00 00 00 }
        $u3 = { 2F 00 00 00 74 00 00 00 69 00 00 00 6D 00 00 00 65 00 00 00 72 00 00 00 34 00 00 00 27 00 00 00 29 00 00 00 }
        $u4 = { 65 00 00 00 78 00 00 00 65 00 00 00 63 00 00 00 28 00 00 00 63 00 00 00 29 00 00 00 }
    condition:
        filesize < 20KB and (all of ($a*) or all of ($u*))
}

rule FortCheck_Stage6_Timer4_Homoglyph_Exec
{
    meta:
        description = "FortCheck ClickFix stage 6 (timer4): base64 exec with Cyrillic homoglyph substitution chain"
        author = "DroppingAnvil / anvildevelopment.us"
        reference = "https://anvildevelopment.us/fortcheck-clickfix-fortnite"
        date = "2026-10-22"
        hash = "47e5e435c126e9243d55a2440bcc28f2bd6d9b4627ce7904cc2866f9b7f67390"
    strings:
        $exec = "exec(base64.b64decode(\"" ascii
        $r1 = ".replace('П', 'h')" ascii
        $r2 = ".replace('з', 'F')" ascii
        $r3 = ".replace('б', 'y')" ascii
        $r4 = ".replace('Г', 'X')" ascii
        $r5 = ".replace('ё', 'D')" ascii
        $r6 = ".replace('х', 'M')" ascii
        $r7 = ".replace('З', '2')" ascii
        $r8 = ".replace('К', 'K')" ascii
        $r9 = ".replace('Ё', 'O')" ascii
        $any_cyr_replace = /\.replace\('[\xD0\xD1][\x80-\xBF]', '[A-Za-z0-9]'\)/
    condition:
        filesize < 200KB and $exec and (5 of ($r*) or #any_cyr_replace >= 6)
}

rule FortCheck_Stage7_Python_Shellcode_Loader
{
    meta:
        description = "FortCheck ClickFix stage 7: Python ctypes loader, XOR+base64 shellcode, HeapCreate(EXECUTE) + RtlMoveMemory + CFUNCTYPE"
        author = "DroppingAnvil / anvildevelopment.us"
        reference = "https://anvildevelopment.us/fortcheck-clickfix-fortnite"
        date = "2026-10-22"
        hash = "984b0bbd98b71a9c31329820c2c091bb0b268277c577f455072fabdc8ac74f5f"
    strings:
        $x = "def xor_decrypt(ciphertext_bytes, key_bytes):" ascii
        $s1 = "shellcode = bytearray(xor_decrypt(base64.b64decode(" ascii
        $h1 = "HeapCreate(0x00040000, len(shellcode), 0)" ascii
        $h2 = "RtlMoveMemory(ctypes.c_int(ptr), buf, ctypes.c_int(len(shellcode)))" ascii
        $h3 = "functype = ctypes.CFUNCTYPE(ctypes.c_void_p)" ascii
    condition:
        filesize < 100KB and ($x or $s1) and 2 of ($h*)
}

rule FortCheck_Stage8_x86_Shellcode
{
    meta:
        description = "FortCheck ClickFix stage 8: x86 shellcode, UTF-16 URL/UA stack builder + module-index API hashing"
        author = "DroppingAnvil / anvildevelopment.us"
        reference = "https://anvildevelopment.us/fortcheck-clickfix-fortnite"
        date = "2026-10-22"
        hash = "c8d59ba2dc5d665af80b83da25c2d586693f95565b6b87c45f25b3bc125563c6"
    strings:
        // mov eax,'h'; mov [ebp-x],ax; mov ecx,'t'; mov [ebp-x],cx; mov edx,'t'; mov [ebp-x],dx; mov eax,'p'
        $https_stack = { B8 68 00 00 00 66 89 85 ?? ?? FF FF B9 74 00 00 00 66 89 8D ?? ?? FF FF BA 74 00 00 00 66 89 95 ?? ?? FF FF B8 70 00 00 00 }
        // push <api hash>; push <module idx>; call resolver  (hashes not shared with the loader stub)
        $h1 = { 68 02 0D 58 C6 6A 01 E8 }
        $h2 = { 68 0E 67 FD 1F 6A 01 E8 }
        $h3 = { 68 C5 93 48 37 6A 01 E8 }
        $h4 = { 68 F0 BE 41 42 6A 04 E8 }
    condition:
        filesize < 64KB and uint16(0) != 0x5A4D and $https_stack and 2 of ($h*)
}

rule FortCheck_Stage10_XOR_Stub
{
    meta:
        description = "FortCheck ClickFix stage 10: RC4-decrypted container, call/pop 8-byte XOR stub in front of the loader"
        author = "DroppingAnvil / anvildevelopment.us"
        reference = "https://anvildevelopment.us/fortcheck-clickfix-fortnite"
        date = "2026-10-22"
        hash = "79b49058f8c880eb469cde16c9eccfa1da674a05d0724ea088869370487dd7a9"
    strings:
        $stub = { EB 38 5F 8B 0F 83 E9 0C 89 CE 31 C9 39 F1 74 1A 89 C8 BB 08 00 00 00 31 D2 F7 F3 }
    condition:
        $stub at 0
}

rule FortCheck_Loader_Stub_Reflective_PE
{
    meta:
        description = "FortCheck ClickFix stage 10->11: reflective PE loader stub (u32 stub size, hashed APIs, DLL/EXE entry dispatch) with embedded PE"
        author = "DroppingAnvil / anvildevelopment.us"
        reference = "https://anvildevelopment.us/fortcheck-clickfix-fortnite"
        date = "2026-10-22"
        hash = "d7284b838e34d179c0a3e21a9453b9210685d665347c132b99c043c8574958ef"
    strings:
        $prologue = { 55 8B EC 83 EC 0C C7 45 FC 00 00 00 00 8D 45 FC 50 8B 4D 08 51 E8 }
        // test ecx,IMAGE_FILE_DLL; jz; ... add eax,[edx+0x28] (AddressOfEntryPoint)
        $dispatch = { 81 E1 00 20 00 00 74 20 8B 55 0C 8B 45 08 03 42 28 }
        $h1 = { 68 4C C3 93 67 6A 00 E8 }
        $h2 = { 68 C3 7F DB CD 6A 01 E8 }
        $h3 = { 68 AD 14 50 59 6A 00 E8 }
        $mz = { 4D 5A 90 00 }
    condition:
        uint16(0) != 0x5A4D and $prologue in (0..16) and $dispatch and 2 of ($h*)
        and $mz in (uint32(0)..uint32(0) + 64)
}

rule FortCheck_Stage11_Loader_Bot
{
    meta:
        description = "FortCheck ClickFix stage 11: loader/bot (ContainerField C2 protocol, ChaCha20 config, custom API hash, NtManageHotPatch patch)"
        author = "DroppingAnvil / anvildevelopment.us"
        reference = "https://anvildevelopment.us/fortcheck-clickfix-fortnite"
        date = "2026-10-22"
        hash = "929dfec626ebb5f15e6799d0a91f2723d18bfcfb4264013e5f24117695eeae72"
    strings:
        $rtti1 = ".?AVContainerFieldStringW@containers@connection@@" ascii
        $rtti2 = ".?AVContainerFieldBlob@containers@connection@@" ascii
        $rtti3 = ".?AVContainerFieldArray@containers@connection@@" ascii
        $rtti4 = ".?AVContainerFieldBool@containers@connection@@" ascii
        $w1 = "root\\SecurityCenter2" wide
        $w2 = "-ExecutionPolicy Bypass -NoProfile -EncodedCommand \"%s\"" wide
        $w3 = "--headless %s" wide
        // custom API hash: seed 0xAAAAAAAA; WinHttpConnect / WinHttpSendRequest constants
        $seed = { AA AA AA AA }
        $hc1 = { 81 03 08 6F }
        $hc2 = { 10 62 2C D2 }
        // NtManageHotPatch patch: mov eax,0xC00000BB / ret 0x10 written as two dwords
        $hp1 = { BB B8 00 00 }
        $hp2 = { C0 C2 10 00 }
    condition:
        uint16(0) == 0x5A4D and filesize < 2MB and 3 of ($rtti*)
        and 2 of ($w*) and $seed and ($hc1 or $hc2) and 1 of ($hp*)
}
