rule win_nokki_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.nokki."
        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.nokki"
        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 = { e8???????? 33c9 68ce070000 51 }
            // n = 4, score = 200
            //   e8????????           |                     
            //   33c9                 | xor                 ecx, ecx
            //   68ce070000           | push                0x7ce
            //   51                   | push                ecx

        $sequence_1 = { e8???????? 33d2 68ce070000 52 }
            // n = 4, score = 200
            //   e8????????           |                     
            //   33d2                 | xor                 edx, edx
            //   68ce070000           | push                0x7ce
            //   52                   | push                edx

        $sequence_2 = { 33c8 e8???????? b8???????? e9???????? 8b8d18f8ffff }
            // n = 5, score = 100
            //   33c8                 | xor                 ecx, eax
            //   e8????????           |                     
            //   b8????????           |                     
            //   e9????????           |                     
            //   8b8d18f8ffff         | mov                 ecx, dword ptr [ebp - 0x7e8]

        $sequence_3 = { 8d4310 8d8994e94000 5a 668b31 668930 83c102 83c002 }
            // n = 7, score = 100
            //   8d4310               | lea                 eax, [ebx + 0x10]
            //   8d8994e94000         | lea                 ecx, [ecx + 0x40e994]
            //   5a                   | pop                 edx
            //   668b31               | mov                 si, word ptr [ecx]
            //   668930               | mov                 word ptr [eax], si
            //   83c102               | add                 ecx, 2
            //   83c002               | add                 eax, 2

        $sequence_4 = { 8da42400000000 6683bdc4fbffff2e 7435 8d85c4fbffff }
            // n = 4, score = 100
            //   8da42400000000       | lea                 esp, [esp]
            //   6683bdc4fbffff2e     | cmp                 word ptr [ebp - 0x43c], 0x2e
            //   7435                 | je                  0x37
            //   8d85c4fbffff         | lea                 eax, [ebp - 0x43c]

        $sequence_5 = { 8b5d10 33c0 898500f8ffff 8b15???????? 8945fc 8b420c }
            // n = 6, score = 100
            //   8b5d10               | mov                 ebx, dword ptr [ebp + 0x10]
            //   33c0                 | xor                 eax, eax
            //   898500f8ffff         | mov                 dword ptr [ebp - 0x800], eax
            //   8b15????????         |                     
            //   8945fc               | mov                 dword ptr [ebp - 4], eax
            //   8b420c               | mov                 eax, dword ptr [edx + 0xc]

        $sequence_6 = { 8bc6 c1f805 57 83e61f 8d3c8580054100 8b07 }
            // n = 6, score = 100
            //   8bc6                 | mov                 eax, esi
            //   c1f805               | sar                 eax, 5
            //   57                   | push                edi
            //   83e61f               | and                 esi, 0x1f
            //   8d3c8580054100       | lea                 edi, [eax*4 + 0x410580]
            //   8b07                 | mov                 eax, dword ptr [edi]

        $sequence_7 = { 888888e84000 40 ebe6 ff35???????? ff15???????? }
            // n = 5, score = 100
            //   888888e84000         | mov                 byte ptr [eax + 0x40e888], cl
            //   40                   | inc                 eax
            //   ebe6                 | jmp                 0xffffffe8
            //   ff35????????         |                     
            //   ff15????????         |                     

        $sequence_8 = { 8d3c8580054100 8bf3 83e61f c1e606 }
            // n = 4, score = 100
            //   8d3c8580054100       | lea                 edi, [eax*4 + 0x410580]
            //   8bf3                 | mov                 esi, ebx
            //   83e61f               | and                 esi, 0x1f
            //   c1e606               | shl                 esi, 6

        $sequence_9 = { 7461 8d0cbd80054100 8901 8305????????20 8b11 81c200080000 }
            // n = 6, score = 100
            //   7461                 | je                  0x63
            //   8d0cbd80054100       | lea                 ecx, [edi*4 + 0x410580]
            //   8901                 | mov                 dword ptr [ecx], eax
            //   8305????????20       |                     
            //   8b11                 | mov                 edx, dword ptr [ecx]
            //   81c200080000         | add                 edx, 0x800

        $sequence_10 = { 51 668985ecfbffff e8???????? 83c420 }
            // n = 4, score = 100
            //   51                   | push                ecx
            //   668985ecfbffff       | mov                 word ptr [ebp - 0x414], ax
            //   e8????????           |                     
            //   83c420               | add                 esp, 0x20

        $sequence_11 = { 83e71f c1e706 8b0485c02b4100 8d44380c 50 ff15???????? 8b45e4 }
            // n = 7, score = 100
            //   83e71f               | and                 edi, 0x1f
            //   c1e706               | shl                 edi, 6
            //   8b0485c02b4100       | mov                 eax, dword ptr [eax*4 + 0x412bc0]
            //   8d44380c             | lea                 eax, [eax + edi + 0xc]
            //   50                   | push                eax
            //   ff15????????         |                     
            //   8b45e4               | mov                 eax, dword ptr [ebp - 0x1c]

        $sequence_12 = { 762a 56 e8???????? 8d044524fc4000 }
            // n = 4, score = 100
            //   762a                 | jbe                 0x2c
            //   56                   | push                esi
            //   e8????????           |                     
            //   8d044524fc4000       | lea                 eax, [eax*2 + 0x40fc24]

        $sequence_13 = { 8bf8 83ffff 7424 6a00 8d8560f1ffff 50 }
            // n = 6, score = 100
            //   8bf8                 | mov                 edi, eax
            //   83ffff               | cmp                 edi, -1
            //   7424                 | je                  0x26
            //   6a00                 | push                0
            //   8d8560f1ffff         | lea                 eax, [ebp - 0xea0]
            //   50                   | push                eax

    condition:
        7 of them and filesize < 454656
}