rule win_chinoxy_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.chinoxy."
        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.chinoxy"
        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 = { 8d4df4 8d45fc 8bd1 8d7b0c c1e902 }
            // n = 5, score = 100
            //   8d4df4               | lea                 ecx, [ebp - 0xc]
            //   8d45fc               | lea                 eax, [ebp - 4]
            //   8bd1                 | mov                 edx, ecx
            //   8d7b0c               | lea                 edi, [ebx + 0xc]
            //   c1e902               | shr                 ecx, 2

        $sequence_1 = { 894010 8d869c000000 894004 894008 c700???????? 89400c 894010 }
            // n = 7, score = 100
            //   894010               | mov                 dword ptr [eax + 0x10], eax
            //   8d869c000000         | lea                 eax, [esi + 0x9c]
            //   894004               | mov                 dword ptr [eax + 4], eax
            //   894008               | mov                 dword ptr [eax + 8], eax
            //   c700????????         |                     
            //   89400c               | mov                 dword ptr [eax + 0xc], eax
            //   894010               | mov                 dword ptr [eax + 0x10], eax

        $sequence_2 = { 7416 3bc3 7412 8b5004 8b4808 894a08 8b5008 }
            // n = 7, score = 100
            //   7416                 | je                  0x18
            //   3bc3                 | cmp                 eax, ebx
            //   7412                 | je                  0x14
            //   8b5004               | mov                 edx, dword ptr [eax + 4]
            //   8b4808               | mov                 ecx, dword ptr [eax + 8]
            //   894a08               | mov                 dword ptr [edx + 8], ecx
            //   8b5008               | mov                 edx, dword ptr [eax + 8]

        $sequence_3 = { 8b4608 894208 8b4e08 8b5604 895104 8b4628 85c0 }
            // n = 7, score = 100
            //   8b4608               | mov                 eax, dword ptr [esi + 8]
            //   894208               | mov                 dword ptr [edx + 8], eax
            //   8b4e08               | mov                 ecx, dword ptr [esi + 8]
            //   8b5604               | mov                 edx, dword ptr [esi + 4]
            //   895104               | mov                 dword ptr [ecx + 4], edx
            //   8b4628               | mov                 eax, dword ptr [esi + 0x28]
            //   85c0                 | test                eax, eax

        $sequence_4 = { 85ff 740a 8d4704 50 ff15???????? 8b4c240c 85c9 }
            // n = 7, score = 100
            //   85ff                 | test                edi, edi
            //   740a                 | je                  0xc
            //   8d4704               | lea                 eax, [edi + 4]
            //   50                   | push                eax
            //   ff15????????         |                     
            //   8b4c240c             | mov                 ecx, dword ptr [esp + 0xc]
            //   85c9                 | test                ecx, ecx

        $sequence_5 = { 3bc7 740e 8b16 8bce ff5210 5f 33c0 }
            // n = 7, score = 100
            //   3bc7                 | cmp                 eax, edi
            //   740e                 | je                  0x10
            //   8b16                 | mov                 edx, dword ptr [esi]
            //   8bce                 | mov                 ecx, esi
            //   ff5210               | call                dword ptr [edx + 0x10]
            //   5f                   | pop                 edi
            //   33c0                 | xor                 eax, eax

        $sequence_6 = { 8b8e3c200000 85c9 7508 85c0 0f8f69020000 8b86b8200000 8dbeb0200000 }
            // n = 7, score = 100
            //   8b8e3c200000         | mov                 ecx, dword ptr [esi + 0x203c]
            //   85c9                 | test                ecx, ecx
            //   7508                 | jne                 0xa
            //   85c0                 | test                eax, eax
            //   0f8f69020000         | jg                  0x26f
            //   8b86b8200000         | mov                 eax, dword ptr [esi + 0x20b8]
            //   8dbeb0200000         | lea                 edi, [esi + 0x20b0]

        $sequence_7 = { 89742414 c7462008590110 ff15???????? 8b5c2424 897c241c 3bdf c706???????? }
            // n = 7, score = 100
            //   89742414             | mov                 dword ptr [esp + 0x14], esi
            //   c7462008590110       | mov                 dword ptr [esi + 0x20], 0x10015908
            //   ff15????????         |                     
            //   8b5c2424             | mov                 ebx, dword ptr [esp + 0x24]
            //   897c241c             | mov                 dword ptr [esp + 0x1c], edi
            //   3bdf                 | cmp                 ebx, edi
            //   c706????????         |                     

        $sequence_8 = { e8???????? 85c0 0f8cd7010000 6a00 50 }
            // n = 5, score = 100
            //   e8????????           |                     
            //   85c0                 | test                eax, eax
            //   0f8cd7010000         | jl                  0x1dd
            //   6a00                 | push                0
            //   50                   | push                eax

        $sequence_9 = { 8bf1 ff15???????? 8b8edc200000 8b96d8200000 03ca 3bc8 770e }
            // n = 7, score = 100
            //   8bf1                 | mov                 esi, ecx
            //   ff15????????         |                     
            //   8b8edc200000         | mov                 ecx, dword ptr [esi + 0x20dc]
            //   8b96d8200000         | mov                 edx, dword ptr [esi + 0x20d8]
            //   03ca                 | add                 ecx, edx
            //   3bc8                 | cmp                 ecx, eax
            //   770e                 | ja                  0x10

    condition:
        7 of them and filesize < 1138688
}