rule win_bit_rat_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.bit_rat."
        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.bit_rat"
        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 = { e8???????? 83c40c 85c0 789f e9???????? 55 8bec }
            // n = 7, score = 200
            //   e8????????           |                     
            //   83c40c               | add                 esp, 0xc
            //   85c0                 | test                eax, eax
            //   789f                 | js                  0xffffffa1
            //   e9????????           |                     
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp

        $sequence_1 = { e8???????? 59 50 8d8550ffffff 50 8d4dd4 e8???????? }
            // n = 7, score = 200
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   50                   | push                eax
            //   8d8550ffffff         | lea                 eax, [ebp - 0xb0]
            //   50                   | push                eax
            //   8d4dd4               | lea                 ecx, [ebp - 0x2c]
            //   e8????????           |                     

        $sequence_2 = { 8b442404 56 8b700c 7556 8b442414 83f803 753d }
            // n = 7, score = 200
            //   8b442404             | mov                 eax, dword ptr [esp + 4]
            //   56                   | push                esi
            //   8b700c               | mov                 esi, dword ptr [eax + 0xc]
            //   7556                 | jne                 0x58
            //   8b442414             | mov                 eax, dword ptr [esp + 0x14]
            //   83f803               | cmp                 eax, 3
            //   753d                 | jne                 0x3f

        $sequence_3 = { e8???????? b8???????? e9???????? 8d4d68 e9???????? 8d4d48 e9???????? }
            // n = 7, score = 200
            //   e8????????           |                     
            //   b8????????           |                     
            //   e9????????           |                     
            //   8d4d68               | lea                 ecx, [ebp + 0x68]
            //   e9????????           |                     
            //   8d4d48               | lea                 ecx, [ebp + 0x48]
            //   e9????????           |                     

        $sequence_4 = { e9???????? 8b4df0 83c134 e9???????? 8b4df0 81c188000000 e9???????? }
            // n = 7, score = 200
            //   e9????????           |                     
            //   8b4df0               | mov                 ecx, dword ptr [ebp - 0x10]
            //   83c134               | add                 ecx, 0x34
            //   e9????????           |                     
            //   8b4df0               | mov                 ecx, dword ptr [ebp - 0x10]
            //   81c188000000         | add                 ecx, 0x88
            //   e9????????           |                     

        $sequence_5 = { c3 6a00 6a00 6a06 6802020000 6a50 57 }
            // n = 7, score = 200
            //   c3                   | ret                 
            //   6a00                 | push                0
            //   6a00                 | push                0
            //   6a06                 | push                6
            //   6802020000           | push                0x202
            //   6a50                 | push                0x50
            //   57                   | push                edi

        $sequence_6 = { c1e810 83e20f 8945f4 3bfa 732b 8b45f8 8bcf }
            // n = 7, score = 200
            //   c1e810               | shr                 eax, 0x10
            //   83e20f               | and                 edx, 0xf
            //   8945f4               | mov                 dword ptr [ebp - 0xc], eax
            //   3bfa                 | cmp                 edi, edx
            //   732b                 | jae                 0x2d
            //   8b45f8               | mov                 eax, dword ptr [ebp - 8]
            //   8bcf                 | mov                 ecx, edi

        $sequence_7 = { 837d1008 0f826f020000 8b5508 8b4d0c 8b02 8901 8b4204 }
            // n = 7, score = 200
            //   837d1008             | cmp                 dword ptr [ebp + 0x10], 8
            //   0f826f020000         | jb                  0x275
            //   8b5508               | mov                 edx, dword ptr [ebp + 8]
            //   8b4d0c               | mov                 ecx, dword ptr [ebp + 0xc]
            //   8b02                 | mov                 eax, dword ptr [edx]
            //   8901                 | mov                 dword ptr [ecx], eax
            //   8b4204               | mov                 eax, dword ptr [edx + 4]

        $sequence_8 = { ff7508 e8???????? 59 85c0 7527 68???????? 8d4de8 }
            // n = 7, score = 200
            //   ff7508               | push                dword ptr [ebp + 8]
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   85c0                 | test                eax, eax
            //   7527                 | jne                 0x29
            //   68????????           |                     
            //   8d4de8               | lea                 ecx, [ebp - 0x18]

        $sequence_9 = { e9???????? 6a00 6a00 6a6e 68f9010000 6a50 56 }
            // n = 7, score = 200
            //   e9????????           |                     
            //   6a00                 | push                0
            //   6a00                 | push                0
            //   6a6e                 | push                0x6e
            //   68f9010000           | push                0x1f9
            //   6a50                 | push                0x50
            //   56                   | push                esi

    condition:
        7 of them and filesize < 19405824
}