rule win_quan_pin_loader_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.quan_pin_loader."
        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.quan_pin_loader"
        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 = { 48c1f902 48897c2438 8d7a01 85c9 7443 3bcf 7429 }
            // n = 7, score = 100
            //   48c1f902             | mov                 ebx, edx
            //   48897c2438           | movdqu              xmmword ptr [esp + 0x20], xmm0
            //   8d7a01               | dec                 eax
            //   85c9                 | lea                 edx, [esp + 0x20]
            //   7443                 | dec                 eax
            //   3bcf                 | mov                 eax, dword ptr [ecx]
            //   7429                 | call                dword ptr [eax + 0x58]

        $sequence_1 = { 4883c430 5b c3 4053 4883ec30 83b97c04000001 7517 }
            // n = 7, score = 100
            //   4883c430             | ret                 
            //   5b                   | dec                 eax
            //   c3                   | mov                 eax, dword ptr [ecx]
            //   4053                 | mov                 eax, dword ptr [eax + 0x14]
            //   4883ec30             | shr                 eax, 5
            //   83b97c04000001       | jne                 0x10d4
            //   7517                 | dec                 ebp

        $sequence_2 = { c7436801000000 48c7436c4a000000 c7437401000000 48c743784b000000 c7838000000001000000 48c783840000004c000000 }
            // n = 6, score = 100
            //   c7436801000000       | lea                 edx, [esp + 0x30]
            //   48c7436c4a000000     | dec                 eax
            //   c7437401000000       | mov                 ecx, dword ptr [edi + 0x310]
            //   48c743784b000000     | nop                 
            //   c7838000000001000000     | dec    eax
            //   48c783840000004c000000     | lea    ecx, [esp + 0x40]

        $sequence_3 = { 83f950 0f9cc2 f7da 4889bbe8000000 488b7c2448 1bc0 4889abf0000000 }
            // n = 7, score = 100
            //   83f950               | lea                 edx, [0x4ff33]
            //   0f9cc2               | inc                 ecx
            //   f7da                 | mov                 eax, 4
            //   4889bbe8000000       | inc                 esp
            //   488b7c2448           | mov                 eax, edx
            //   1bc0                 | dec                 eax
            //   4889abf0000000       | lea                 edx, [0x4fdb5]

        $sequence_4 = { eb03 488bc6 48898328030000 488d15b1940600 b930000000 e8???????? 4889842490000000 }
            // n = 7, score = 100
            //   eb03                 | mov                 dword ptr [eax + 8], ebx
            //   488bc6               | cmove               ebx, ecx
            //   48898328030000       | dec                 eax
            //   488d15b1940600       | mov                 dword ptr [edi], eax
            //   b930000000           | mov                 eax, ebx
            //   e8????????           |                     
            //   4889842490000000     | dec                 eax

        $sequence_5 = { 48896c2410 4889742418 57 4883ec20 488d05cddf0500 498be9 }
            // n = 6, score = 100
            //   48896c2410           | mov                 ecx, ebp
            //   4889742418           | dec                 eax
            //   57                   | mov                 ebx, dword ptr [esp + 0x48]
            //   4883ec20             | dec                 eax
            //   488d05cddf0500       | mov                 ebp, dword ptr [esp + 0x58]
            //   498be9               | dec                 ecx

        $sequence_6 = { ff5020 4883c440 5d c3 410f1000 488b01 488d55e0 }
            // n = 7, score = 100
            //   ff5020               | mov                 edi, dword ptr [ebx + 0x10]
            //   4883c440             | movdqu              xmmword ptr [esp + 0x40], xmm0
            //   5d                   | dec                 eax
            //   c3                   | test                edi, edi
            //   410f1000             | je                  0x164
            //   488b01               | dec                 eax
            //   488d55e0             | mov                 ecx, dword ptr [edi + 8]

        $sequence_7 = { 48c1e818 8b9c8df0510700 339c85f0490700 418bc3 c1e810 0fb6c8 410fb6c1 }
            // n = 7, score = 100
            //   48c1e818             | mov                 ecx, ebx
            //   8b9c8df0510700       | dec                 ecx
            //   339c85f0490700       | sub                 edx, eax
            //   418bc3               | dec                 eax
            //   c1e810               | sar                 edx, 4
            //   0fb6c8               | dec                 ecx
            //   410fb6c1             | cmp                 edx, ecx

        $sequence_8 = { 488b02 488bf1 488d15a2d20600 498bc9 ff10 85c0 7870 }
            // n = 7, score = 100
            //   488b02               | mov                 ecx, edi
            //   488bf1               | inc                 esp
            //   488d15a2d20600       | lea                 ecx, [eax + 1]
            //   498bc9               | dec                 esp
            //   ff10                 | lea                 eax, [0x27d12]
            //   85c0                 | test                eax, eax
            //   7870                 | mov                 edx, esi

        $sequence_9 = { 4156 4883ec20 488b4178 488bfa 488b9180000000 4c8bf1 483bc2 }
            // n = 7, score = 100
            //   4156                 | dec                 eax
            //   4883ec20             | lea                 eax, [ebx + ebp*8]
            //   488b4178             | dec                 ecx
            //   488bfa               | mov                 edx, edi
            //   488b9180000000       | dec                 eax
            //   4c8bf1               | mov                 ecx, ebx
            //   483bc2               | xor                 edi, edi

    condition:
        7 of them and filesize < 1711104
}