rule win_fatal_rat_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.fatal_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.fatal_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 = { 833d????????01 755c 68???????? 8d8530feffff ff35???????? 68???????? }
            // n = 6, score = 100
            //   833d????????01       |                     
            //   755c                 | jne                 0x5e
            //   68????????           |                     
            //   8d8530feffff         | lea                 eax, [ebp - 0x1d0]
            //   ff35????????         |                     
            //   68????????           |                     

        $sequence_1 = { 804dfa80 53 57 ff15???????? 83f828 8945f0 0f8687000000 }
            // n = 7, score = 100
            //   804dfa80             | or                  byte ptr [ebp - 6], 0x80
            //   53                   | push                ebx
            //   57                   | push                edi
            //   ff15????????         |                     
            //   83f828               | cmp                 eax, 0x28
            //   8945f0               | mov                 dword ptr [ebp - 0x10], eax
            //   0f8687000000         | jbe                 0x8d

        $sequence_2 = { ff750c 43 53 50 ff15???????? 6a01 57 }
            // n = 7, score = 100
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   43                   | inc                 ebx
            //   53                   | push                ebx
            //   50                   | push                eax
            //   ff15????????         |                     
            //   6a01                 | push                1
            //   57                   | push                edi

        $sequence_3 = { 8988bc160000 8b149df4d30110 85d2 0f8484000000 8b0c9d38dd0110 be10000000 2bf9 }
            // n = 7, score = 100
            //   8988bc160000         | mov                 dword ptr [eax + 0x16bc], ecx
            //   8b149df4d30110       | mov                 edx, dword ptr [ebx*4 + 0x1001d3f4]
            //   85d2                 | test                edx, edx
            //   0f8484000000         | je                  0x8a
            //   8b0c9d38dd0110       | mov                 ecx, dword ptr [ebx*4 + 0x1001dd38]
            //   be10000000           | mov                 esi, 0x10
            //   2bf9                 | sub                 edi, ecx

        $sequence_4 = { 33c9 668b88d8d20110 898a8c000000 33c9 668b88dcd20110 898a90000000 33c9 }
            // n = 7, score = 100
            //   33c9                 | xor                 ecx, ecx
            //   668b88d8d20110       | mov                 cx, word ptr [eax + 0x1001d2d8]
            //   898a8c000000         | mov                 dword ptr [edx + 0x8c], ecx
            //   33c9                 | xor                 ecx, ecx
            //   668b88dcd20110       | mov                 cx, word ptr [eax + 0x1001d2dc]
            //   898a90000000         | mov                 dword ptr [edx + 0x90], ecx
            //   33c9                 | xor                 ecx, ecx

        $sequence_5 = { 59 f3ab 8d85bcfdffff c745d0b8410210 8945d4 8d45c4 50 }
            // n = 7, score = 100
            //   59                   | pop                 ecx
            //   f3ab                 | rep stosd           dword ptr es:[edi], eax
            //   8d85bcfdffff         | lea                 eax, [ebp - 0x244]
            //   c745d0b8410210       | mov                 dword ptr [ebp - 0x30], 0x100241b8
            //   8945d4               | mov                 dword ptr [ebp - 0x2c], eax
            //   8d45c4               | lea                 eax, [ebp - 0x3c]
            //   50                   | push                eax

        $sequence_6 = { c20400 6aff ff714c ff15???????? c3 8a4153 }
            // n = 6, score = 100
            //   c20400               | ret                 4
            //   6aff                 | push                -1
            //   ff714c               | push                dword ptr [ecx + 0x4c]
            //   ff15????????         |                     
            //   c3                   | ret                 
            //   8a4153               | mov                 al, byte ptr [ecx + 0x53]

        $sequence_7 = { 7e15 83fe5d 7d10 c784b5a4f9ffff01000000 e9???????? 6a14 ff15???????? }
            // n = 7, score = 100
            //   7e15                 | jle                 0x17
            //   83fe5d               | cmp                 esi, 0x5d
            //   7d10                 | jge                 0x12
            //   c784b5a4f9ffff01000000     | mov    dword ptr [ebp + esi*4 - 0x65c], 1
            //   e9????????           |                     
            //   6a14                 | push                0x14
            //   ff15????????         |                     

        $sequence_8 = { 33db a5 a5 53 8d8520feffff 6a2e 50 }
            // n = 7, score = 100
            //   33db                 | xor                 ebx, ebx
            //   a5                   | movsd               dword ptr es:[edi], dword ptr [esi]
            //   a5                   | movsd               dword ptr es:[edi], dword ptr [esi]
            //   53                   | push                ebx
            //   8d8520feffff         | lea                 eax, [ebp - 0x1e0]
            //   6a2e                 | push                0x2e
            //   50                   | push                eax

        $sequence_9 = { 68???????? 50 894618 ffd7 68???????? 898660010000 ff7618 }
            // n = 7, score = 100
            //   68????????           |                     
            //   50                   | push                eax
            //   894618               | mov                 dword ptr [esi + 0x18], eax
            //   ffd7                 | call                edi
            //   68????????           |                     
            //   898660010000         | mov                 dword ptr [esi + 0x160], eax
            //   ff7618               | push                dword ptr [esi + 0x18]

    condition:
        7 of them and filesize < 344064
}