rule win_spectre_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.spectre."
        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.spectre"
        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 = { 6a01 83c810 50 ff742414 8b4110 6a00 03c6 }
            // n = 7, score = 100
            //   6a01                 | push                1
            //   83c810               | or                  eax, 0x10
            //   50                   | push                eax
            //   ff742414             | push                dword ptr [esp + 0x14]
            //   8b4110               | mov                 eax, dword ptr [ecx + 0x10]
            //   6a00                 | push                0
            //   03c6                 | add                 eax, esi

        $sequence_1 = { e8???????? 59 8b4d10 33db 50 ff750c 53 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   8b4d10               | mov                 ecx, dword ptr [ebp + 0x10]
            //   33db                 | xor                 ebx, ebx
            //   50                   | push                eax
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   53                   | push                ebx

        $sequence_2 = { 8bc8 e8???????? 8bf8 8b4c2410 57 ff710c e8???????? }
            // n = 7, score = 100
            //   8bc8                 | mov                 ecx, eax
            //   e8????????           |                     
            //   8bf8                 | mov                 edi, eax
            //   8b4c2410             | mov                 ecx, dword ptr [esp + 0x10]
            //   57                   | push                edi
            //   ff710c               | push                dword ptr [ecx + 0xc]
            //   e8????????           |                     

        $sequence_3 = { c0e206 02c8 02542413 4e 884c2429 8854242a 85f6 }
            // n = 7, score = 100
            //   c0e206               | shl                 dl, 6
            //   02c8                 | add                 cl, al
            //   02542413             | add                 dl, byte ptr [esp + 0x13]
            //   4e                   | dec                 esi
            //   884c2429             | mov                 byte ptr [esp + 0x29], cl
            //   8854242a             | mov                 byte ptr [esp + 0x2a], dl
            //   85f6                 | test                esi, esi

        $sequence_4 = { 5d 83a424b400000000 8d8c24a4000000 83a424b800000000 56 e8???????? 8b9c249c030000 }
            // n = 7, score = 100
            //   5d                   | pop                 ebp
            //   83a424b400000000     | and                 dword ptr [esp + 0xb4], 0
            //   8d8c24a4000000       | lea                 ecx, [esp + 0xa4]
            //   83a424b800000000     | and                 dword ptr [esp + 0xb8], 0
            //   56                   | push                esi
            //   e8????????           |                     
            //   8b9c249c030000       | mov                 ebx, dword ptr [esp + 0x39c]

        $sequence_5 = { 83f808 74bb 83f807 77c6 ff2485a9264400 8bce e8???????? }
            // n = 7, score = 100
            //   83f808               | cmp                 eax, 8
            //   74bb                 | je                  0xffffffbd
            //   83f807               | cmp                 eax, 7
            //   77c6                 | ja                  0xffffffc8
            //   ff2485a9264400       | jmp                 dword ptr [eax*4 + 0x4426a9]
            //   8bce                 | mov                 ecx, esi
            //   e8????????           |                     

        $sequence_6 = { e8???????? 59 8d4df8 8bd8 e8???????? 8b0e 8b4904 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   8d4df8               | lea                 ecx, [ebp - 8]
            //   8bd8                 | mov                 ebx, eax
            //   e8????????           |                     
            //   8b0e                 | mov                 ecx, dword ptr [esi]
            //   8b4904               | mov                 ecx, dword ptr [ecx + 4]

        $sequence_7 = { ff7010 51 b9???????? e8???????? 8d4c2428 e8???????? 55 }
            // n = 7, score = 100
            //   ff7010               | push                dword ptr [eax + 0x10]
            //   51                   | push                ecx
            //   b9????????           |                     
            //   e8????????           |                     
            //   8d4c2428             | lea                 ecx, [esp + 0x28]
            //   e8????????           |                     
            //   55                   | push                ebp

        $sequence_8 = { 894c242c 8ac1 894c2430 894c2434 894c2438 56 88442413 }
            // n = 7, score = 100
            //   894c242c             | mov                 dword ptr [esp + 0x2c], ecx
            //   8ac1                 | mov                 al, cl
            //   894c2430             | mov                 dword ptr [esp + 0x30], ecx
            //   894c2434             | mov                 dword ptr [esp + 0x34], ecx
            //   894c2438             | mov                 dword ptr [esp + 0x38], ecx
            //   56                   | push                esi
            //   88442413             | mov                 byte ptr [esp + 0x13], al

        $sequence_9 = { 59 ebc4 83ec14 a1???????? 33c4 89442410 64a12c000000 }
            // n = 7, score = 100
            //   59                   | pop                 ecx
            //   ebc4                 | jmp                 0xffffffc6
            //   83ec14               | sub                 esp, 0x14
            //   a1????????           |                     
            //   33c4                 | xor                 eax, esp
            //   89442410             | mov                 dword ptr [esp + 0x10], eax
            //   64a12c000000         | mov                 eax, dword ptr fs:[0x2c]

    condition:
        7 of them and filesize < 990208
}