rule win_netsupportmanager_rat_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.netsupportmanager_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.netsupportmanager_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???????? 83ff01 8d4660 0f94c2 50 8d4dd8 c745fc00000000 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   83ff01               | cmp                 edi, 1
            //   8d4660               | lea                 eax, [esi + 0x60]
            //   0f94c2               | sete                dl
            //   50                   | push                eax
            //   8d4dd8               | lea                 ecx, [ebp - 0x28]
            //   c745fc00000000       | mov                 dword ptr [ebp - 4], 0

        $sequence_1 = { e8???????? 8b8bb8000000 51 8bce e8???????? 8b4df4 5f }
            // n = 7, score = 100
            //   e8????????           |                     
            //   8b8bb8000000         | mov                 ecx, dword ptr [ebx + 0xb8]
            //   51                   | push                ecx
            //   8bce                 | mov                 ecx, esi
            //   e8????????           |                     
            //   8b4df4               | mov                 ecx, dword ptr [ebp - 0xc]
            //   5f                   | pop                 edi

        $sequence_2 = { ff15???????? 85c0 7429 8b4b0c 8b5510 8b06 51 }
            // n = 7, score = 100
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax
            //   7429                 | je                  0x2b
            //   8b4b0c               | mov                 ecx, dword ptr [ebx + 0xc]
            //   8b5510               | mov                 edx, dword ptr [ebp + 0x10]
            //   8b06                 | mov                 eax, dword ptr [esi]
            //   51                   | push                ecx

        $sequence_3 = { ff15???????? 6a02 56 ff15???????? 8bf0 85f6 75e0 }
            // n = 7, score = 100
            //   ff15????????         |                     
            //   6a02                 | push                2
            //   56                   | push                esi
            //   ff15????????         |                     
            //   8bf0                 | mov                 esi, eax
            //   85f6                 | test                esi, esi
            //   75e0                 | jne                 0xffffffe2

        $sequence_4 = { e8???????? 8b4df8 83c418 51 ff15???????? 8b5514 8b4dfc }
            // n = 7, score = 100
            //   e8????????           |                     
            //   8b4df8               | mov                 ecx, dword ptr [ebp - 8]
            //   83c418               | add                 esp, 0x18
            //   51                   | push                ecx
            //   ff15????????         |                     
            //   8b5514               | mov                 edx, dword ptr [ebp + 0x14]
            //   8b4dfc               | mov                 ecx, dword ptr [ebp - 4]

        $sequence_5 = { ff9254010000 8b839c000000 85c0 757f 8b4b0c 83e10f 80f905 }
            // n = 7, score = 100
            //   ff9254010000         | call                dword ptr [edx + 0x154]
            //   8b839c000000         | mov                 eax, dword ptr [ebx + 0x9c]
            //   85c0                 | test                eax, eax
            //   757f                 | jne                 0x81
            //   8b4b0c               | mov                 ecx, dword ptr [ebx + 0xc]
            //   83e10f               | and                 ecx, 0xf
            //   80f905               | cmp                 cl, 5

        $sequence_6 = { ff15???????? 8bd8 8a4510 4b 83cb01 a801 7426 }
            // n = 7, score = 100
            //   ff15????????         |                     
            //   8bd8                 | mov                 ebx, eax
            //   8a4510               | mov                 al, byte ptr [ebp + 0x10]
            //   4b                   | dec                 ebx
            //   83cb01               | or                  ebx, 1
            //   a801                 | test                al, 1
            //   7426                 | je                  0x28

        $sequence_7 = { ff90c8000000 85c0 740f ff15???????? 48 0c01 89864c020000 }
            // n = 7, score = 100
            //   ff90c8000000         | call                dword ptr [eax + 0xc8]
            //   85c0                 | test                eax, eax
            //   740f                 | je                  0x11
            //   ff15????????         |                     
            //   48                   | dec                 eax
            //   0c01                 | or                  al, 1
            //   89864c020000         | mov                 dword ptr [esi + 0x24c], eax

        $sequence_8 = { f7d1 49 7434 bf???????? 83c9ff f2ae f7d1 }
            // n = 7, score = 100
            //   f7d1                 | not                 ecx
            //   49                   | dec                 ecx
            //   7434                 | je                  0x36
            //   bf????????           |                     
            //   83c9ff               | or                  ecx, 0xffffffff
            //   f2ae                 | repne scasb         al, byte ptr es:[edi]
            //   f7d1                 | not                 ecx

        $sequence_9 = { e8???????? 8b9684000000 8bce 52 6877040000 e8???????? 8b8688000000 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   8b9684000000         | mov                 edx, dword ptr [esi + 0x84]
            //   8bce                 | mov                 ecx, esi
            //   52                   | push                edx
            //   6877040000           | push                0x477
            //   e8????????           |                     
            //   8b8688000000         | mov                 eax, dword ptr [esi + 0x88]

    condition:
        7 of them and filesize < 4734976
}