rule win_kpot_stealer_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.kpot_stealer."
        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.kpot_stealer"
        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 = { 83f92f 7414 83f95c 740a 83f962 7560 c60008 }
            // n = 7, score = 500
            //   83f92f               | cmp                 ecx, 0x2f
            //   7414                 | je                  0x16
            //   83f95c               | cmp                 ecx, 0x5c
            //   740a                 | je                  0xc
            //   83f962               | cmp                 ecx, 0x62
            //   7560                 | jne                 0x62
            //   c60008               | mov                 byte ptr [eax], 8

        $sequence_1 = { 85c0 7404 8365fc00 8b45f8 8b08 50 ff5108 }
            // n = 7, score = 500
            //   85c0                 | test                eax, eax
            //   7404                 | je                  6
            //   8365fc00             | and                 dword ptr [ebp - 4], 0
            //   8b45f8               | mov                 eax, dword ptr [ebp - 8]
            //   8b08                 | mov                 ecx, dword ptr [eax]
            //   50                   | push                eax
            //   ff5108               | call                dword ptr [ecx + 8]

        $sequence_2 = { 23c6 33d0 03c0 33c8 8bc2 c1e808 33c1 }
            // n = 7, score = 500
            //   23c6                 | and                 eax, esi
            //   33d0                 | xor                 edx, eax
            //   03c0                 | add                 eax, eax
            //   33c8                 | xor                 ecx, eax
            //   8bc2                 | mov                 eax, edx
            //   c1e808               | shr                 eax, 8
            //   33c1                 | xor                 eax, ecx

        $sequence_3 = { 0bc1 0fb64f03 ff750c c1e118 0bc1 0fb64f04 c1e208 }
            // n = 7, score = 500
            //   0bc1                 | or                  eax, ecx
            //   0fb64f03             | movzx               ecx, byte ptr [edi + 3]
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   c1e118               | shl                 ecx, 0x18
            //   0bc1                 | or                  eax, ecx
            //   0fb64f04             | movzx               ecx, byte ptr [edi + 4]
            //   c1e208               | shl                 edx, 8

        $sequence_4 = { 81e680010000 0bce 8bf7 81e60000e001 0bc6 }
            // n = 5, score = 500
            //   81e680010000         | and                 esi, 0x180
            //   0bce                 | or                  ecx, esi
            //   8bf7                 | mov                 esi, edi
            //   81e60000e001         | and                 esi, 0x1e00000
            //   0bc6                 | or                  eax, esi

        $sequence_5 = { 8ac3 e8???????? 84c0 7505 8b55f0 eb6b }
            // n = 6, score = 500
            //   8ac3                 | mov                 al, bl
            //   e8????????           |                     
            //   84c0                 | test                al, al
            //   7505                 | jne                 7
            //   8b55f0               | mov                 edx, dword ptr [ebp - 0x10]
            //   eb6b                 | jmp                 0x6d

        $sequence_6 = { 0bd1 8bcf c1e11b d1ef }
            // n = 4, score = 500
            //   0bd1                 | or                  edx, ecx
            //   8bcf                 | mov                 ecx, edi
            //   c1e11b               | shl                 ecx, 0x1b
            //   d1ef                 | shr                 edi, 1

        $sequence_7 = { 75f6 0fb64dff 8b45f8 3bc8 7605 fec8 8845ff }
            // n = 7, score = 500
            //   75f6                 | jne                 0xfffffff8
            //   0fb64dff             | movzx               ecx, byte ptr [ebp - 1]
            //   8b45f8               | mov                 eax, dword ptr [ebp - 8]
            //   3bc8                 | cmp                 ecx, eax
            //   7605                 | jbe                 7
            //   fec8                 | dec                 al
            //   8845ff               | mov                 byte ptr [ebp - 1], al

        $sequence_8 = { 8a07 84c0 7417 8a0c3a 47 3ac8 74f2 }
            // n = 7, score = 500
            //   8a07                 | mov                 al, byte ptr [edi]
            //   84c0                 | test                al, al
            //   7417                 | je                  0x19
            //   8a0c3a               | mov                 cl, byte ptr [edx + edi]
            //   47                   | inc                 edi
            //   3ac8                 | cmp                 cl, al
            //   74f2                 | je                  0xfffffff4

        $sequence_9 = { 8d55fc 52 56 ff750c 50 ff5110 }
            // n = 6, score = 500
            //   8d55fc               | lea                 edx, [ebp - 4]
            //   52                   | push                edx
            //   56                   | push                esi
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   50                   | push                eax
            //   ff5110               | call                dword ptr [ecx + 0x10]

    condition:
        7 of them and filesize < 219136
}