rule win_misha_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.misha."
        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.misha"
        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 = { 834e1802 8b542410 8ac1 c0e806 88460d 8ac1 }
            // n = 6, score = 300
            //   834e1802             | or                  dword ptr [esi + 0x18], 2
            //   8b542410             | mov                 edx, dword ptr [esp + 0x10]
            //   8ac1                 | mov                 al, cl
            //   c0e806               | shr                 al, 6
            //   88460d               | mov                 byte ptr [esi + 0xd], al
            //   8ac1                 | mov                 al, cl

        $sequence_1 = { ff7008 8b4510 ff30 8b450c 0590010000 50 e8???????? }
            // n = 7, score = 300
            //   ff7008               | push                dword ptr [eax + 8]
            //   8b4510               | mov                 eax, dword ptr [ebp + 0x10]
            //   ff30                 | push                dword ptr [eax]
            //   8b450c               | mov                 eax, dword ptr [ebp + 0xc]
            //   0590010000           | add                 eax, 0x190
            //   50                   | push                eax
            //   e8????????           |                     

        $sequence_2 = { 8d45e8 50 e8???????? 83c414 eb02 32c0 5e }
            // n = 7, score = 300
            //   8d45e8               | lea                 eax, [ebp - 0x18]
            //   50                   | push                eax
            //   e8????????           |                     
            //   83c414               | add                 esp, 0x14
            //   eb02                 | jmp                 4
            //   32c0                 | xor                 al, al
            //   5e                   | pop                 esi

        $sequence_3 = { c1ea08 0bc2 c3 0fb7c9 8bc1 25ff000000 c1e008 }
            // n = 7, score = 300
            //   c1ea08               | shr                 edx, 8
            //   0bc2                 | or                  eax, edx
            //   c3                   | ret                 
            //   0fb7c9               | movzx               ecx, cx
            //   8bc1                 | mov                 eax, ecx
            //   25ff000000           | and                 eax, 0xff
            //   c1e008               | shl                 eax, 8

        $sequence_4 = { 8945f8 e9???????? 6a00 ff75f0 ff75f4 ff15???????? c9 }
            // n = 7, score = 300
            //   8945f8               | mov                 dword ptr [ebp - 8], eax
            //   e9????????           |                     
            //   6a00                 | push                0
            //   ff75f0               | push                dword ptr [ebp - 0x10]
            //   ff75f4               | push                dword ptr [ebp - 0xc]
            //   ff15????????         |                     
            //   c9                   | leave               

        $sequence_5 = { ff06 8b06 8b4e10 c6040872 eb56 8b0e }
            // n = 6, score = 300
            //   ff06                 | inc                 dword ptr [esi]
            //   8b06                 | mov                 eax, dword ptr [esi]
            //   8b4e10               | mov                 ecx, dword ptr [esi + 0x10]
            //   c6040872             | mov                 byte ptr [eax + ecx], 0x72
            //   eb56                 | jmp                 0x58
            //   8b0e                 | mov                 ecx, dword ptr [esi]

        $sequence_6 = { 8945c0 eb0b 8b459c c1e004 8b4db4 8801 8b45c0 }
            // n = 7, score = 300
            //   8945c0               | mov                 dword ptr [ebp - 0x40], eax
            //   eb0b                 | jmp                 0xd
            //   8b459c               | mov                 eax, dword ptr [ebp - 0x64]
            //   c1e004               | shl                 eax, 4
            //   8b4db4               | mov                 ecx, dword ptr [ebp - 0x4c]
            //   8801                 | mov                 byte ptr [ecx], al
            //   8b45c0               | mov                 eax, dword ptr [ebp - 0x40]

        $sequence_7 = { e9???????? 6a00 ff730c e8???????? 59 59 0fb6c0 }
            // n = 7, score = 300
            //   e9????????           |                     
            //   6a00                 | push                0
            //   ff730c               | push                dword ptr [ebx + 0xc]
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   59                   | pop                 ecx
            //   0fb6c0               | movzx               eax, al

        $sequence_8 = { 8bd8 c7450804000000 8bd3 6a08 c1ea18 8bc7 8d75fc }
            // n = 7, score = 300
            //   8bd8                 | mov                 ebx, eax
            //   c7450804000000       | mov                 dword ptr [ebp + 8], 4
            //   8bd3                 | mov                 edx, ebx
            //   6a08                 | push                8
            //   c1ea18               | shr                 edx, 0x18
            //   8bc7                 | mov                 eax, edi
            //   8d75fc               | lea                 esi, [ebp - 4]

        $sequence_9 = { 8bc7 3bfe 7723 2b7d0c 33d2 395510 }
            // n = 6, score = 300
            //   8bc7                 | mov                 eax, edi
            //   3bfe                 | cmp                 edi, esi
            //   7723                 | ja                  0x25
            //   2b7d0c               | sub                 edi, dword ptr [ebp + 0xc]
            //   33d2                 | xor                 edx, edx
            //   395510               | cmp                 dword ptr [ebp + 0x10], edx

    condition:
        7 of them and filesize < 710656
}