rule win_fatduke_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.fatduke."
        info = "autogenerated rule brought to you by yara-signator"
        tool = "yara-signator v0.6.0"
        signator_config = "callsandjumps;datarefs;binvalue"
        malpedia_reference = "https://malpedia.caad.fkie.fraunhofer.de/details/win.fatduke"
        malpedia_rule_date = "20260916"
        malpedia_hash = "53a643781c18e08f4a50949af60172d837a0b6f6"
        malpedia_version = "20260917"
        malpedia_license = "CC BY-SA 4.0"
        malpedia_sharing = "TLP:WHITE"

    /* DISCLAIMER
     * The strings used in this rule have been automatically selected from the
     * disassembly of memory dumps and unpacked files, using YARA-Signator.
     * The code and documentation is published here:
     * https://github.com/fxb-cocacoding/yara-signator
     * As Malpedia is used as data source, please note that for a given
     * number of families, only single samples are documented.
     * This likely impacts the degree of generalization these rules will offer.
     * Take the described generation method also into consideration when you
     * apply the rules in your use cases and assign them confidence levels.
     */


    strings:
        $sequence_0 = { ff4818 8b4818 8b401c 8a0401 8bcf 8845f0 ff75f0 }
            // n = 7, score = 200
            //   ff4818               | dec                 dword ptr [eax + 0x18]
            //   8b4818               | mov                 ecx, dword ptr [eax + 0x18]
            //   8b401c               | mov                 eax, dword ptr [eax + 0x1c]
            //   8a0401               | mov                 al, byte ptr [ecx + eax]
            //   8bcf                 | mov                 ecx, edi
            //   8845f0               | mov                 byte ptr [ebp - 0x10], al
            //   ff75f0               | push                dword ptr [ebp - 0x10]

        $sequence_1 = { c745e800000000 8bc3 8b4df4 64890d00000000 59 5f 5e }
            // n = 7, score = 200
            //   c745e800000000       | mov                 dword ptr [ebp - 0x18], 0
            //   8bc3                 | mov                 eax, ebx
            //   8b4df4               | mov                 ecx, dword ptr [ebp - 0xc]
            //   64890d00000000       | mov                 dword ptr fs:[0], ecx
            //   59                   | pop                 ecx
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi

        $sequence_2 = { ffb424e8000000 e8???????? 83c404 33c0 c78424fc00000007000000 c78424f800000000000000 66898424e8000000 }
            // n = 7, score = 200
            //   ffb424e8000000       | push                dword ptr [esp + 0xe8]
            //   e8????????           |                     
            //   83c404               | add                 esp, 4
            //   33c0                 | xor                 eax, eax
            //   c78424fc00000007000000     | mov    dword ptr [esp + 0xfc], 7
            //   c78424f800000000000000     | mov    dword ptr [esp + 0xf8], 0
            //   66898424e8000000     | mov                 word ptr [esp + 0xe8], ax

        $sequence_3 = { e8???????? 83c404 33c0 c78424dc00000007000000 c78424d800000000000000 66898424c8000000 eb04 }
            // n = 7, score = 200
            //   e8????????           |                     
            //   83c404               | add                 esp, 4
            //   33c0                 | xor                 eax, eax
            //   c78424dc00000007000000     | mov    dword ptr [esp + 0xdc], 7
            //   c78424d800000000000000     | mov    dword ptr [esp + 0xd8], 0
            //   66898424c8000000     | mov                 word ptr [esp + 0xc8], ax
            //   eb04                 | jmp                 6

        $sequence_4 = { c6460401 ff742418 8bce e8???????? 84c0 0f8465feffff 8b5c2438 }
            // n = 7, score = 200
            //   c6460401             | mov                 byte ptr [esi + 4], 1
            //   ff742418             | push                dword ptr [esp + 0x18]
            //   8bce                 | mov                 ecx, esi
            //   e8????????           |                     
            //   84c0                 | test                al, al
            //   0f8465feffff         | je                  0xfffffe6b
            //   8b5c2438             | mov                 ebx, dword ptr [esp + 0x38]

        $sequence_5 = { ff7304 50 e8???????? ff33 e8???????? 83c404 8b4dec }
            // n = 7, score = 200
            //   ff7304               | push                dword ptr [ebx + 4]
            //   50                   | push                eax
            //   e8????????           |                     
            //   ff33                 | push                dword ptr [ebx]
            //   e8????????           |                     
            //   83c404               | add                 esp, 4
            //   8b4dec               | mov                 ecx, dword ptr [ebp - 0x14]

        $sequence_6 = { eb19 8b45f0 8b5de8 8b55f0 3bc3 7305 83c8ff }
            // n = 7, score = 200
            //   eb19                 | jmp                 0x1b
            //   8b45f0               | mov                 eax, dword ptr [ebp - 0x10]
            //   8b5de8               | mov                 ebx, dword ptr [ebp - 0x18]
            //   8b55f0               | mov                 edx, dword ptr [ebp - 0x10]
            //   3bc3                 | cmp                 eax, ebx
            //   7305                 | jae                 7
            //   83c8ff               | or                  eax, 0xffffffff

        $sequence_7 = { c783980100000f000000 c7839401000000000000 c6838401000000 c645fc0e 83bb8001000010 720e ffb36c010000 }
            // n = 7, score = 200
            //   c783980100000f000000     | mov    dword ptr [ebx + 0x198], 0xf
            //   c7839401000000000000     | mov    dword ptr [ebx + 0x194], 0
            //   c6838401000000       | mov                 byte ptr [ebx + 0x184], 0
            //   c645fc0e             | mov                 byte ptr [ebp - 4], 0xe
            //   83bb8001000010       | cmp                 dword ptr [ebx + 0x180], 0x10
            //   720e                 | jb                  0x10
            //   ffb36c010000         | push                dword ptr [ebx + 0x16c]

        $sequence_8 = { ff742420 8d44241c ff7510 ff750c 50 ff742434 e8???????? }
            // n = 7, score = 200
            //   ff742420             | push                dword ptr [esp + 0x20]
            //   8d44241c             | lea                 eax, [esp + 0x1c]
            //   ff7510               | push                dword ptr [ebp + 0x10]
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   50                   | push                eax
            //   ff742434             | push                dword ptr [esp + 0x34]
            //   e8????????           |                     

        $sequence_9 = { 8d7c2440 8a07 3c7f 744b 84c0 7e47 8b4c2410 }
            // n = 7, score = 200
            //   8d7c2440             | lea                 edi, [esp + 0x40]
            //   8a07                 | mov                 al, byte ptr [edi]
            //   3c7f                 | cmp                 al, 0x7f
            //   744b                 | je                  0x4d
            //   84c0                 | test                al, al
            //   7e47                 | jle                 0x49
            //   8b4c2410             | mov                 ecx, dword ptr [esp + 0x10]

    condition:
        7 of them and filesize < 9012224
}