rule win_infy_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.infy."
        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.infy"
        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 = { 31c9 85d2 740a 66837af601 }
            // n = 4, score = 200
            //   31c9                 | xor                 ecx, ecx
            //   85d2                 | test                edx, edx
            //   740a                 | je                  0xc
            //   66837af601           | cmp                 word ptr [edx - 0xa], 1

        $sequence_1 = { c3 55 8bec 8b4508 2b450c 85c0 }
            // n = 6, score = 200
            //   c3                   | ret                 
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp
            //   8b4508               | mov                 eax, dword ptr [ebp + 8]
            //   2b450c               | sub                 eax, dword ptr [ebp + 0xc]
            //   85c0                 | test                eax, eax

        $sequence_2 = { 8945d4 807de300 7409 8b45e4 66833820 7304 }
            // n = 6, score = 200
            //   8945d4               | mov                 dword ptr [ebp - 0x2c], eax
            //   807de300             | cmp                 byte ptr [ebp - 0x1d], 0
            //   7409                 | je                  0xb
            //   8b45e4               | mov                 eax, dword ptr [ebp - 0x1c]
            //   66833820             | cmp                 word ptr [eax], 0x20
            //   7304                 | jae                 6

        $sequence_3 = { 8807 8d0492 8d1492 83f901 83dfff c1e817 }
            // n = 6, score = 200
            //   8807                 | mov                 byte ptr [edi], al
            //   8d0492               | lea                 eax, [edx + edx*4]
            //   8d1492               | lea                 edx, [edx + edx*4]
            //   83f901               | cmp                 ecx, 1
            //   83dfff               | sbb                 edi, -1
            //   c1e817               | shr                 eax, 0x17

        $sequence_4 = { 7d04 33ff eb0a 8bf8 }
            // n = 4, score = 200
            //   7d04                 | jge                 6
            //   33ff                 | xor                 edi, edi
            //   eb0a                 | jmp                 0xc
            //   8bf8                 | mov                 edi, eax

        $sequence_5 = { 7507 b801000000 eb02 33c0 5d c20800 }
            // n = 6, score = 200
            //   7507                 | jne                 9
            //   b801000000           | mov                 eax, 1
            //   eb02                 | jmp                 4
            //   33c0                 | xor                 eax, eax
            //   5d                   | pop                 ebp
            //   c20800               | ret                 8

        $sequence_6 = { 8b460c 8b55fc 8b3c90 eb52 }
            // n = 4, score = 200
            //   8b460c               | mov                 eax, dword ptr [esi + 0xc]
            //   8b55fc               | mov                 edx, dword ptr [ebp - 4]
            //   8b3c90               | mov                 edi, dword ptr [eax + edx*4]
            //   eb52                 | jmp                 0x54

        $sequence_7 = { 56 57 33c9 894df8 8955f0 8945fc 8b45fc }
            // n = 7, score = 200
            //   56                   | push                esi
            //   57                   | push                edi
            //   33c9                 | xor                 ecx, ecx
            //   894df8               | mov                 dword ptr [ebp - 8], ecx
            //   8955f0               | mov                 dword ptr [ebp - 0x10], edx
            //   8945fc               | mov                 dword ptr [ebp - 4], eax
            //   8b45fc               | mov                 eax, dword ptr [ebp - 4]

        $sequence_8 = { 870c24 51 8b4afc e9???????? e9???????? e9???????? }
            // n = 6, score = 200
            //   870c24               | xchg                dword ptr [esp], ecx
            //   51                   | push                ecx
            //   8b4afc               | mov                 ecx, dword ptr [edx - 4]
            //   e9????????           |                     
            //   e9????????           |                     
            //   e9????????           |                     

        $sequence_9 = { 03c9 e8???????? 8d1437 8bc3 e8???????? }
            // n = 5, score = 200
            //   03c9                 | add                 ecx, ecx
            //   e8????????           |                     
            //   8d1437               | lea                 edx, [edi + esi]
            //   8bc3                 | mov                 eax, ebx
            //   e8????????           |                     

    condition:
        7 of them and filesize < 147456
}