rule win_chthonic_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.chthonic."
        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.chthonic"
        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 = { 8d4df0 51 ff7028 ff5618 84c0 }
            // n = 5, score = 600
            //   8d4df0               | lea                 ecx, [ebp - 0x10]
            //   51                   | push                ecx
            //   ff7028               | push                dword ptr [eax + 0x28]
            //   ff5618               | call                dword ptr [esi + 0x18]
            //   84c0                 | test                al, al

        $sequence_1 = { 83fe02 0f850d010000 8b4df0 eb00 894df8 }
            // n = 5, score = 600
            //   83fe02               | cmp                 esi, 2
            //   0f850d010000         | jne                 0x113
            //   8b4df0               | mov                 ecx, dword ptr [ebp - 0x10]
            //   eb00                 | jmp                 2
            //   894df8               | mov                 dword ptr [ebp - 8], ecx

        $sequence_2 = { 0f84d4010000 4f 8bf0 8bcf d3ee }
            // n = 5, score = 600
            //   0f84d4010000         | je                  0x1da
            //   4f                   | dec                 edi
            //   8bf0                 | mov                 esi, eax
            //   8bcf                 | mov                 ecx, edi
            //   d3ee                 | shr                 esi, cl

        $sequence_3 = { c1c108 81e1ff00ff00 0bc1 89470c 5f 5e 5b }
            // n = 7, score = 600
            //   c1c108               | rol                 ecx, 8
            //   81e1ff00ff00         | and                 ecx, 0xff00ff
            //   0bc1                 | or                  eax, ecx
            //   89470c               | mov                 dword ptr [edi + 0xc], eax
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi
            //   5b                   | pop                 ebx

        $sequence_4 = { 83c410 f60680 7408 8a06 32c3 }
            // n = 5, score = 600
            //   83c410               | add                 esp, 0x10
            //   f60680               | test                byte ptr [esi], 0x80
            //   7408                 | je                  0xa
            //   8a06                 | mov                 al, byte ptr [esi]
            //   32c3                 | xor                 al, bl

        $sequence_5 = { 2500ff00ff c1c108 81e1ff00ff00 0bc1 89470c 5f 5e }
            // n = 7, score = 600
            //   2500ff00ff           | and                 eax, 0xff00ff00
            //   c1c108               | rol                 ecx, 8
            //   81e1ff00ff00         | and                 ecx, 0xff00ff
            //   0bc1                 | or                  eax, ecx
            //   89470c               | mov                 dword ptr [edi + 0xc], eax
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi

        $sequence_6 = { 83c304 83c602 ff45fc 8b45fc 3b45f8 72e1 33c0 }
            // n = 7, score = 600
            //   83c304               | add                 ebx, 4
            //   83c602               | add                 esi, 2
            //   ff45fc               | inc                 dword ptr [ebp - 4]
            //   8b45fc               | mov                 eax, dword ptr [ebp - 4]
            //   3b45f8               | cmp                 eax, dword ptr [ebp - 8]
            //   72e1                 | jb                  0xffffffe3
            //   33c0                 | xor                 eax, eax

        $sequence_7 = { 8b36 83c410 f60680 7408 8a06 }
            // n = 5, score = 600
            //   8b36                 | mov                 esi, dword ptr [esi]
            //   83c410               | add                 esp, 0x10
            //   f60680               | test                byte ptr [esi], 0x80
            //   7408                 | je                  0xa
            //   8a06                 | mov                 al, byte ptr [esi]

        $sequence_8 = { 47 8a01 8845ff 8d84bdfcfbffff 8b10 }
            // n = 5, score = 600
            //   47                   | inc                 edi
            //   8a01                 | mov                 al, byte ptr [ecx]
            //   8845ff               | mov                 byte ptr [ebp - 1], al
            //   8d84bdfcfbffff       | lea                 eax, [ebp + edi*4 - 0x404]
            //   8b10                 | mov                 edx, dword ptr [eax]

        $sequence_9 = { 85ff 0f84bd000000 4f 8bf0 }
            // n = 4, score = 600
            //   85ff                 | test                edi, edi
            //   0f84bd000000         | je                  0xc3
            //   4f                   | dec                 edi
            //   8bf0                 | mov                 esi, eax

    condition:
        7 of them and filesize < 425984
}