rule win_juicy_potato_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.juicy_potato."
        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.juicy_potato"
        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???????? 488d0d14060200 488905???????? ff15???????? 488bc8 488d15cd890200 ff15???????? }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488d0d14060200       | jmp                 0xa21
            //   488905????????       |                     
            //   ff15????????         |                     
            //   488bc8               | dec                 eax
            //   488d15cd890200       | add                 eax, 0x20
            //   ff15????????         |                     

        $sequence_1 = { 744c f20f104c2460 488d0d5bae0000 41b901000000 0f57c0 44894c2440 }
            // n = 6, score = 100
            //   744c                 | dec                 eax
            //   f20f104c2460         | xor                 ecx, esp
            //   488d0d5bae0000       | dec                 eax
            //   41b901000000         | lea                 eax, [0xffff5c04]
            //   0f57c0               | dec                 eax
            //   44894c2440           | mov                 dword ptr [esp + 0x30], eax

        $sequence_2 = { 488d542470 4c896c2430 4533c9 4c896c2428 458d4501 33c9 4c896c2420 }
            // n = 7, score = 100
            //   488d542470           | mov                 eax, esp
            //   4c896c2430           | dec                 eax
            //   4533c9               | mov                 dword ptr [eax + 8], ebx
            //   4c896c2428           | dec                 eax
            //   458d4501             | cmp                 eax, -1
            //   33c9                 | je                  0xee
            //   4c896c2420           | inc                 esp

        $sequence_3 = { e9???????? 4d8bbcf1e89c0300 33d2 498bcf 41b800080000 ff15???????? 488bd8 }
            // n = 7, score = 100
            //   e9????????           |                     
            //   4d8bbcf1e89c0300     | dec                 eax
            //   33d2                 | mov                 dword ptr [ebx], eax
            //   498bcf               | dec                 eax
            //   41b800080000         | and                 dword ptr [ebx + 0x70], 0
            //   ff15????????         |                     
            //   488bd8               | mov                 byte ptr [ebx + 0x50], 2

        $sequence_4 = { 488d4e50 488d542420 e8???????? 90 }
            // n = 4, score = 100
            //   488d4e50             | xor                 edx, eax
            //   488d542420           | dec                 ebx
            //   e8????????           |                     
            //   90                   | xchg                dword ptr [edi + esi*8 + 0x51ec0], edx

        $sequence_5 = { 48894110 488d05977e0200 488901 488bc1 c3 33c0 48894108 }
            // n = 7, score = 100
            //   48894110             | dec                 eax
            //   488d05977e0200       | lea                 eax, [0x22ef6]
            //   488901               | nop                 
            //   488bc1               | dec                 eax
            //   c3                   | lea                 ebx, [esi + 0x50]
            //   33c0                 | dec                 eax
            //   48894108             | mov                 dword ptr [esp + 0x58], ebx

        $sequence_6 = { 488d054fd60100 488907 488bc7 48899fc0000000 488b5c2430 4889b7c8000000 488b742438 }
            // n = 7, score = 100
            //   488d054fd60100       | mov                 eax, ebx
            //   488907               | and                 ebx, 0x3f
            //   488bc7               | dec                 eax
            //   48899fc0000000       | sar                 eax, 6
            //   488b5c2430           | dec                 eax
            //   4889b7c8000000       | shl                 ebx, 6
            //   488b742438           | inc                 ebp

        $sequence_7 = { 44893d???????? 4533c9 448b06 498bd6 488b4f28 ff15???????? }
            // n = 6, score = 100
            //   44893d????????       |                     
            //   4533c9               | dec                 eax
            //   448b06               | mov                 dword ptr [esp + 0x28], esi
            //   498bd6               | mov                 dword ptr [ebp + 0xb], 0
            //   488b4f28             | dec                 eax
            //   ff15????????         |                     

        $sequence_8 = { 4883ec30 48c7442420feffffff 488bd9 488d051b540100 488901 48895108 }
            // n = 6, score = 100
            //   4883ec30             | dec                 eax
            //   48c7442420feffffff     | mov    edx, dword ptr [esi + 8]
            //   488bd9               | dec                 eax
            //   488d051b540100       | lea                 ecx, [0x425e2]
            //   488901               | int3                
            //   48895108             | dec                 eax

        $sequence_9 = { 488d1544c20200 e8???????? 488bf8 4885c0 7428 }
            // n = 5, score = 100
            //   488d1544c20200       | dec                 eax
            //   e8????????           |                     
            //   488bf8               | mov                 dword ptr [ebx + 8], eax
            //   4885c0               | xor                 ecx, ecx
            //   7428                 | dec                 ebp

    condition:
        7 of them and filesize < 736256
}