rule win_spider_rat_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.spider_rat."
        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.spider_rat"
        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 = { 488bf2 488bf9 4585c0 7520 e8???????? 488b5c2430 488b6c2438 }
            // n = 7, score = 200
            //   488bf2               | call                dword ptr [eax + 8]
            //   488bf9               | dec                 esp
            //   4585c0               | mov                 ebx, dword ptr [ebx + 0x208]
            //   7520                 | xor                 eax, eax
            //   e8????????           |                     
            //   488b5c2430           | dec                 esp
            //   488b6c2438           | mov                 dword ptr [edi], ebx

        $sequence_1 = { e8???????? cc 488d15d8a00200 488bc8 ff15???????? 488b0d???????? }
            // n = 6, score = 200
            //   e8????????           |                     
            //   cc                   | sar                 eax, 5
            //   488d15d8a00200       | dec                 eax
            //   488bc8               | lea                 edx, [0x3492a]
            //   ff15????????         |                     
            //   488b0d????????       |                     

        $sequence_2 = { 4c89742430 be3f000000 89742428 498b0424 4889442420 458bcf 4c8d05bf8b0500 }
            // n = 7, score = 200
            //   4c89742430           | dec                 esp
            //   be3f000000           | lea                 eax, [0x265f5]
            //   89742428             | dec                 ecx
            //   498b0424             | mov                 eax, ebp
            //   4889442420           | dec                 ecx
            //   458bcf               | imul                ecx
            //   4c8d05bf8b0500       | dec                 eax

        $sequence_3 = { 4c895d50 44885d40 458d431b 488d1555d10000 488d4d38 e8???????? 488d4d38 }
            // n = 7, score = 200
            //   4c895d50             | cmp                 ebp, ecx
            //   44885d40             | jl                  0x116
            //   458d431b             | inc                 cx
            //   488d1555d10000       | cmp                 esi, ecx
            //   488d4d38             | je                  0x3c1
            //   e8????????           |                     
            //   488d4d38             | dec                 ecx

        $sequence_4 = { 3ac3 0f8419030000 0fb744247a 0fb74c2478 440fb7542476 440fb74c2474 440fb7442472 }
            // n = 7, score = 200
            //   3ac3                 | dec                 eax
            //   0f8419030000         | arpl                word ptr [eax + 4], cx
            //   0fb744247a           | dec                 edx
            //   0fb74c2478           | mov                 ecx, dword ptr [ecx + 0x48]
            //   440fb7542476         | inc                 esp
            //   440fb74c2474         | movzx               eax, byte ptr [edx + esi]
            //   440fb7442472         | dec                 eax

        $sequence_5 = { 5e c3 4c89642438 4c8d0d639f0500 4c8d05689f0500 488d15659f0500 488bc8 }
            // n = 7, score = 200
            //   5e                   | call                dword ptr [eax]
            //   c3                   | mov                 esi, dword ptr [esp + 0xb0]
            //   4c89642438           | mov                 edi, eax
            //   4c8d0d639f0500       | dec                 eax
            //   4c8d05689f0500       | and                 dword ptr [esp + 0x38], 0
            //   488d15659f0500       | dec                 ebp
            //   488bc8               | test                eax, eax

        $sequence_6 = { 740a 488bcf e8???????? eb05 4883670800 488b5c2448 488b742450 }
            // n = 7, score = 200
            //   740a                 | dec                 eax
            //   488bcf               | add                 edi, 8
            //   e8????????           |                     
            //   eb05                 | dec                 eax
            //   4883670800           | mov                 eax, dword ptr [edi]
            //   488b5c2448           | dec                 eax
            //   488b742450           | add                 edi, 8

        $sequence_7 = { 488d9424d0000000 4183c8ff 896c2420 ff15???????? 85c0 }
            // n = 5, score = 200
            //   488d9424d0000000     | dec                 eax
            //   4183c8ff             | lea                 eax, [edx + 8]
            //   896c2420             | dec                 eax
            //   ff15????????         |                     
            //   85c0                 | mov                 dword ptr [ecx + 0x58], eax

        $sequence_8 = { 440fb66828 493bee 7514 0fba66301e 0f8212020000 453bee 0f8509020000 }
            // n = 7, score = 200
            //   440fb66828           | lea                 ecx, [esp + 0x20]
            //   493bee               | dec                 eax
            //   7514                 | lea                 ecx, [esp + 0x20]
            //   0fba66301e           | dec                 esp
            //   0f8212020000         | lea                 eax, [ecx - 1]
            //   453bee               | dec                 eax
            //   0f8509020000         | lea                 edx, [esp + 0x180]

        $sequence_9 = { 488bd9 4883c160 ff15???????? 488b4b20 488b7b18 4c8bc1 4c2bc7 }
            // n = 7, score = 200
            //   488bd9               | mov                 esi, 0x50
            //   4883c160             | dec                 esp
            //   ff15????????         |                     
            //   488b4b20             | mov                 eax, esi
            //   488b7b18             | sub                 eax, 2
            //   4c8bc1               | je                  0xb1e
            //   4c2bc7               | dec                 eax

    condition:
        7 of them and filesize < 1107968
}