rule win_pay2key_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.pay2key."
        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.pay2key"
        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 = { 894584 c7458800000000 c745fc04000000 894d8c 8b01 ff5008 }
            // n = 6, score = 300
            //   894584               | mov                 dword ptr [ebp - 0x7c], eax
            //   c7458800000000       | mov                 dword ptr [ebp - 0x78], 0
            //   c745fc04000000       | mov                 dword ptr [ebp - 4], 4
            //   894d8c               | mov                 dword ptr [ebp - 0x74], ecx
            //   8b01                 | mov                 eax, dword ptr [ecx]
            //   ff5008               | call                dword ptr [eax + 8]

        $sequence_1 = { 8d51fe 2bc1 668b0a 663b0c02 750f 83ea02 8d4a02 }
            // n = 7, score = 300
            //   8d51fe               | lea                 edx, [ecx - 2]
            //   2bc1                 | sub                 eax, ecx
            //   668b0a               | mov                 cx, word ptr [edx]
            //   663b0c02             | cmp                 cx, word ptr [edx + eax]
            //   750f                 | jne                 0x11
            //   83ea02               | sub                 edx, 2
            //   8d4a02               | lea                 ecx, [edx + 2]

        $sequence_2 = { 034114 2b81c8000000 2b4134 83c015 03c2 8b4df4 64890d00000000 }
            // n = 7, score = 300
            //   034114               | add                 eax, dword ptr [ecx + 0x14]
            //   2b81c8000000         | sub                 eax, dword ptr [ecx + 0xc8]
            //   2b4134               | sub                 eax, dword ptr [ecx + 0x34]
            //   83c015               | add                 eax, 0x15
            //   03c2                 | add                 eax, edx
            //   8b4df4               | mov                 ecx, dword ptr [ebp - 0xc]
            //   64890d00000000       | mov                 dword ptr fs:[0], ecx

        $sequence_3 = { e8???????? c7461000000000 83c40c c7461400000000 8bf8 c746140f000000 837e1410 }
            // n = 7, score = 300
            //   e8????????           |                     
            //   c7461000000000       | mov                 dword ptr [esi + 0x10], 0
            //   83c40c               | add                 esp, 0xc
            //   c7461400000000       | mov                 dword ptr [esi + 0x14], 0
            //   8bf8                 | mov                 edi, eax
            //   c746140f000000       | mov                 dword ptr [esi + 0x14], 0xf
            //   837e1410             | cmp                 dword ptr [esi + 0x14], 0x10

        $sequence_4 = { 8d4d20 e8???????? 8ac3 8b4df4 64890d00000000 59 5e }
            // n = 7, score = 300
            //   8d4d20               | lea                 ecx, [ebp + 0x20]
            //   e8????????           |                     
            //   8ac3                 | mov                 al, bl
            //   8b4df4               | mov                 ecx, dword ptr [ebp - 0xc]
            //   64890d00000000       | mov                 dword ptr fs:[0], ecx
            //   59                   | pop                 ecx
            //   5e                   | pop                 esi

        $sequence_5 = { e8???????? 56 8d8dd4feffff c785e8feffff0f000000 c785e4feffff00000000 c685d4feffff00 e8???????? }
            // n = 7, score = 300
            //   e8????????           |                     
            //   56                   | push                esi
            //   8d8dd4feffff         | lea                 ecx, [ebp - 0x12c]
            //   c785e8feffff0f000000     | mov    dword ptr [ebp - 0x118], 0xf
            //   c785e4feffff00000000     | mov    dword ptr [ebp - 0x11c], 0
            //   c685d4feffff00       | mov                 byte ptr [ebp - 0x12c], 0
            //   e8????????           |                     

        $sequence_6 = { e8???????? 8b8760050000 8db74c050000 83f810 720b 40 8bce }
            // n = 7, score = 300
            //   e8????????           |                     
            //   8b8760050000         | mov                 eax, dword ptr [edi + 0x560]
            //   8db74c050000         | lea                 esi, [edi + 0x54c]
            //   83f810               | cmp                 eax, 0x10
            //   720b                 | jb                  0xd
            //   40                   | inc                 eax
            //   8bce                 | mov                 ecx, esi

        $sequence_7 = { c70000000000 c7400400000000 83ec18 c645fc04 8bcc 8965e0 }
            // n = 6, score = 300
            //   c70000000000         | mov                 dword ptr [eax], 0
            //   c7400400000000       | mov                 dword ptr [eax + 4], 0
            //   83ec18               | sub                 esp, 0x18
            //   c645fc04             | mov                 byte ptr [ebp - 4], 4
            //   8bcc                 | mov                 ecx, esp
            //   8965e0               | mov                 dword ptr [ebp - 0x20], esp

        $sequence_8 = { 397904 7514 8bc6 8b36 894104 8b4314 8d0cd0 }
            // n = 7, score = 300
            //   397904               | cmp                 dword ptr [ecx + 4], edi
            //   7514                 | jne                 0x16
            //   8bc6                 | mov                 eax, esi
            //   8b36                 | mov                 esi, dword ptr [esi]
            //   894104               | mov                 dword ptr [ecx + 4], eax
            //   8b4314               | mov                 eax, dword ptr [ebx + 0x14]
            //   8d0cd0               | lea                 ecx, [eax + edx*8]

        $sequence_9 = { c745fc09000000 51 8d4f04 c707???????? e8???????? c645fc0a }
            // n = 6, score = 300
            //   c745fc09000000       | mov                 dword ptr [ebp - 4], 9
            //   51                   | push                ecx
            //   8d4f04               | lea                 ecx, [edi + 4]
            //   c707????????         |                     
            //   e8????????           |                     
            //   c645fc0a             | mov                 byte ptr [ebp - 4], 0xa

    condition:
        7 of them and filesize < 2252800
}