rule win_brute_ratel_c4_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.brute_ratel_c4."
        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.brute_ratel_c4"
        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 = { 89542410 48894c2408 4883ec48 8b442458 89442424 48c744242800000000 41b800060400 }
            // n = 7, score = 100
            //   89542410             | arpl                word ptr [esp + 0x30], ax
            //   48894c2408           | dec                 eax
            //   4883ec48             | imul                eax, eax, 0x10
            //   8b442458             | dec                 eax
            //   89442424             | lea                 ecx, [0x42ee3]
            //   48c744242800000000     | dec    eax
            //   41b800060400         | add                 ecx, eax

        $sequence_1 = { eb08 b9e8030000 41ffd4 4889e8 f0480fb13b 4889c6 4885c0 }
            // n = 7, score = 100
            //   eb08                 | mov                 esi, ecx
            //   b9e8030000           | mov                 dword ptr [ebp], edx
            //   41ffd4               | jmp                 0xa
            //   4889e8               | mov                 ecx, 0x3e8
            //   f0480fb13b           | inc                 ecx
            //   4889c6               | call                esp
            //   4885c0               | dec                 eax

        $sequence_2 = { 53 4883ec20 488b2d???????? 4889ce 895500 }
            // n = 5, score = 100
            //   53                   | push                ebx
            //   4883ec20             | dec                 eax
            //   488b2d????????       |                     
            //   4889ce               | sub                 esp, 0x20
            //   895500               | dec                 eax

        $sequence_3 = { 4889f9 ffd0 8305????????01 ba01000000 e9???????? 488d0db92e0400 }
            // n = 6, score = 100
            //   4889f9               | dec                 ecx
            //   ffd0                 | add                 ebp, 4
            //   8305????????01       |                     
            //   ba01000000           | dec                 ebp
            //   e9????????           |                     
            //   488d0db92e0400       | nop                 

        $sequence_4 = { 89442424 48c744242800000000 41b800060400 488d15d02f0000 488d4c2420 e8???????? 4889442428 }
            // n = 7, score = 100
            //   89442424             | dec                 esp
            //   48c744242800000000     | mov    edi, dword ptr [eax + 0x68]
            //   41b800060400         | inc                 ecx
            //   488d15d02f0000       | cmp                 dword ptr [edi + 0xc], 0
            //   488d4c2420           | je                  0x1f
            //   e8????????           |                     
            //   4889442428           | dec                 esp

        $sequence_5 = { 4c8d2c06 4983c504 ffcd 90 85ed 78bc 89ef }
            // n = 7, score = 100
            //   4c8d2c06             | mov                 eax, ebp
            //   4983c504             | dec                 eax
            //   ffcd                 | mov                 esi, eax
            //   90                   | dec                 eax
            //   85ed                 | test                eax, eax
            //   78bc                 | dec                 esp
            //   89ef                 | lea                 ebp, [esi + eax]

        $sequence_6 = { 4c01f9 49d1e8 488b542430 41ffd4 85c0 75c9 }
            // n = 6, score = 100
            //   4c01f9               | mov                 edx, 1
            //   49d1e8               | dec                 eax
            //   488b542430           | lea                 ecx, [0x42eb9]
            //   41ffd4               | test                eax, eax
            //   85c0                 | jne                 0xffffffcd
            //   75c9                 | inc                 ecx

        $sequence_7 = { 4989f8 ba01000000 4889f1 e8???????? 4189c4 }
            // n = 5, score = 100
            //   4989f8               | dec                 eax
            //   ba01000000           | mov                 edx, dword ptr [esp + 0x30]
            //   4889f1               | inc                 ecx
            //   e8????????           |                     
            //   4189c4               | call                esp

        $sequence_8 = { 8b460c 4939c4 0f837d000000 4b8d3c64 }
            // n = 4, score = 100
            //   8b460c               | mov                 eax, dword ptr [edi + esi*4 + 0x10]
            //   4939c4               | inc                 ecx
            //   0f837d000000         | mov                 esi, dword ptr [edi + eax]
            //   4b8d3c64             | dec                 ecx

        $sequence_9 = { 486bc010 488d0de32e0400 4803c8 488bc1 48634c2434 }
            // n = 5, score = 100
            //   486bc010             | jae                 0x83
            //   488d0de32e0400       | dec                 ebx
            //   4803c8               | lea                 edi, [esp]
            //   488bc1               | dec                 esp
            //   48634c2434           | add                 esi, ebp

        $sequence_10 = { c744242c00000000 8b44242c 89442438 4863442430 486bc010 488d0de32e0400 }
            // n = 6, score = 100
            //   c744242c00000000     | mov                 dword ptr [esp + 0x28], eax
            //   8b44242c             | dec                 eax
            //   89442438             | imul                eax, eax, 0x10
            //   4863442430           | dec                 eax
            //   486bc010             | lea                 ecx, [0x42ee3]
            //   488d0de32e0400       | dec                 eax

        $sequence_11 = { 85c0 75c9 418b44b710 418b3407 498d2c07 4883c504 }
            // n = 6, score = 100
            //   85c0                 | test                ebp, ebp
            //   75c9                 | js                  0xffffffc3
            //   418b44b710           | mov                 edi, ebp
            //   418b3407             | dec                 eax
            //   498d2c07             | mov                 ecx, edi
            //   4883c504             | call                eax

    condition:
        7 of them and filesize < 607232
}