rule win_freenki_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.freenki."
        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.freenki"
        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 = { 0fb7840d06efffff 8d4902 6689840df6ceffff 6685c0 75e8 }
            // n = 5, score = 200
            //   0fb7840d06efffff     | movzx               eax, word ptr [ebp + ecx - 0x10fa]
            //   8d4902               | lea                 ecx, [ecx + 2]
            //   6689840df6ceffff     | mov                 word ptr [ebp + ecx - 0x310a], ax
            //   6685c0               | test                ax, ax
            //   75e8                 | jne                 0xffffffea

        $sequence_1 = { 59 eb33 8b7dd0 8b45e4 8b4de8 8b048578394200 }
            // n = 6, score = 200
            //   59                   | pop                 ecx
            //   eb33                 | jmp                 0x35
            //   8b7dd0               | mov                 edi, dword ptr [ebp - 0x30]
            //   8b45e4               | mov                 eax, dword ptr [ebp - 0x1c]
            //   8b4de8               | mov                 ecx, dword ptr [ebp - 0x18]
            //   8b048578394200       | mov                 eax, dword ptr [eax*4 + 0x423978]

        $sequence_2 = { 8bd0 66391a 7504 33c9 eb14 8bca }
            // n = 6, score = 200
            //   8bd0                 | mov                 edx, eax
            //   66391a               | cmp                 word ptr [edx], bx
            //   7504                 | jne                 6
            //   33c9                 | xor                 ecx, ecx
            //   eb14                 | jmp                 0x16
            //   8bca                 | mov                 ecx, edx

        $sequence_3 = { c785f8fcffff00040000 66898c05fcfeffff 8d8dfcfcffff e8???????? 68???????? 8d85fcfcffff }
            // n = 6, score = 200
            //   c785f8fcffff00040000     | mov    dword ptr [ebp - 0x308], 0x400
            //   66898c05fcfeffff     | mov                 word ptr [ebp + eax - 0x104], cx
            //   8d8dfcfcffff         | lea                 ecx, [ebp - 0x304]
            //   e8????????           |                     
            //   68????????           |                     
            //   8d85fcfcffff         | lea                 eax, [ebp - 0x304]

        $sequence_4 = { 6bd030 8955e0 8b048d78394200 0fb6441028 83e001 }
            // n = 5, score = 200
            //   6bd030               | imul                edx, eax, 0x30
            //   8955e0               | mov                 dword ptr [ebp - 0x20], edx
            //   8b048d78394200       | mov                 eax, dword ptr [ecx*4 + 0x423978]
            //   0fb6441028           | movzx               eax, byte ptr [eax + edx + 0x28]
            //   83e001               | and                 eax, 1

        $sequence_5 = { 68???????? 50 ff5110 8b4dcc 8bd3 2bd1 }
            // n = 6, score = 200
            //   68????????           |                     
            //   50                   | push                eax
            //   ff5110               | call                dword ptr [ecx + 0x10]
            //   8b4dcc               | mov                 ecx, dword ptr [ebp - 0x34]
            //   8bd3                 | mov                 edx, ebx
            //   2bd1                 | sub                 edx, ecx

        $sequence_6 = { e8???????? 59 85c0 7810 3de4000000 7309 8b04c5d8b14100 }
            // n = 7, score = 200
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   85c0                 | test                eax, eax
            //   7810                 | js                  0x12
            //   3de4000000           | cmp                 eax, 0xe4
            //   7309                 | jae                 0xb
            //   8b04c5d8b14100       | mov                 eax, dword ptr [eax*8 + 0x41b1d8]

        $sequence_7 = { 742c 0fb64631 50 0fb64630 50 0fb6462f 50 }
            // n = 7, score = 200
            //   742c                 | je                  0x2e
            //   0fb64631             | movzx               eax, byte ptr [esi + 0x31]
            //   50                   | push                eax
            //   0fb64630             | movzx               eax, byte ptr [esi + 0x30]
            //   50                   | push                eax
            //   0fb6462f             | movzx               eax, byte ptr [esi + 0x2f]
            //   50                   | push                eax

        $sequence_8 = { 66891477 46 83fe05 7ceb }
            // n = 4, score = 200
            //   66891477             | mov                 word ptr [edi + esi*2], dx
            //   46                   | inc                 esi
            //   83fe05               | cmp                 esi, 5
            //   7ceb                 | jl                  0xffffffed

        $sequence_9 = { 83e03f 8bca 6bc030 c1f906 03048d78394200 }
            // n = 5, score = 200
            //   83e03f               | and                 eax, 0x3f
            //   8bca                 | mov                 ecx, edx
            //   6bc030               | imul                eax, eax, 0x30
            //   c1f906               | sar                 ecx, 6
            //   03048d78394200       | add                 eax, dword ptr [ecx*4 + 0x423978]

    condition:
        7 of them and filesize < 327680
}