rule win_inc_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.inc."
        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.inc"
        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 = { eb12 4c89e8 48d1e8 49ffc5 49d1ed 4d89ee 4989c5 }
            // n = 7, score = 100
            //   eb12                 | lea                 esp, [edi - 0x38]
            //   4c89e8               | inc                 ebp
            //   48d1e8               | xor                 ebp, ebp
            //   49ffc5               | pcmpeqd             xmm7, xmm7
            //   49d1ed               | dec                 esp
            //   4d89ee               | and                 esi, esi
            //   4989c5               | inc                 ebp

        $sequence_1 = { 84c0 0f856f040000 48c70600000000 885e08 e9???????? 4889f1 89ea }
            // n = 7, score = 100
            //   84c0                 | cmp                 edx, 7
            //   0f856f040000         | jb                  0x892
            //   48c70600000000       | nop                 dword ptr [eax + eax]
            //   885e08               | dec                 ecx
            //   e9????????           |                     
            //   4889f1               | mov                 edx, dword ptr [ecx + 0x6f8]
            //   89ea                 | dec                 eax

        $sequence_2 = { 89c7 66c1c708 4c89f1 e8???????? 0f1000 0f29442440 4c89f1 }
            // n = 7, score = 100
            //   89c7                 | jne                 0x1a5c
            //   66c1c708             | dec                 eax
            //   4c89f1               | add                 edi, 8
            //   e8????????           |                     
            //   0f1000               | dec                 ecx
            //   0f29442440           | not                 ebp
            //   4c89f1               | dec                 ebp

        $sequence_3 = { e8???????? 41b801001100 84c0 7415 4189f5 eb28 41bd6e000000 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   41b801001100         | inc                 ecx
            //   84c0                 | cmp                 byte ptr [edi + 0x97], 0
            //   7415                 | dec                 esp
            //   4189f5               | lea                 eax, [0x5a425]
            //   eb28                 | mov                 edx, 0x2d
            //   41bd6e000000         | ud2                 

        $sequence_4 = { 84c0 488b9c2428010000 0f8527020000 488d8c24a0000000 488d742450 4889f2 e8???????? }
            // n = 7, score = 100
            //   84c0                 | mov                 dword ptr [esp + 0xd0], ebp
            //   488b9c2428010000     | dec                 eax
            //   0f8527020000         | lea                 ecx, [esp + 0x80]
            //   488d8c24a0000000     | dec                 eax
            //   488d742450           | mov                 edx, edi
            //   4889f2               | dec                 eax
            //   e8????????           |                     

        $sequence_5 = { 75ca 4c89f1 4889c2 e8???????? 498b4610 ebb9 31db }
            // n = 7, score = 100
            //   75ca                 | and                 ebx, ebx
            //   4c89f1               | dec                 eax
            //   4889c2               | test                ebx, edi
            //   e8????????           |                     
            //   498b4610             | jne                 0xd60
            //   ebb9                 | dec                 eax
            //   31db                 | mov                 edi, dword ptr [edx + ecx + 8]

        $sequence_6 = { 4989f0 e8???????? 488d8c24a8030000 4889ea 4989f8 488bbc2478040000 e8???????? }
            // n = 7, score = 100
            //   4989f0               | dec                 ebp
            //   e8????????           |                     
            //   488d8c24a8030000     | sub                 eax, edx
            //   4889ea               | dec                 eax
            //   4989f8               | mov                 ecx, dword ptr [eax]
            //   488bbc2478040000     | dec                 eax
            //   e8????????           |                     

        $sequence_7 = { f30f6f4b03 660f740d???????? 660f7405???????? 660fdbc1 660fd7c0 3dffff0000 0f852bfdffff }
            // n = 7, score = 100
            //   f30f6f4b03           | dec                 ecx
            //   660f740d????????     |                     
            //   660f7405????????     |                     
            //   660fdbc1             | mov                 edx, dword ptr [eax + 8]
            //   660fd7c0             | dec                 ecx
            //   3dffff0000           | mov                 esi, dword ptr [eax + 0x10]
            //   0f852bfdffff         | dec                 ecx

        $sequence_8 = { 884c2420 243f 0c80 88442421 41bc02000000 eb27 89ca }
            // n = 7, score = 100
            //   884c2420             | dec                 ecx
            //   243f                 | lea                 ebp, [esi + 1]
            //   0c80                 | dec                 esp
            //   88442421             | mov                 ebp, dword ptr [ecx + 0x30]
            //   41bc02000000         | dec                 eax
            //   eb27                 | mov                 dword ptr [esp + 0x40], edx
            //   89ca                 | inc                 cx

        $sequence_9 = { ba1b000000 e9???????? 488d0df08b0600 ba1e000000 e9???????? 488d0dbf8b0600 ba20000000 }
            // n = 7, score = 100
            //   ba1b000000           | dec                 eax
            //   e9????????           |                     
            //   488d0df08b0600       | mov                 dword ptr [esp + 0x78], eax
            //   ba1e000000           | dec                 eax
            //   e9????????           |                     
            //   488d0dbf8b0600       | lea                 eax, [esp + 0x30]
            //   ba20000000           | dec                 eax

    condition:
        7 of them and filesize < 4471808
}