rule win_moriya_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.moriya."
        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.moriya"
        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 = { 488bcb 4889442448 f30f7f442428 e8???????? }
            // n = 4, score = 200
            //   488bcb               | dec                 eax
            //   4889442448           | shr                 ecx, 0x18
            //   f30f7f442428         | inc                 ebp
            //   e8????????           |                     

        $sequence_1 = { 488b0d???????? e8???????? 488b0d???????? e8???????? 488325????????00 8bc3 }
            // n = 6, score = 200
            //   488b0d????????       |                     
            //   e8????????           |                     
            //   488b0d????????       |                     
            //   e8????????           |                     
            //   488325????????00     |                     
            //   8bc3                 | dec                 eax

        $sequence_2 = { 33d2 0f118590000000 448d4058 0f1185a0000000 e8???????? }
            // n = 5, score = 200
            //   33d2                 | mov                 eax, edx
            //   0f118590000000       | jb                  0x8ad
            //   448d4058             | inc                 ebp
            //   0f1185a0000000       | test                al, al
            //   e8????????           |                     

        $sequence_3 = { 498bd8 488364245000 488bfa 488bf1 33d2 41b8c8000000 }
            // n = 6, score = 200
            //   498bd8               | pop                 ebp
            //   488364245000         | mov                 eax, 0xc000009a
            //   488bfa               | jmp                 0x1ed8
            //   488bf1               | mov                 eax, 0xc0000225
            //   33d2                 | cmove               esi, eax
            //   41b8c8000000         | mov                 ecx, 0x200

        $sequence_4 = { 836318fe 488b4c2430 4833cc e8???????? }
            // n = 4, score = 200
            //   836318fe             | dec                 eax
            //   488b4c2430           | mov                 edi, dword ptr [ebx + 0x20]
            //   4833cc               | cmp                 dword ptr [edi], 0x400
            //   e8????????           |                     

        $sequence_5 = { c70302100000 488b842480000000 4183662000 f6401a01 7404 836318fe }
            // n = 6, score = 200
            //   c70302100000         | dec                 eax
            //   488b842480000000     | add                 esp, 0x20
            //   4183662000           | pop                 edi
            //   f6401a01             | ret                 
            //   7404                 | inc                 eax
            //   836318fe             | push                ebx

        $sequence_6 = { 4833c4 4889842480000000 33d2 488d4c2430 448d4248 e8???????? }
            // n = 6, score = 200
            //   4833c4               | test                ecx, ecx
            //   4889842480000000     | je                  0xef3
            //   33d2                 | cmp                 byte ptr [edi + 0x44], bl
            //   488d4c2430           | je                  0xec2
            //   448d4248             | dec                 esp
            //   e8????????           |                     

        $sequence_7 = { 498bd8 488364245000 488bfa 488bf1 }
            // n = 4, score = 200
            //   498bd8               | dec                 eax
            //   488364245000         | add                 esp, 0x90
            //   488bfa               | pop                 ebx
            //   488bf1               | ret                 

        $sequence_8 = { 4833c4 488985b8000000 488364243800 498bd8 }
            // n = 4, score = 200
            //   4833c4               | lea                 eax, [0xff5]
            //   488985b8000000       | inc                 ecx
            //   488364243800         | mov                 ecx, esi
            //   498bd8               | mov                 edi, eax

        $sequence_9 = { 4889442450 ba14000000 488928 4d8bcf 48897808 4533c0 488b8c2498000000 }
            // n = 7, score = 200
            //   4889442450           | mov                 ebx, ecx
            //   ba14000000           | dec                 eax
            //   488928               | mov                 dword ptr [esp + 0x10], ebp
            //   4d8bcf               | push                esi
            //   48897808             | push                edi
            //   4533c0               | inc                 ecx
            //   488b8c2498000000     | push                esi

    condition:
        7 of them and filesize < 99328
}