rule win_hopeless_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.hopeless."
        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.hopeless"
        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 = { 41f7c3fdffffff 0f84a1040000 410fb74202 4531f6 4989f2 }
            // n = 5, score = 300
            //   41f7c3fdffffff       | mov                 ebx, 2
            //   0f84a1040000         | dec                 esp
            //   410fb74202           | mov                 esi, ebp
            //   4531f6               | inc                 ecx
            //   4989f2               | mov                 edx, 4

        $sequence_1 = { e8???????? 4989c4 4885c0 7450 4585f6 }
            // n = 5, score = 300
            //   e8????????           |                     
            //   4989c4               | mov                 ecx, edi
            //   4885c0               | dec                 eax
            //   7450                 | mov                 eax, dword ptr [esp + 0x40]
            //   4585f6               | inc                 ebp

        $sequence_2 = { 4489e0 2500060000 3d00020000 0f852afbffff 418d56ff 83fa0e 0f8e24020000 }
            // n = 7, score = 300
            //   4489e0               | lea                 eax, [0x107ff]
            //   2500060000           | dec                 eax
            //   3d00020000           | lea                 ecx, [esp + 0x6a0]
            //   0f852afbffff         | dec                 eax
            //   418d56ff             | mov                 edx, esi
            //   83fa0e               | dec                 eax
            //   0f8e24020000         | mov                 ecx, edi

        $sequence_3 = { 4c01c8 0f8939030000 b90f000000 48c1e803 }
            // n = 4, score = 300
            //   4c01c8               | test                eax, eax
            //   0f8939030000         | dec                 eax
            //   b90f000000           | lea                 edx, [esp + 0x70]
            //   48c1e803             | dec                 eax

        $sequence_4 = { 488b4c2430 31d2 48c744242800000000 41b910000000 }
            // n = 4, score = 300
            //   488b4c2430           | mov                 ebp, 3
            //   31d2                 | nop                 dword ptr [eax]
            //   48c744242800000000     | sub    eax, 0x30
            //   41b910000000         | dec                 eax

        $sequence_5 = { 807e0232 0f847e090000 488d5602 b933000000 }
            // n = 4, score = 300
            //   807e0232             | lea                 eax, [esp + 0x70]
            //   0f847e090000         | mov                 edx, 1
            //   488d5602             | dec                 eax
            //   b933000000           | add                 ebp, 8

        $sequence_6 = { 0f86e1010000 8b4500 488d4c2460 4c8d442470 }
            // n = 4, score = 300
            //   0f86e1010000         | je                  0x3ac
            //   8b4500               | inc                 esp
            //   488d4c2460           | cmp                 edi, eax
            //   4c8d442470           | jl                  0x364

        $sequence_7 = { 4881ec40020000 41b804010000 31c9 488d742430 }
            // n = 4, score = 300
            //   4881ec40020000       | mov                 edx, ebx
            //   41b804010000         | dec                 ecx
            //   31c9                 | shr                 eax, 0x20
            //   488d742430           | inc                 edi

        $sequence_8 = { 4181e4fff7ffff 4889fe 4489e9 44896308 4585ed 0f8faa020000 0f84fc050000 }
            // n = 7, score = 300
            //   4181e4fff7ffff       | dec                 eax
            //   4889fe               | mov                 dword ptr [esp + 0x50], ebx
            //   4489e9               | dec                 esp
            //   44896308             | lea                 eax, [0x106e4]
            //   4585ed               | mov                 eax, edx
            //   0f8faa020000         | mov                 ecx, 9
            //   0f84fc050000         | dec                 esp

        $sequence_9 = { 7415 418b06 85c0 0f881c080000 8d0480 8d4441d0 }
            // n = 6, score = 300
            //   7415                 | test                eax, eax
            //   418b06               | sete                al
            //   85c0                 | dec                 ecx
            //   0f881c080000         | add                 ebp, 8
            //   8d0480               | dec                 eax
            //   8d4441d0             | lea                 edx, [0xfb79]

    condition:
        7 of them and filesize < 247808
}