rule win_ployx_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.ployx."
        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.ployx"
        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 = { 895de0 66a5 c745e400010000 ff15???????? ff75e4 8d858cfeffff 50 }
            // n = 7, score = 100
            //   895de0               | mov                 dword ptr [ebp - 0x20], ebx
            //   66a5                 | movsw               word ptr es:[edi], word ptr [esi]
            //   c745e400010000       | mov                 dword ptr [ebp - 0x1c], 0x100
            //   ff15????????         |                     
            //   ff75e4               | push                dword ptr [ebp - 0x1c]
            //   8d858cfeffff         | lea                 eax, [ebp - 0x174]
            //   50                   | push                eax

        $sequence_1 = { 8d45ec 50 e8???????? 83c40c 66c745ec0200 6a50 }
            // n = 6, score = 100
            //   8d45ec               | lea                 eax, [ebp - 0x14]
            //   50                   | push                eax
            //   e8????????           |                     
            //   83c40c               | add                 esp, 0xc
            //   66c745ec0200         | mov                 word ptr [ebp - 0x14], 2
            //   6a50                 | push                0x50

        $sequence_2 = { 33c0 ff7510 8dbd89fdffff f3ab ff750c 8bce 66ab }
            // n = 7, score = 100
            //   33c0                 | xor                 eax, eax
            //   ff7510               | push                dword ptr [ebp + 0x10]
            //   8dbd89fdffff         | lea                 edi, [ebp - 0x277]
            //   f3ab                 | rep stosd           dword ptr es:[edi], eax
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   8bce                 | mov                 ecx, esi
            //   66ab                 | stosw               word ptr es:[edi], ax

        $sequence_3 = { 85c0 7e16 8d8d8cfaffff 3b39 0f849b000000 42 83c104 }
            // n = 7, score = 100
            //   85c0                 | test                eax, eax
            //   7e16                 | jle                 0x18
            //   8d8d8cfaffff         | lea                 ecx, [ebp - 0x574]
            //   3b39                 | cmp                 edi, dword ptr [ecx]
            //   0f849b000000         | je                  0xa1
            //   42                   | inc                 edx
            //   83c104               | add                 ecx, 4

        $sequence_4 = { 0f8fc7000000 8d8500ffffff 68???????? 50 ffd7 59 }
            // n = 6, score = 100
            //   0f8fc7000000         | jg                  0xcd
            //   8d8500ffffff         | lea                 eax, [ebp - 0x100]
            //   68????????           |                     
            //   50                   | push                eax
            //   ffd7                 | call                edi
            //   59                   | pop                 ecx

        $sequence_5 = { ff36 e8???????? 8b4dfc e8???????? 8b4dfc }
            // n = 5, score = 100
            //   ff36                 | push                dword ptr [esi]
            //   e8????????           |                     
            //   8b4dfc               | mov                 ecx, dword ptr [ebp - 4]
            //   e8????????           |                     
            //   8b4dfc               | mov                 ecx, dword ptr [ebp - 4]

        $sequence_6 = { 85c0 750a 8b45fc 3d00020000 7603 83c8ff }
            // n = 6, score = 100
            //   85c0                 | test                eax, eax
            //   750a                 | jne                 0xc
            //   8b45fc               | mov                 eax, dword ptr [ebp - 4]
            //   3d00020000           | cmp                 eax, 0x200
            //   7603                 | jbe                 5
            //   83c8ff               | or                  eax, 0xffffffff

        $sequence_7 = { 83c414 ff75f8 e8???????? eb21 8d85e8fdffff 68???????? 50 }
            // n = 7, score = 100
            //   83c414               | add                 esp, 0x14
            //   ff75f8               | push                dword ptr [ebp - 8]
            //   e8????????           |                     
            //   eb21                 | jmp                 0x23
            //   8d85e8fdffff         | lea                 eax, [ebp - 0x218]
            //   68????????           |                     
            //   50                   | push                eax

        $sequence_8 = { ffd6 8d7c0701 ebde 55 ffd6 8bf0 46 }
            // n = 7, score = 100
            //   ffd6                 | call                esi
            //   8d7c0701             | lea                 edi, [edi + eax + 1]
            //   ebde                 | jmp                 0xffffffe0
            //   55                   | push                ebp
            //   ffd6                 | call                esi
            //   8bf0                 | mov                 esi, eax
            //   46                   | inc                 esi

        $sequence_9 = { e8???????? 83f8ff 8945f0 747a }
            // n = 4, score = 100
            //   e8????????           |                     
            //   83f8ff               | cmp                 eax, -1
            //   8945f0               | mov                 dword ptr [ebp - 0x10], eax
            //   747a                 | je                  0x7c

    condition:
        7 of them and filesize < 229376
}