rule win_rokrat_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.rokrat."
        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.rokrat"
        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 = { 50 e8???????? 8d8ef4000000 8d4538 3bc8 }
            // n = 5, score = 800
            //   50                   | push                eax
            //   e8????????           |                     
            //   8d8ef4000000         | lea                 ecx, [esi + 0xf4]
            //   8d4538               | lea                 eax, [ebp + 0x38]
            //   3bc8                 | cmp                 ecx, eax

        $sequence_1 = { 50 8bcf e8???????? 8d4538 }
            // n = 4, score = 800
            //   50                   | push                eax
            //   8bcf                 | mov                 ecx, edi
            //   e8????????           |                     
            //   8d4538               | lea                 eax, [ebp + 0x38]

        $sequence_2 = { 50 ff15???????? e8???????? 40 }
            // n = 4, score = 800
            //   50                   | push                eax
            //   ff15????????         |                     
            //   e8????????           |                     
            //   40                   | inc                 eax

        $sequence_3 = { 50 e8???????? 8d8edc000000 8d4520 }
            // n = 4, score = 800
            //   50                   | push                eax
            //   e8????????           |                     
            //   8d8edc000000         | lea                 ecx, [esi + 0xdc]
            //   8d4520               | lea                 eax, [ebp + 0x20]

        $sequence_4 = { 0fb7c1 50 0fb74208 c1e910 51 50 0fb74212 }
            // n = 7, score = 800
            //   0fb7c1               | movzx               eax, cx
            //   50                   | push                eax
            //   0fb74208             | movzx               eax, word ptr [edx + 8]
            //   c1e910               | shr                 ecx, 0x10
            //   51                   | push                ecx
            //   50                   | push                eax
            //   0fb74212             | movzx               eax, word ptr [edx + 0x12]

        $sequence_5 = { 668945c0 e8???????? c645fc03 8b45bc 83f808 }
            // n = 5, score = 800
            //   668945c0             | mov                 word ptr [ebp - 0x40], ax
            //   e8????????           |                     
            //   c645fc03             | mov                 byte ptr [ebp - 4], 3
            //   8b45bc               | mov                 eax, dword ptr [ebp - 0x44]
            //   83f808               | cmp                 eax, 8

        $sequence_6 = { 50 e8???????? 8d4568 8d4e60 }
            // n = 4, score = 800
            //   50                   | push                eax
            //   e8????????           |                     
            //   8d4568               | lea                 eax, [ebp + 0x68]
            //   8d4e60               | lea                 ecx, [esi + 0x60]

        $sequence_7 = { 68???????? e8???????? 837e1408 7204 8b06 eb02 }
            // n = 6, score = 800
            //   68????????           |                     
            //   e8????????           |                     
            //   837e1408             | cmp                 dword ptr [esi + 0x14], 8
            //   7204                 | jb                  6
            //   8b06                 | mov                 eax, dword ptr [esi]
            //   eb02                 | jmp                 4

        $sequence_8 = { 6a00 50 8bcb e8???????? 8d4550 }
            // n = 5, score = 800
            //   6a00                 | push                0
            //   50                   | push                eax
            //   8bcb                 | mov                 ecx, ebx
            //   e8????????           |                     
            //   8d4550               | lea                 eax, [ebp + 0x50]

        $sequence_9 = { ff15???????? 50 e8???????? 59 6a64 }
            // n = 5, score = 300
            //   ff15????????         |                     
            //   50                   | push                eax
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   6a64                 | push                0x64

        $sequence_10 = { 897dfc e8???????? 68???????? 8d4dd8 }
            // n = 4, score = 200
            //   897dfc               | mov                 dword ptr [ebp - 4], edi
            //   e8????????           |                     
            //   68????????           |                     
            //   8d4dd8               | lea                 ecx, [ebp - 0x28]

        $sequence_11 = { 89442410 85c0 0f8ead010000 83f855 }
            // n = 4, score = 100
            //   89442410             | mov                 dword ptr [esp + 0x10], eax
            //   85c0                 | test                eax, eax
            //   0f8ead010000         | jle                 0x1b3
            //   83f855               | cmp                 eax, 0x55

        $sequence_12 = { 89442410 85c0 0f84c6020000 57 }
            // n = 4, score = 100
            //   89442410             | mov                 dword ptr [esp + 0x10], eax
            //   85c0                 | test                eax, eax
            //   0f84c6020000         | je                  0x2cc
            //   57                   | push                edi

        $sequence_13 = { 89442410 85c0 0f8c45010000 8baffc000000 }
            // n = 4, score = 100
            //   89442410             | mov                 dword ptr [esp + 0x10], eax
            //   85c0                 | test                eax, eax
            //   0f8c45010000         | jl                  0x14b
            //   8baffc000000         | mov                 ebp, dword ptr [edi + 0xfc]

        $sequence_14 = { 89442410 85c0 0f8483010000 833800 0f8470010000 89442428 6a01 }
            // n = 7, score = 100
            //   89442410             | mov                 dword ptr [esp + 0x10], eax
            //   85c0                 | test                eax, eax
            //   0f8483010000         | je                  0x189
            //   833800               | cmp                 dword ptr [eax], 0
            //   0f8470010000         | je                  0x176
            //   89442428             | mov                 dword ptr [esp + 0x28], eax
            //   6a01                 | push                1

        $sequence_15 = { 89442410 85c0 0f8e0c010000 83f855 0f8f36020000 }
            // n = 5, score = 100
            //   89442410             | mov                 dword ptr [esp + 0x10], eax
            //   85c0                 | test                eax, eax
            //   0f8e0c010000         | jle                 0x112
            //   83f855               | cmp                 eax, 0x55
            //   0f8f36020000         | jg                  0x23c

    condition:
        7 of them and filesize < 2932736
}