rule win_tor_loader_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.tor_loader."
        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.tor_loader"
        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 = { e8???????? 488b6d00 488b15???????? 488b35???????? 4889542458 4889742460 488d155db20800 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488b6d00             | lea                 ebx, [0x45e54d]
            //   488b15????????       |                     
            //   488b35????????       |                     
            //   4889542458           | inc                 esi
            //   4889742460           | movzx               eax, byte ptr [ebx]
            //   488d155db20800       | inc                 ecx

        $sequence_1 = { 89442444 4c89c0 bf01000000 488d35c68e2000 e8???????? 48898c24b0000000 48898424a0000000 }
            // n = 7, score = 100
            //   89442444             | lea                 ebx, [0x1abe3d]
            //   4c89c0               | nop                 
            //   bf01000000           | dec                 eax
            //   488d35c68e2000       | mov                 ebp, dword ptr [esp + 0xa0]
            //   e8????????           |                     
            //   48898c24b0000000     | dec                 eax
            //   48898424a0000000     | add                 esp, 0xa8

        $sequence_2 = { e8???????? 488d050c803400 bb29000000 e8???????? 4889f0 b940000000 e8???????? }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488d050c803400       | lea                 eax, [0x28f934]
            //   bb29000000           | dec                 eax
            //   e8????????           |                     
            //   4889f0               | lea                 ebx, [0x3848cd]
            //   b940000000           | nop                 
            //   e8????????           |                     

        $sequence_3 = { e8???????? 488b8c2408030000 8b490c 48ffc1 4801c1 48898c2420030000 488b842408010000 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488b8c2408030000     | dec                 eax
            //   8b490c               | lea                 eax, [0x1643df]
            //   48ffc1               | dec                 eax
            //   4801c1               | mov                 ecx, dword ptr [esp + 0x48]
            //   48898c2420030000     | dec                 eax
            //   488b842408010000     | lea                 ebx, [0x28cf8c]

        $sequence_4 = { eb0f 4889c7 488d15ff561500 e8???????? 488d055fed0f00 488b5c2420 488d0ddd141500 }
            // n = 7, score = 100
            //   eb0f                 | lea                 esi, [esp + 0x168]
            //   4889c7               | nop                 word ptr [eax + eax]
            //   488d15ff561500       | nop                 dword ptr [eax]
            //   e8????????           |                     
            //   488d055fed0f00       | dec                 eax
            //   488b5c2420           | mov                 dword ptr [esp - 0x10], ebp
            //   488d0ddd141500       | dec                 eax

        $sequence_5 = { eb0c 4c8d0d3da93200 b801000000 84c0 0f84dd030000 31c0 e9???????? }
            // n = 7, score = 100
            //   eb0c                 | mov                 dword ptr [esp + 0x130], ecx
            //   4c8d0d3da93200       | dec                 eax
            //   b801000000           | mov                 eax, 0xffffffff
            //   84c0                 | dec                 eax
            //   0f84dd030000         | mul                 ecx
            //   31c0                 | dec                 eax
            //   e9????????           |                     

        $sequence_6 = { e8???????? 48c740082e000000 488d0d6dd30e00 488908 488d1db9bd1600 4889c1 31c0 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   48c740082e000000     | mov                 edi, edx
            //   488d0d6dd30e00       | dec                 eax
            //   488908               | mov                 esi, dword ptr [esp + 0xb0]
            //   488d1db9bd1600       | dec                 eax
            //   4889c1               | lea                 edi, [eax + 8]
            //   31c0                 | dec                 eax

        $sequence_7 = { e8???????? 488b8c2488000000 488b5108 48ffca 488b742478 eb29 4889542448 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488b8c2488000000     | mov                 ecx, eax
            //   488b5108             | xor                 eax, eax
            //   48ffca               | dec                 eax
            //   488b742478           | mov                 ebp, dword ptr [esp + 0xd0]
            //   eb29                 | dec                 eax
            //   4889542448           | add                 esp, 0xd8

        $sequence_8 = { 897218 90 8b74243c 468d0c2e 45334c241c 44894a1c 90 }
            // n = 7, score = 100
            //   897218               | dec                 eax
            //   90                   | mov                 ebp, dword ptr [esp + 0xc8]
            //   8b74243c             | dec                 eax
            //   468d0c2e             | add                 esp, 0xd0
            //   45334c241c           | ret                 
            //   44894a1c             | dec                 eax
            //   90                   | mov                 ecx, dword ptr [esp + 0xd8]

        $sequence_9 = { e8???????? 48c7401016000000 488d0d32242d00 48894808 833d????????00 7509 488905???????? }
            // n = 7, score = 100
            //   e8????????           |                     
            //   48c7401016000000     | dec                 eax
            //   488d0d32242d00       | lea                 ebx, [ecx - 1]
            //   48894808             | dec                 eax
            //   833d????????00       |                     
            //   7509                 | mov                 dword ptr [esp + 0x80], ebx
            //   488905????????       |                     

    condition:
        7 of them and filesize < 13050880
}