rule win_pandora_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.pandora."
        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.pandora"
        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 = { c1e808 41884501 418bc3 c1e810 41884502 410fb6c2 41884504 }
            // n = 7, score = 100
            //   c1e808               | mov                 ecx, esi
            //   41884501             | inc                 esp
            //   418bc3               | add                 ecx, dword ptr [esp + eax + 0x3c]
            //   c1e810               | rol                 ecx, 0xa
            //   41884502             | inc                 ecx
            //   410fb6c2             | xor                 edx, eax
            //   41884504             | add                 edx, dword ptr [esp + 0x30]

        $sequence_1 = { 488bcb 4c89b42480000000 c744243801000000 48c744244001000000 e8???????? 4c8b7c2428 85c0 }
            // n = 7, score = 100
            //   488bcb               | dec                 ecx
            //   4c89b42480000000     | mov                 ecx, esi
            //   c744243801000000     | mov                 ebx, eax
            //   48c744244001000000     | test    ebx, ebx
            //   e8????????           |                     
            //   4c8b7c2428           | jne                 0xd29
            //   85c0                 | dec                 eax

        $sequence_2 = { 4c8bc6 e8???????? eb13 33d2 488d4c2420 e8???????? }
            // n = 6, score = 100
            //   4c8bc6               | mov                 eax, dword ptr [esp + 0x118]
            //   e8????????           |                     
            //   eb13                 | add                 ecx, edi
            //   33d2                 | inc                 ecx
            //   488d4c2420           | and                 eax, ebx
            //   e8????????           |                     

        $sequence_3 = { 4103cd 448b6c2420 33c7 33442428 03cb 4133c5 8d9adcbc1b8f }
            // n = 7, score = 100
            //   4103cd               | dec                 eax
            //   448b6c2420           | mov                 ebx, dword ptr [esp + 0x78]
            //   33c7                 | dec                 eax
            //   33442428             | mov                 edi, esi
            //   03cb                 | dec                 eax
            //   4133c5               | mov                 ebp, dword ptr [esp + 0x70]
            //   8d9adcbc1b8f         | dec                 eax

        $sequence_4 = { 49d1e8 48ffc2 4883fa40 72ef 4c8d7901 49c1e706 4c2bfa }
            // n = 7, score = 100
            //   49d1e8               | mov                 edx, esi
            //   48ffc2               | mov                 dword ptr [ebp - 0x1d], 0xb0e25def
            //   4883fa40             | mov                 dword ptr [ebp - 0x19], 0x1d3792db
            //   72ef                 | mov                 dword ptr [ebp - 0x15], 0x70e92621
            //   4c8d7901             | mov                 dword ptr [ebp - 0x11], 0x75972403
            //   49c1e706             | mov                 dword ptr [ebp - 0xd], 0xec9e804
            //   4c2bfa               | test                eax, 0xffffff3f

        $sequence_5 = { 498bd6 4c8bc0 48c1e83f 49f7d8 49c1e83f 440ac0 4180f001 }
            // n = 7, score = 100
            //   498bd6               | lea                 eax, [eax*4 + 1]
            //   4c8bc0               | dec                 esp
            //   48c1e83f             | cmp                 edx, eax
            //   49f7d8               | jb                  0xfd3
            //   49c1e83f             | dec                 ebp
            //   440ac0               | test                esi, esi
            //   4180f001             | je                  0xfd3

        $sequence_6 = { 488d442430 4889ac24f0000000 4c8d8c24f0000000 4889442420 660f73d808 66480f7ec1 488d9110010000 }
            // n = 7, score = 100
            //   488d442430           | xor                 edi, eax
            //   4889ac24f0000000     | shl                 edx, 8
            //   4c8d8c24f0000000     | mov                 eax, edx
            //   4889442420           | not                 eax
            //   660f73d808           | add                 esi, edi
            //   66480f7ec1           | inc                 ecx
            //   488d9110010000       | or                  eax, eax

        $sequence_7 = { 400fb6ce baff000000 412ace d3fa 205590 483bf8 7311 }
            // n = 7, score = 100
            //   400fb6ce             | mov                 eax, dword ptr [ebx + 0xe8]
            //   baff000000           | dec                 eax
            //   412ace               | mov                 ecx, dword ptr [esi + 0x20]
            //   d3fa                 | dec                 eax
            //   205590               | mov                 edx, ebp
            //   483bf8               | dec                 eax
            //   7311                 | mov                 ebp, dword ptr [esp + 0x40]

        $sequence_8 = { 0fb6843840180600 4433c0 8bc3 c1e818 0fb6c8 8bc3 c1e810 }
            // n = 7, score = 100
            //   0fb6843840180600     | mov                 dword ptr [ebp - 0x80], edx
            //   4433c0               | mov                 dword ptr [ebp - 0x30], 1
            //   8bc3                 | mov                 dword ptr [ebp - 0x18], 1
            //   c1e818               | mov                 dword ptr [ebp], 1
            //   0fb6c8               | mov                 dword ptr [esp + 0x58], 1
            //   8bc3                 | mov                 dword ptr [esp + 0x40], 1
            //   c1e810               | dec                 eax

        $sequence_9 = { 4d85c0 7415 488b05???????? 33d2 ffd0 488b742430 488b5c2428 }
            // n = 7, score = 100
            //   4d85c0               | add                 ebx, 0xa953fd4e
            //   7415                 | add                 ebx, dword ptr [ebp + 0x77]
            //   488b05????????       |                     
            //   33d2                 | mov                 eax, esi
            //   ffd0                 | xor                 eax, edi
            //   488b742430           | add                 eax, dword ptr [esp + 0x2c]
            //   488b5c2428           | inc                 ebp

    condition:
        7 of them and filesize < 1032192
}