rule win_funny_dream_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.funny_dream."
        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.funny_dream"
        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 = { 8b8bc0000000 83ec08 8bd7 6a50 }
            // n = 4, score = 300
            //   8b8bc0000000         | mov                 ecx, dword ptr [ebx + 0xc0]
            //   83ec08               | sub                 esp, 8
            //   8bd7                 | mov                 edx, edi
            //   6a50                 | push                0x50

        $sequence_1 = { 8d8564feffff 8bca 50 6a00 6a00 6a20 6a01 }
            // n = 7, score = 300
            //   8d8564feffff         | lea                 eax, [ebp - 0x19c]
            //   8bca                 | mov                 ecx, edx
            //   50                   | push                eax
            //   6a00                 | push                0
            //   6a00                 | push                0
            //   6a20                 | push                0x20
            //   6a01                 | push                1

        $sequence_2 = { c7471800000000 3b5f14 7423 660f1f840000000000 8b33 }
            // n = 5, score = 300
            //   c7471800000000       | mov                 dword ptr [edi + 0x18], 0
            //   3b5f14               | cmp                 ebx, dword ptr [edi + 0x14]
            //   7423                 | je                  0x25
            //   660f1f840000000000     | nop    word ptr [eax + eax]
            //   8b33                 | mov                 esi, dword ptr [ebx]

        $sequence_3 = { 8b44241c 8bcf 03c6 83c30a 83c40c 03d8 }
            // n = 6, score = 300
            //   8b44241c             | mov                 eax, dword ptr [esp + 0x1c]
            //   8bcf                 | mov                 ecx, edi
            //   03c6                 | add                 eax, esi
            //   83c30a               | add                 ebx, 0xa
            //   83c40c               | add                 esp, 0xc
            //   03d8                 | add                 ebx, eax

        $sequence_4 = { 47 81ff70170000 7f19 6a00 6800020000 ff75fc ff75f8 }
            // n = 7, score = 300
            //   47                   | inc                 edi
            //   81ff70170000         | cmp                 edi, 0x1770
            //   7f19                 | jg                  0x1b
            //   6a00                 | push                0
            //   6800020000           | push                0x200
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   ff75f8               | push                dword ptr [ebp - 8]

        $sequence_5 = { ffd1 8bf0 8d4508 6a00 50 53 56 }
            // n = 7, score = 300
            //   ffd1                 | call                ecx
            //   8bf0                 | mov                 esi, eax
            //   8d4508               | lea                 eax, [ebp + 8]
            //   6a00                 | push                0
            //   50                   | push                eax
            //   53                   | push                ebx
            //   56                   | push                esi

        $sequence_6 = { 2bcb 51 56 8bca e8???????? e8???????? 83c418 }
            // n = 7, score = 300
            //   2bcb                 | sub                 ecx, ebx
            //   51                   | push                ecx
            //   56                   | push                esi
            //   8bca                 | mov                 ecx, edx
            //   e8????????           |                     
            //   e8????????           |                     
            //   83c418               | add                 esp, 0x18

        $sequence_7 = { 83c40c 8d8564feffff 0f57c0 0f1185acfeffff 50 ff15???????? }
            // n = 6, score = 300
            //   83c40c               | add                 esp, 0xc
            //   8d8564feffff         | lea                 eax, [ebp - 0x19c]
            //   0f57c0               | xorps               xmm0, xmm0
            //   0f1185acfeffff       | movups              xmmword ptr [ebp - 0x154], xmm0
            //   50                   | push                eax
            //   ff15????????         |                     

        $sequence_8 = { 2bca b804000000 c7442434337a335a 89742438 89442414 894c2420 }
            // n = 6, score = 300
            //   2bca                 | sub                 ecx, edx
            //   b804000000           | mov                 eax, 4
            //   c7442434337a335a     | mov                 dword ptr [esp + 0x34], 0x5a337a33
            //   89742438             | mov                 dword ptr [esp + 0x38], esi
            //   89442414             | mov                 dword ptr [esp + 0x14], eax
            //   894c2420             | mov                 dword ptr [esp + 0x20], ecx

        $sequence_9 = { 57 ffb1c0000000 ffd2 85c0 7f0f 8b4dfc 46 }
            // n = 7, score = 300
            //   57                   | push                edi
            //   ffb1c0000000         | push                dword ptr [ecx + 0xc0]
            //   ffd2                 | call                edx
            //   85c0                 | test                eax, eax
            //   7f0f                 | jg                  0x11
            //   8b4dfc               | mov                 ecx, dword ptr [ebp - 4]
            //   46                   | inc                 esi

    condition:
        7 of them and filesize < 393216
}