rule win_temp_stealer_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.temp_stealer."
        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.temp_stealer"
        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 = { 488b09 ff15???????? 488bd8 488d1539b00300 488bc8 ff15???????? 488985f8040000 }
            // n = 7, score = 100
            //   488b09               | mov                 dword ptr [esp + 0x68], eax
            //   ff15????????         |                     
            //   488bd8               | dec                 eax
            //   488d1539b00300       | mov                 dword ptr [ebp - 0x69], eax
            //   488bc8               | dec                 eax
            //   ff15????????         |                     
            //   488985f8040000       | mov                 dword ptr [ebp - 0x59], eax

        $sequence_1 = { e8???????? 488b0f 4885c9 7426 488d59f8 4d8bcd 4c8b03 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488b0f               | lea                 ecx, [ebp - 0x60]
            //   4885c9               | nop                 
            //   7426                 | mov                 edi, 0x10000
            //   488d59f8             | dec                 eax
            //   4d8bcd               | cmp                 esi, edi
            //   4c8b03               | cmovl               edi, esi

        $sequence_2 = { 4055 4883ec20 488bea b810000000 48f7a580000000 488bd0 48c7c0ffffffff }
            // n = 7, score = 100
            //   4055                 | test                eax, eax
            //   4883ec20             | je                  0xe83
            //   488bea               | jne                 0xfad
            //   b810000000           | dec                 eax
            //   48f7a580000000       | mov                 dword ptr [esp + 0x20], ebx
            //   488bd0               | dec                 esp
            //   48c7c0ffffffff       | lea                 ecx, [ebp + 0x4e0]

        $sequence_3 = { e8???????? 90 488b03 833800 7513 488d15e1b30100 488d0dbab30100 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   90                   | lea                 edx, [ebp - 0x20]
            //   488b03               | dec                 eax
            //   833800               | lea                 ecx, [ebp + 0xd8]
            //   7513                 | dec                 eax
            //   488d15e1b30100       | mov                 edx, eax
            //   488d0dbab30100       | dec                 eax

        $sequence_4 = { 488d55d0 488bcb e8???????? 90 4c8d058e300300 488d55c0 488bc8 }
            // n = 7, score = 100
            //   488d55d0             | dec                 eax
            //   488bcb               | mov                 ebx, dword ptr [esp + 0x340]
            //   e8????????           |                     
            //   90                   | dec                 eax
            //   4c8d058e300300       | lea                 ecx, [ebp - 0x20]
            //   488d55c0             | nop                 
            //   488bc8               | dec                 eax

        $sequence_5 = { e8???????? 488b8d50050000 ff9568050000 488b8d60050000 ff5508 488d4c2448 48837c246008 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488b8d50050000       | dec                 eax
            //   ff9568050000         | mov                 ebx, ecx
            //   488b8d60050000       | dec                 eax
            //   ff5508               | mov                 eax, dword ptr [ecx]
            //   488d4c2448           | dec                 eax
            //   48837c246008         | arpl                word ptr [eax + 4], cx

        $sequence_6 = { c644242c00 488d542420 488bcb e8???????? 4c89642438 458d6508 4c89642430 }
            // n = 7, score = 100
            //   c644242c00           | push                edi
            //   488d542420           | dec                 eax
            //   488bcb               | sub                 esp, 0x20
            //   e8????????           |                     
            //   4c89642438           | nop                 
            //   458d6508             | jmp                 0x91
            //   4c89642430           | dec                 eax

        $sequence_7 = { 894708 488d5901 41bf20000000 418bc7 48f7e3 498d4fdf 480f40c1 }
            // n = 7, score = 100
            //   894708               | mov                 eax, dword ptr [esi]
            //   488d5901             | dec                 eax
            //   41bf20000000         | arpl                word ptr [eax + 4], cx
            //   418bc7               | dec                 eax
            //   48f7e3               | add                 ecx, esi
            //   498d4fdf             | inc                 ebp
            //   480f40c1             | xor                 eax, eax

        $sequence_8 = { f30f7f442478 6644896c2468 488d9500030000 488d4c2468 e8???????? 90 4c8bc3 }
            // n = 7, score = 100
            //   f30f7f442478         | lea                 ecx, [edx + 0x158]
            //   6644896c2468         | dec                 eax
            //   488d9500030000       | mov                 ecx, dword ptr [edx + 0x348]
            //   488d4c2468           | dec                 eax
            //   e8????????           |                     
            //   90                   | lea                 ecx, [edx + 0xe0]
            //   4c8bc3               | dec                 eax

        $sequence_9 = { 488903 408828 c7430801000000 488b5c2430 488b6c2438 488b742440 4883c420 }
            // n = 7, score = 100
            //   488903               | dec                 eax
            //   408828               | mov                 dword ptr [ecx], eax
            //   c7430801000000       | mov                 ebx, edx
            //   488b5c2430           | dec                 eax
            //   488b6c2438           | add                 ecx, 8
            //   488b742440           | dec                 eax
            //   4883c420             | sub                 esp, 0x20

    condition:
        7 of them and filesize < 652288
}