rule win_poldat_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.poldat."
        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.poldat"
        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 = { 50 56 e8???????? ff75fc 83c604 ff75f8 56 }
            // n = 7, score = 100
            //   50                   | push                eax
            //   56                   | push                esi
            //   e8????????           |                     
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   83c604               | add                 esi, 4
            //   ff75f8               | push                dword ptr [ebp - 8]
            //   56                   | push                esi

        $sequence_1 = { c780180b000018b24100 89901c0b0000 c780240b000030b24100 c780300b000048b24100 668988b0160000 8988b4160000 c780ac16000008000000 }
            // n = 7, score = 100
            //   c780180b000018b24100     | mov    dword ptr [eax + 0xb18], 0x41b218
            //   89901c0b0000         | mov                 dword ptr [eax + 0xb1c], edx
            //   c780240b000030b24100     | mov    dword ptr [eax + 0xb24], 0x41b230
            //   c780300b000048b24100     | mov    dword ptr [eax + 0xb30], 0x41b248
            //   668988b0160000       | mov                 word ptr [eax + 0x16b0], cx
            //   8988b4160000         | mov                 dword ptr [eax + 0x16b4], ecx
            //   c780ac16000008000000     | mov    dword ptr [eax + 0x16ac], 8

        $sequence_2 = { 50 e8???????? 6858020000 8d862c010000 57 }
            // n = 5, score = 100
            //   50                   | push                eax
            //   e8????????           |                     
            //   6858020000           | push                0x258
            //   8d862c010000         | lea                 eax, [esi + 0x12c]
            //   57                   | push                edi

        $sequence_3 = { 0f87eb060000 ff248db0654000 817c241402010000 0f829c000000 837c24280a }
            // n = 5, score = 100
            //   0f87eb060000         | ja                  0x6f1
            //   ff248db0654000       | jmp                 dword ptr [ecx*4 + 0x4065b0]
            //   817c241402010000     | cmp                 dword ptr [esp + 0x14], 0x102
            //   0f829c000000         | jb                  0xa2
            //   837c24280a           | cmp                 dword ptr [esp + 0x28], 0xa

        $sequence_4 = { 83c418 b800200300 50 8945fc e8???????? bf14110100 }
            // n = 6, score = 100
            //   83c418               | add                 esp, 0x18
            //   b800200300           | mov                 eax, 0x32000
            //   50                   | push                eax
            //   8945fc               | mov                 dword ptr [ebp - 4], eax
            //   e8????????           |                     
            //   bf14110100           | mov                 edi, 0x11114

        $sequence_5 = { 8d8698070000 6a05 57 50 e8???????? 68fe010000 }
            // n = 6, score = 100
            //   8d8698070000         | lea                 eax, [esi + 0x798]
            //   6a05                 | push                5
            //   57                   | push                edi
            //   50                   | push                eax
            //   e8????????           |                     
            //   68fe010000           | push                0x1fe

        $sequence_6 = { 8b5d0c 8d45fc 6a04 8d341f 50 }
            // n = 5, score = 100
            //   8b5d0c               | mov                 ebx, dword ptr [ebp + 0xc]
            //   8d45fc               | lea                 eax, [ebp - 4]
            //   6a04                 | push                4
            //   8d341f               | lea                 esi, [edi + ebx]
            //   50                   | push                eax

        $sequence_7 = { 8b08 83f90d 0f8750030000 ff248d68324000 8b4e04 85c9 0f8435020000 }
            // n = 7, score = 100
            //   8b08                 | mov                 ecx, dword ptr [eax]
            //   83f90d               | cmp                 ecx, 0xd
            //   0f8750030000         | ja                  0x356
            //   ff248d68324000       | jmp                 dword ptr [ecx*4 + 0x403268]
            //   8b4e04               | mov                 ecx, dword ptr [esi + 4]
            //   85c9                 | test                ecx, ecx
            //   0f8435020000         | je                  0x23b

        $sequence_8 = { 33c9 668b8810924100 898a84000000 33c9 668b8814924100 898a88000000 33c9 }
            // n = 7, score = 100
            //   33c9                 | xor                 ecx, ecx
            //   668b8810924100       | mov                 cx, word ptr [eax + 0x419210]
            //   898a84000000         | mov                 dword ptr [edx + 0x84], ecx
            //   33c9                 | xor                 ecx, ecx
            //   668b8814924100       | mov                 cx, word ptr [eax + 0x419214]
            //   898a88000000         | mov                 dword ptr [edx + 0x88], ecx
            //   33c9                 | xor                 ecx, ecx

        $sequence_9 = { 8d0440 c1e002 668b8812924100 894a78 33c9 }
            // n = 5, score = 100
            //   8d0440               | lea                 eax, [eax + eax*2]
            //   c1e002               | shl                 eax, 2
            //   668b8812924100       | mov                 cx, word ptr [eax + 0x419212]
            //   894a78               | mov                 dword ptr [edx + 0x78], ecx
            //   33c9                 | xor                 ecx, ecx

    condition:
        7 of them and filesize < 247808
}