rule win_expiro_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.expiro."
        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.expiro"
        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 = { 73f8 7ed3 92 6363ea 848a4ab40f64 }
            // n = 5, score = 100
            //   73f8                 | jae                 0xfffffffa
            //   7ed3                 | jle                 0xffffffd5
            //   92                   | xchg                eax, edx
            //   6363ea               | arpl                word ptr [ebx - 0x16], sp
            //   848a4ab40f64         | test                byte ptr [edx + 0x640fb44a], cl

        $sequence_1 = { 8b742424 33ff 897c2410 33c0 c7461407000000 897e10 }
            // n = 6, score = 100
            //   8b742424             | mov                 esi, dword ptr [esp + 0x24]
            //   33ff                 | xor                 edi, edi
            //   897c2410             | mov                 dword ptr [esp + 0x10], edi
            //   33c0                 | xor                 eax, eax
            //   c7461407000000       | mov                 dword ptr [esi + 0x14], 7
            //   897e10               | mov                 dword ptr [esi + 0x10], edi

        $sequence_2 = { f9 94 73fa 037324 7373 }
            // n = 5, score = 100
            //   f9                   | stc                 
            //   94                   | xchg                eax, esp
            //   73fa                 | jae                 0xfffffffc
            //   037324               | add                 esi, dword ptr [ebx + 0x24]
            //   7373                 | jae                 0x75

        $sequence_3 = { 66891448 8bc6 5d c20800 8bc6 33d2 66891448 }
            // n = 7, score = 100
            //   66891448             | mov                 word ptr [eax + ecx*2], dx
            //   8bc6                 | mov                 eax, esi
            //   5d                   | pop                 ebp
            //   c20800               | ret                 8
            //   8bc6                 | mov                 eax, esi
            //   33d2                 | xor                 edx, edx
            //   66891448             | mov                 word ptr [eax + ecx*2], dx

        $sequence_4 = { 8bf9 33c0 bd07000000 33c9 88442417 c7442418a85f4100 }
            // n = 6, score = 100
            //   8bf9                 | mov                 edi, ecx
            //   33c0                 | xor                 eax, eax
            //   bd07000000           | mov                 ebp, 7
            //   33c9                 | xor                 ecx, ecx
            //   88442417             | mov                 byte ptr [esp + 0x17], al
            //   c7442418a85f4100     | mov                 dword ptr [esp + 0x18], 0x415fa8

        $sequence_5 = { 42 74de 8b6c2418 8bc8 2b4c240c 83caff }
            // n = 6, score = 100
            //   42                   | inc                 edx
            //   74de                 | je                  0xffffffe0
            //   8b6c2418             | mov                 ebp, dword ptr [esp + 0x18]
            //   8bc8                 | mov                 ecx, eax
            //   2b4c240c             | sub                 ecx, dword ptr [esp + 0xc]
            //   83caff               | or                  edx, 0xffffffff

        $sequence_6 = { e8???????? 57 ff15???????? 83bc248c00000008 }
            // n = 4, score = 100
            //   e8????????           |                     
            //   57                   | push                edi
            //   ff15????????         |                     
            //   83bc248c00000008     | cmp                 dword ptr [esp + 0x8c], 8

        $sequence_7 = { 0fb77dc4 b814000000 8b4df8 99 f7f9 89c1 }
            // n = 6, score = 100
            //   0fb77dc4             | movzx               edi, word ptr [ebp - 0x3c]
            //   b814000000           | mov                 eax, 0x14
            //   8b4df8               | mov                 ecx, dword ptr [ebp - 8]
            //   99                   | cdq                 
            //   f7f9                 | idiv                ecx
            //   89c1                 | mov                 ecx, eax

        $sequence_8 = { 7407 50 ff15???????? 8ac3 e9???????? 57 ff15???????? }
            // n = 7, score = 100
            //   7407                 | je                  9
            //   50                   | push                eax
            //   ff15????????         |                     
            //   8ac3                 | mov                 al, bl
            //   e9????????           |                     
            //   57                   | push                edi
            //   ff15????????         |                     

        $sequence_9 = { 50 83c8ff e8???????? 8bc5 8d5002 668b08 83c002 }
            // n = 7, score = 100
            //   50                   | push                eax
            //   83c8ff               | or                  eax, 0xffffffff
            //   e8????????           |                     
            //   8bc5                 | mov                 eax, ebp
            //   8d5002               | lea                 edx, [eax + 2]
            //   668b08               | mov                 cx, word ptr [eax]
            //   83c002               | add                 eax, 2

    condition:
        7 of them and filesize < 3776512
}