rule win_mokes_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.mokes."
        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.mokes"
        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 = { ff74242c 8b480c 8b5004 03c8 e8???????? 83c40c 89442424 }
            // n = 7, score = 400
            //   ff74242c             | push                dword ptr [esp + 0x2c]
            //   8b480c               | mov                 ecx, dword ptr [eax + 0xc]
            //   8b5004               | mov                 edx, dword ptr [eax + 4]
            //   03c8                 | add                 ecx, eax
            //   e8????????           |                     
            //   83c40c               | add                 esp, 0xc
            //   89442424             | mov                 dword ptr [esp + 0x24], eax

        $sequence_1 = { f7d1 83e101 8b440308 c1e808 034308 0fafc8 03f9 }
            // n = 7, score = 400
            //   f7d1                 | not                 ecx
            //   83e101               | and                 ecx, 1
            //   8b440308             | mov                 eax, dword ptr [ebx + eax + 8]
            //   c1e808               | shr                 eax, 8
            //   034308               | add                 eax, dword ptr [ebx + 8]
            //   0fafc8               | imul                ecx, eax
            //   03f9                 | add                 edi, ecx

        $sequence_2 = { ff75dc 51 57 ff7518 ff751c ff7508 8d4de0 }
            // n = 7, score = 400
            //   ff75dc               | push                dword ptr [ebp - 0x24]
            //   51                   | push                ecx
            //   57                   | push                edi
            //   ff7518               | push                dword ptr [ebp + 0x18]
            //   ff751c               | push                dword ptr [ebp + 0x1c]
            //   ff7508               | push                dword ptr [ebp + 8]
            //   8d4de0               | lea                 ecx, [ebp - 0x20]

        $sequence_3 = { ffb424a0090000 8d84249c010000 50 57 ff9424a8090000 83c40c 33ff }
            // n = 7, score = 400
            //   ffb424a0090000       | push                dword ptr [esp + 0x9a0]
            //   8d84249c010000       | lea                 eax, [esp + 0x19c]
            //   50                   | push                eax
            //   57                   | push                edi
            //   ff9424a8090000       | call                dword ptr [esp + 0x9a8]
            //   83c40c               | add                 esp, 0xc
            //   33ff                 | xor                 edi, edi

        $sequence_4 = { ff7054 ff74241c e8???????? 8b4c2430 8d442424 50 8d442424 }
            // n = 7, score = 400
            //   ff7054               | push                dword ptr [eax + 0x54]
            //   ff74241c             | push                dword ptr [esp + 0x1c]
            //   e8????????           |                     
            //   8b4c2430             | mov                 ecx, dword ptr [esp + 0x30]
            //   8d442424             | lea                 eax, [esp + 0x24]
            //   50                   | push                eax
            //   8d442424             | lea                 eax, [esp + 0x24]

        $sequence_5 = { ff74241c 894c2424 8d4c2414 89442428 e8???????? 8d4c2410 8bf0 }
            // n = 7, score = 400
            //   ff74241c             | push                dword ptr [esp + 0x1c]
            //   894c2424             | mov                 dword ptr [esp + 0x24], ecx
            //   8d4c2414             | lea                 ecx, [esp + 0x14]
            //   89442428             | mov                 dword ptr [esp + 0x28], eax
            //   e8????????           |                     
            //   8d4c2410             | lea                 ecx, [esp + 0x10]
            //   8bf0                 | mov                 esi, eax

        $sequence_6 = { ff3488 ff3490 8b44241c 8b1488 8b4c242c 8b0c88 e8???????? }
            // n = 7, score = 400
            //   ff3488               | push                dword ptr [eax + ecx*4]
            //   ff3490               | push                dword ptr [eax + edx*4]
            //   8b44241c             | mov                 eax, dword ptr [esp + 0x1c]
            //   8b1488               | mov                 edx, dword ptr [eax + ecx*4]
            //   8b4c242c             | mov                 ecx, dword ptr [esp + 0x2c]
            //   8b0c88               | mov                 ecx, dword ptr [eax + ecx*4]
            //   e8????????           |                     

        $sequence_7 = { f7d9 2bf1 8d4201 89442460 8d4601 eb0c 8b442458 }
            // n = 7, score = 400
            //   f7d9                 | neg                 ecx
            //   2bf1                 | sub                 esi, ecx
            //   8d4201               | lea                 eax, [edx + 1]
            //   89442460             | mov                 dword ptr [esp + 0x60], eax
            //   8d4601               | lea                 eax, [esi + 1]
            //   eb0c                 | jmp                 0xe
            //   8b442458             | mov                 eax, dword ptr [esp + 0x58]

        $sequence_8 = { ff7104 8bce e8???????? 8b16 8d0c9b 8b420c 8d0488 }
            // n = 7, score = 400
            //   ff7104               | push                dword ptr [ecx + 4]
            //   8bce                 | mov                 ecx, esi
            //   e8????????           |                     
            //   8b16                 | mov                 edx, dword ptr [esi]
            //   8d0c9b               | lea                 ecx, [ebx + ebx*4]
            //   8b420c               | mov                 eax, dword ptr [edx + 0xc]
            //   8d0488               | lea                 eax, [eax + ecx*4]

        $sequence_9 = { ff74240c 81c1c4000000 e8???????? 8b7c2410 8bf0 8b0f 8b01 }
            // n = 7, score = 400
            //   ff74240c             | push                dword ptr [esp + 0xc]
            //   81c1c4000000         | add                 ecx, 0xc4
            //   e8????????           |                     
            //   8b7c2410             | mov                 edi, dword ptr [esp + 0x10]
            //   8bf0                 | mov                 esi, eax
            //   8b0f                 | mov                 ecx, dword ptr [edi]
            //   8b01                 | mov                 eax, dword ptr [ecx]

    condition:
        7 of them and filesize < 18505728
}