rule win_pandabanker_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.pandabanker."
        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.pandabanker"
        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 = { 8d5b03 8b0487 c1e808 0fb6c0 }
            // n = 4, score = 8600
            //   8d5b03               | lea                 ebx, [ebx + 3]
            //   8b0487               | mov                 eax, dword ptr [edi + eax*4]
            //   c1e808               | shr                 eax, 8
            //   0fb6c0               | movzx               eax, al

        $sequence_1 = { 7406 3919 7402 b301 8bcf }
            // n = 5, score = 8600
            //   7406                 | je                  8
            //   3919                 | cmp                 dword ptr [ecx], ebx
            //   7402                 | je                  4
            //   b301                 | mov                 bl, 1
            //   8bcf                 | mov                 ecx, edi

        $sequence_2 = { 52 51 33c9 32d2 }
            // n = 4, score = 8600
            //   52                   | push                edx
            //   51                   | push                ecx
            //   33c9                 | xor                 ecx, ecx
            //   32d2                 | xor                 dl, dl

        $sequence_3 = { c60600 33d2 8bcb 42 }
            // n = 4, score = 8600
            //   c60600               | mov                 byte ptr [esi], 0
            //   33d2                 | xor                 edx, edx
            //   8bcb                 | mov                 ecx, ebx
            //   42                   | inc                 edx

        $sequence_4 = { e8???????? 8a442416 8acb 885c2417 84c0 }
            // n = 5, score = 8600
            //   e8????????           |                     
            //   8a442416             | mov                 al, byte ptr [esp + 0x16]
            //   8acb                 | mov                 cl, bl
            //   885c2417             | mov                 byte ptr [esp + 0x17], bl
            //   84c0                 | test                al, al

        $sequence_5 = { 663bf9 668902 1bc0 83e007 83c030 6603c1 }
            // n = 6, score = 8600
            //   663bf9               | cmp                 di, cx
            //   668902               | mov                 word ptr [edx], ax
            //   1bc0                 | sbb                 eax, eax
            //   83e007               | and                 eax, 7
            //   83c030               | add                 eax, 0x30
            //   6603c1               | add                 ax, cx

        $sequence_6 = { 395d00 7422 8b542414 8d442420 50 8d442420 8bcd }
            // n = 7, score = 8600
            //   395d00               | cmp                 dword ptr [ebp], ebx
            //   7422                 | je                  0x24
            //   8b542414             | mov                 edx, dword ptr [esp + 0x14]
            //   8d442420             | lea                 eax, [esp + 0x20]
            //   50                   | push                eax
            //   8d442420             | lea                 eax, [esp + 0x20]
            //   8bcd                 | mov                 ecx, ebp

        $sequence_7 = { ff742418 8bc8 8bfd f3a4 8b742418 8d3c28 }
            // n = 6, score = 8600
            //   ff742418             | push                dword ptr [esp + 0x18]
            //   8bc8                 | mov                 ecx, eax
            //   8bfd                 | mov                 edi, ebp
            //   f3a4                 | rep movsb           byte ptr es:[edi], byte ptr [esi]
            //   8b742418             | mov                 esi, dword ptr [esp + 0x18]
            //   8d3c28               | lea                 edi, [eax + ebp]

        $sequence_8 = { 8bc2 33ed 89442410 894c240c 8a9f00010000 8abf01010000 }
            // n = 6, score = 8600
            //   8bc2                 | mov                 eax, edx
            //   33ed                 | xor                 ebp, ebp
            //   89442410             | mov                 dword ptr [esp + 0x10], eax
            //   894c240c             | mov                 dword ptr [esp + 0xc], ecx
            //   8a9f00010000         | mov                 bl, byte ptr [edi + 0x100]
            //   8abf01010000         | mov                 bh, byte ptr [edi + 0x101]

        $sequence_9 = { 75f9 2bce 5e 8d040a c3 33c0 c3 }
            // n = 7, score = 8600
            //   75f9                 | jne                 0xfffffffb
            //   2bce                 | sub                 ecx, esi
            //   5e                   | pop                 esi
            //   8d040a               | lea                 eax, [edx + ecx]
            //   c3                   | ret                 
            //   33c0                 | xor                 eax, eax
            //   c3                   | ret                 

    condition:
        7 of them and filesize < 417792
}