rule win_imprudentcook_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.imprudentcook."
        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.imprudentcook"
        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 = { 4c8b942410010000 4c8bc7 488bce 4885ff 7e16 498d42f8 }
            // n = 6, score = 100
            //   4c8b942410010000     | lea                 edx, [esp + 0x40]
            //   4c8bc7               | dec                 eax
            //   488bce               | mov                 edx, ebp
            //   4885ff               | inc                 ecx
            //   7e16                 | lea                 ecx, [edi - 4]
            //   498d42f8             | dec                 esp

        $sequence_1 = { 48391d???????? 741e b9b80b0000 ff15???????? 488b0d???????? e8???????? 48891d???????? }
            // n = 7, score = 100
            //   48391d????????       |                     
            //   741e                 | dec                 ebp
            //   b9b80b0000           | mov                 ecx, ebp
            //   ff15????????         |                     
            //   488b0d????????       |                     
            //   e8????????           |                     
            //   48891d????????       |                     

        $sequence_2 = { 480fafc6 4803c5 498b0cc6 48890f 498914c6 48ffc3 4903fc }
            // n = 7, score = 100
            //   480fafc6             | dec                 eax
            //   4803c5               | mov                 eax, ebx
            //   498b0cc6             | dec                 esp
            //   48890f               | sub                 ecx, edx
            //   498914c6             | dec                 ebp
            //   48ffc3               | test                esi, esi
            //   4903fc               | jle                 0xdd4

        $sequence_3 = { e8???????? 4c8bc3 488b9c24a0000000 41b914050000 498bd4 488bcb e8???????? }
            // n = 7, score = 100
            //   e8????????           |                     
            //   4c8bc3               | dec                 eax
            //   488b9c24a0000000     | or                  ebx, eax
            //   41b914050000         | jmp                 0x7cf
            //   498bd4               | dec                 ebp
            //   488bcb               | arpl                di, si
            //   e8????????           |                     

        $sequence_4 = { 4533d2 4d8be0 488bea 488bf1 458be9 48c1eb20 49be0000000001000000 }
            // n = 7, score = 100
            //   4533d2               | mov                 dword ptr [esp + 0x20], ecx
            //   4d8be0               | dec                 esp
            //   488bea               | lea                 eax, [esi + esi + 2]
            //   488bf1               | dec                 ebp
            //   458be9               | lea                 ecx, [ebp - 8]
            //   48c1eb20             | dec                 eax
            //   49be0000000001000000     | mov    ecx, ebx

        $sequence_5 = { 488d5cc308 48895c2420 e8???????? 488b04f7 488b542460 488d0cf7 4889442458 }
            // n = 7, score = 100
            //   488d5cc308           | inc                 ebp
            //   48895c2420           | lea                 ebp, [edi - 5]
            //   e8????????           |                     
            //   488b04f7             | dec                 esp
            //   488b542460           | mov                 edi, dword ptr [esp + 0xb0]
            //   488d0cf7             | inc                 esp
            //   4889442458           | mov                 edi, dword ptr [ebp]

        $sequence_6 = { 4c8b4d28 488bcb 4d8bc5 482bcf 498d0ccc 488bd1 e8???????? }
            // n = 7, score = 100
            //   4c8b4d28             | dec                 eax
            //   488bcb               | mov                 dword ptr [esp + 0x20], ebx
            //   4d8bc5               | dec                 eax
            //   482bcf               | sub                 eax, edx
            //   498d0ccc             | dec                 eax
            //   488bd1               | mov                 edx, dword ptr [esp + 0x108]
            //   e8????????           |                     

        $sequence_7 = { 48c1e020 4c8bc2 4903c2 4803c8 498bc2 4d8bd3 49c1ea20 }
            // n = 7, score = 100
            //   48c1e020             | dec                 eax
            //   4c8bc2               | mov                 dword ptr [esp + 0x20], eax
            //   4903c2               | dec                 eax
            //   4803c8               | mov                 ecx, dword ptr [ebp - 0x39]
            //   498bc2               | inc                 ebp
            //   4d8bd3               | xor                 ecx, ecx
            //   49c1ea20             | inc                 ebp

        $sequence_8 = { 740a ff15???????? 48897b18 488b4b10 4885c9 740a ff15???????? }
            // n = 7, score = 100
            //   740a                 | mov                 eax, dword ptr [esp + 0x58]
            //   ff15????????         |                     
            //   48897b18             | dec                 eax
            //   488b4b10             | mov                 eax, ebp
            //   4885c9               | dec                 ecx
            //   740a                 | div                 eax
            //   ff15????????         |                     

        $sequence_9 = { 486bc01c 483bc8 7c05 be0d000000 4c63db 4863fe 448d1433 }
            // n = 7, score = 100
            //   486bc01c             | pop                 ebx
            //   483bc8               | dec                 eax
            //   7c05                 | mov                 dword ptr [esp + 0x70], ebp
            //   be0d000000           | dec                 eax
            //   4c63db               | mov                 dword ptr [esp + 0x50], esi
            //   4863fe               | dec                 eax
            //   448d1433             | mov                 dword ptr [esp + 0x48], edi

    condition:
        7 of them and filesize < 864256
}