rule win_wastedlocker_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.wastedlocker."
        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.wastedlocker"
        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 = { ff75fc 8b5df8 57 57 }
            // n = 4, score = 1000
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   8b5df8               | mov                 ebx, dword ptr [ebp - 8]
            //   57                   | push                edi
            //   57                   | push                edi

        $sequence_1 = { ffd6 8365fc00 66833b00 8bf3 }
            // n = 4, score = 1000
            //   ffd6                 | call                esi
            //   8365fc00             | and                 dword ptr [ebp - 4], 0
            //   66833b00             | cmp                 word ptr [ebx], 0
            //   8bf3                 | mov                 esi, ebx

        $sequence_2 = { 46 85c0 7424 8b4d14 2b4dfc 83c002 83c1fe }
            // n = 7, score = 1000
            //   46                   | inc                 esi
            //   85c0                 | test                eax, eax
            //   7424                 | je                  0x26
            //   8b4d14               | mov                 ecx, dword ptr [ebp + 0x14]
            //   2b4dfc               | sub                 ecx, dword ptr [ebp - 4]
            //   83c002               | add                 eax, 2
            //   83c1fe               | add                 ecx, -2

        $sequence_3 = { ffd0 8bf0 3bf3 742e 681234560b 53 }
            // n = 6, score = 1000
            //   ffd0                 | call                eax
            //   8bf0                 | mov                 esi, eax
            //   3bf3                 | cmp                 esi, ebx
            //   742e                 | je                  0x30
            //   681234560b           | push                0xb563412
            //   53                   | push                ebx

        $sequence_4 = { 68a4000900 8d45f8 50 57 57 }
            // n = 5, score = 1000
            //   68a4000900           | push                0x900a4
            //   8d45f8               | lea                 eax, [ebp - 8]
            //   50                   | push                eax
            //   57                   | push                edi
            //   57                   | push                edi

        $sequence_5 = { 8d443802 50 6a00 ff35???????? 8945f0 }
            // n = 5, score = 1000
            //   8d443802             | lea                 eax, [eax + edi + 2]
            //   50                   | push                eax
            //   6a00                 | push                0
            //   ff35????????         |                     
            //   8945f0               | mov                 dword ptr [ebp - 0x10], eax

        $sequence_6 = { 741a ff75e8 6a00 ff35???????? ff15???????? eb07 c745f801000000 }
            // n = 7, score = 1000
            //   741a                 | je                  0x1c
            //   ff75e8               | push                dword ptr [ebp - 0x18]
            //   6a00                 | push                0
            //   ff35????????         |                     
            //   ff15????????         |                     
            //   eb07                 | jmp                 9
            //   c745f801000000       | mov                 dword ptr [ebp - 8], 1

        $sequence_7 = { a1???????? 53 56 ff7508 8945fc ff15???????? 8bd8 }
            // n = 7, score = 1000
            //   a1????????           |                     
            //   53                   | push                ebx
            //   56                   | push                esi
            //   ff7508               | push                dword ptr [ebp + 8]
            //   8945fc               | mov                 dword ptr [ebp - 4], eax
            //   ff15????????         |                     
            //   8bd8                 | mov                 ebx, eax

        $sequence_8 = { e8???????? 8b45fc 6a2a e8???????? }
            // n = 4, score = 1000
            //   e8????????           |                     
            //   8b45fc               | mov                 eax, dword ptr [ebp - 4]
            //   6a2a                 | push                0x2a
            //   e8????????           |                     

        $sequence_9 = { 8b3d???????? bb04010000 33c0 53 8d8df0fdffff }
            // n = 5, score = 1000
            //   8b3d????????         |                     
            //   bb04010000           | mov                 ebx, 0x104
            //   33c0                 | xor                 eax, eax
            //   53                   | push                ebx
            //   8d8df0fdffff         | lea                 ecx, [ebp - 0x210]

    condition:
        7 of them and filesize < 147456
}