rule win_rcs_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.rcs."
        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.rcs"
        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 = { ff15???????? 5f 5e 5d 5b 33c0 }
            // n = 6, score = 200
            //   ff15????????         |                     
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi
            //   5d                   | pop                 ebp
            //   5b                   | pop                 ebx
            //   33c0                 | xor                 eax, eax

        $sequence_1 = { 89442456 8944245a 8944245e 89442462 89442466 8944246a }
            // n = 6, score = 200
            //   89442456             | mov                 dword ptr [esp + 0x56], eax
            //   8944245a             | mov                 dword ptr [esp + 0x5a], eax
            //   8944245e             | mov                 dword ptr [esp + 0x5e], eax
            //   89442462             | mov                 dword ptr [esp + 0x62], eax
            //   89442466             | mov                 dword ptr [esp + 0x66], eax
            //   8944246a             | mov                 dword ptr [esp + 0x6a], eax

        $sequence_2 = { 6a01 6a00 6a05 6800000040 }
            // n = 4, score = 200
            //   6a01                 | push                1
            //   6a00                 | push                0
            //   6a05                 | push                5
            //   6800000040           | push                0x40000000

        $sequence_3 = { 40 68???????? 50 e8???????? 83c40c eb0d }
            // n = 6, score = 200
            //   40                   | inc                 eax
            //   68????????           |                     
            //   50                   | push                eax
            //   e8????????           |                     
            //   83c40c               | add                 esp, 0xc
            //   eb0d                 | jmp                 0xf

        $sequence_4 = { 85ff 0f84d4000000 57 e8???????? }
            // n = 4, score = 200
            //   85ff                 | test                edi, edi
            //   0f84d4000000         | je                  0xda
            //   57                   | push                edi
            //   e8????????           |                     

        $sequence_5 = { e8???????? 83c430 6aff 68???????? }
            // n = 4, score = 200
            //   e8????????           |                     
            //   83c430               | add                 esp, 0x30
            //   6aff                 | push                -1
            //   68????????           |                     

        $sequence_6 = { 894710 8b7d08 8b37 81c62c010000 }
            // n = 4, score = 100
            //   894710               | mov                 dword ptr [edi + 0x10], eax
            //   8b7d08               | mov                 edi, dword ptr [ebp + 8]
            //   8b37                 | mov                 esi, dword ptr [edi]
            //   81c62c010000         | add                 esi, 0x12c

        $sequence_7 = { 0508070000 50 ff96b8000000 43 }
            // n = 4, score = 100
            //   0508070000           | add                 eax, 0x708
            //   50                   | push                eax
            //   ff96b8000000         | call                dword ptr [esi + 0xb8]
            //   43                   | inc                 ebx

        $sequence_8 = { 81f560444c06 2ac5 66c1e73b 8dadc4402771 660fce }
            // n = 5, score = 100
            //   81f560444c06         | xor                 ebp, 0x64c4460
            //   2ac5                 | sub                 al, ch
            //   66c1e73b             | shl                 di, 0x3b
            //   8dadc4402771         | lea                 ebp, [ebp + 0x712740c4]
            //   660fce               | bswap               si

        $sequence_9 = { 8906 8b7d10 833fff 750a b800000000 e9???????? 8b7d10 }
            // n = 7, score = 100
            //   8906                 | mov                 dword ptr [esi], eax
            //   8b7d10               | mov                 edi, dword ptr [ebp + 0x10]
            //   833fff               | cmp                 dword ptr [edi], -1
            //   750a                 | jne                 0xc
            //   b800000000           | mov                 eax, 0
            //   e9????????           |                     
            //   8b7d10               | mov                 edi, dword ptr [ebp + 0x10]

        $sequence_10 = { 742e 8b7d08 ff5768 89c7 }
            // n = 4, score = 100
            //   742e                 | je                  0x30
            //   8b7d08               | mov                 edi, dword ptr [ebp + 8]
            //   ff5768               | call                dword ptr [edi + 0x68]
            //   89c7                 | mov                 edi, eax

        $sequence_11 = { 83fdff 750d b801000000 5d }
            // n = 4, score = 100
            //   83fdff               | cmp                 ebp, -1
            //   750d                 | jne                 0xf
            //   b801000000           | mov                 eax, 1
            //   5d                   | pop                 ebp

        $sequence_12 = { 83bd6cffffff01 750d 8b87dc000000 c7401401000000 }
            // n = 4, score = 100
            //   83bd6cffffff01       | cmp                 dword ptr [ebp - 0x94], 1
            //   750d                 | jne                 0xf
            //   8b87dc000000         | mov                 eax, dword ptr [edi + 0xdc]
            //   c7401401000000       | mov                 dword ptr [eax + 0x14], 1

        $sequence_13 = { 8bb814120000 8b9548f4fbff 83c205 0fb7949070020000 }
            // n = 4, score = 100
            //   8bb814120000         | mov                 edi, dword ptr [eax + 0x1214]
            //   8b9548f4fbff         | mov                 edx, dword ptr [ebp - 0x40bb8]
            //   83c205               | add                 edx, 5
            //   0fb7949070020000     | movzx               edx, word ptr [eax + edx*4 + 0x270]

        $sequence_14 = { 83fdff 7467 57 8b3d???????? f684241402000010 }
            // n = 5, score = 100
            //   83fdff               | cmp                 ebp, -1
            //   7467                 | je                  0x69
            //   57                   | push                edi
            //   8b3d????????         |                     
            //   f684241402000010     | test                byte ptr [esp + 0x214], 0x10

        $sequence_15 = { 81f57e566901 03fd 8dad03dc03da 0fbff6 }
            // n = 4, score = 100
            //   81f57e566901         | xor                 ebp, 0x169567e
            //   03fd                 | add                 edi, ebp
            //   8dad03dc03da         | lea                 ebp, [ebp - 0x25fc23fd]
            //   0fbff6               | movsx               esi, si

        $sequence_16 = { 8d85dafffbff 50 6809000200 8d85e3fffdff }
            // n = 4, score = 100
            //   8d85dafffbff         | lea                 eax, [ebp - 0x40026]
            //   50                   | push                eax
            //   6809000200           | push                0x20009
            //   8d85e3fffdff         | lea                 eax, [ebp - 0x2001d]

        $sequence_17 = { 50 ff968c000000 ffb570f4fbff ffb588f4fbff }
            // n = 4, score = 100
            //   50                   | push                eax
            //   ff968c000000         | call                dword ptr [esi + 0x8c]
            //   ffb570f4fbff         | push                dword ptr [ebp - 0x40b90]
            //   ffb588f4fbff         | push                dword ptr [ebp - 0x40b78]

    condition:
        7 of them and filesize < 11501568
}