rule win_cryptoshuffler_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.cryptoshuffler."
        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.cryptoshuffler"
        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 = { 8b0f 85c9 7427 83c8ff f00fc14120 751d 8b37 }
            // n = 7, score = 100
            //   8b0f                 | mov                 ecx, dword ptr [edi]
            //   85c9                 | test                ecx, ecx
            //   7427                 | je                  0x29
            //   83c8ff               | or                  eax, 0xffffffff
            //   f00fc14120           | lock xadd           dword ptr [ecx + 0x20], eax
            //   751d                 | jne                 0x1f
            //   8b37                 | mov                 esi, dword ptr [edi]

        $sequence_1 = { c744247400000000 68???????? 8d4c2468 0f29442468 e8???????? }
            // n = 5, score = 100
            //   c744247400000000     | mov                 dword ptr [esp + 0x74], 0
            //   68????????           |                     
            //   8d4c2468             | lea                 ecx, [esp + 0x68]
            //   0f29442468           | movaps              xmmword ptr [esp + 0x68], xmm0
            //   e8????????           |                     

        $sequence_2 = { 40 83f8fe 0f87c7030000 3bc8 730c ff33 8bce }
            // n = 7, score = 100
            //   40                   | inc                 eax
            //   83f8fe               | cmp                 eax, -2
            //   0f87c7030000         | ja                  0x3cd
            //   3bc8                 | cmp                 ecx, eax
            //   730c                 | jae                 0xe
            //   ff33                 | push                dword ptr [ebx]
            //   8bce                 | mov                 ecx, esi

        $sequence_3 = { 40 e9???????? 6a10 68???????? }
            // n = 4, score = 100
            //   40                   | inc                 eax
            //   e9????????           |                     
            //   6a10                 | push                0x10
            //   68????????           |                     

        $sequence_4 = { 83c001 25fe030000 f20f592c8530840210 f20f59148530840210 660f5834c5408c0210 660f54c5 f20f5ce8 }
            // n = 7, score = 100
            //   83c001               | add                 eax, 1
            //   25fe030000           | and                 eax, 0x3fe
            //   f20f592c8530840210     | mulsd    xmm5, qword ptr [eax*4 + 0x10028430]
            //   f20f59148530840210     | mulsd    xmm2, qword ptr [eax*4 + 0x10028430]
            //   660f5834c5408c0210     | addpd    xmm6, xmmword ptr [eax*8 + 0x10028c40]
            //   660f54c5             | andpd               xmm0, xmm5
            //   f20f5ce8             | subsd               xmm5, xmm0

        $sequence_5 = { 83e908 8d7608 660fd60f 8d7f08 8b048dc4f20010 ffe0 }
            // n = 6, score = 100
            //   83e908               | sub                 ecx, 8
            //   8d7608               | lea                 esi, [esi + 8]
            //   660fd60f             | movq                qword ptr [edi], xmm1
            //   8d7f08               | lea                 edi, [edi + 8]
            //   8b048dc4f20010       | mov                 eax, dword ptr [ecx*4 + 0x1000f2c4]
            //   ffe0                 | jmp                 eax

        $sequence_6 = { e8???????? ff742410 8d4e24 53 e8???????? 837e4c7c }
            // n = 6, score = 100
            //   e8????????           |                     
            //   ff742410             | push                dword ptr [esp + 0x10]
            //   8d4e24               | lea                 ecx, [esi + 0x24]
            //   53                   | push                ebx
            //   e8????????           |                     
            //   837e4c7c             | cmp                 dword ptr [esi + 0x4c], 0x7c

        $sequence_7 = { 3bf1 7525 8b7108 50 8d4610 50 }
            // n = 6, score = 100
            //   3bf1                 | cmp                 esi, ecx
            //   7525                 | jne                 0x27
            //   8b7108               | mov                 esi, dword ptr [ecx + 8]
            //   50                   | push                eax
            //   8d4610               | lea                 eax, [esi + 0x10]
            //   50                   | push                eax

        $sequence_8 = { 85c0 0f8496040000 6aff 6a00 8d442430 }
            // n = 5, score = 100
            //   85c0                 | test                eax, eax
            //   0f8496040000         | je                  0x49c
            //   6aff                 | push                -1
            //   6a00                 | push                0
            //   8d442430             | lea                 eax, [esp + 0x30]

        $sequence_9 = { 83f809 7775 0fb680a01c0010 ff24858c1c0010 85db }
            // n = 5, score = 100
            //   83f809               | cmp                 eax, 9
            //   7775                 | ja                  0x77
            //   0fb680a01c0010       | movzx               eax, byte ptr [eax + 0x10001ca0]
            //   ff24858c1c0010       | jmp                 dword ptr [eax*4 + 0x10001c8c]
            //   85db                 | test                ebx, ebx

    condition:
        7 of them and filesize < 425984
}