rule win_invisimole_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.invisimole."
        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.invisimole"
        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 = { 8b4df0 52 51 68???????? 50 ff15???????? 83c410 }
            // n = 7, score = 100
            //   8b4df0               | mov                 ecx, dword ptr [ebp - 0x10]
            //   52                   | push                edx
            //   51                   | push                ecx
            //   68????????           |                     
            //   50                   | push                eax
            //   ff15????????         |                     
            //   83c410               | add                 esp, 0x10

        $sequence_1 = { 50 33c9 57 c745f02e007400 }
            // n = 4, score = 100
            //   50                   | push                eax
            //   33c9                 | xor                 ecx, ecx
            //   57                   | push                edi
            //   c745f02e007400       | mov                 dword ptr [ebp - 0x10], 0x74002e

        $sequence_2 = { 7418 8b8dacfeffff 8b3d???????? 51 ffd7 8b95b0feffff 52 }
            // n = 7, score = 100
            //   7418                 | je                  0x1a
            //   8b8dacfeffff         | mov                 ecx, dword ptr [ebp - 0x154]
            //   8b3d????????         |                     
            //   51                   | push                ecx
            //   ffd7                 | call                edi
            //   8b95b0feffff         | mov                 edx, dword ptr [ebp - 0x150]
            //   52                   | push                edx

        $sequence_3 = { 8b4dd0 8d45f4 50 33f6 56 51 }
            // n = 6, score = 100
            //   8b4dd0               | mov                 ecx, dword ptr [ebp - 0x30]
            //   8d45f4               | lea                 eax, [ebp - 0xc]
            //   50                   | push                eax
            //   33f6                 | xor                 esi, esi
            //   56                   | push                esi
            //   51                   | push                ecx

        $sequence_4 = { 0f8484010000 8b4514 8b4d10 50 }
            // n = 4, score = 100
            //   0f8484010000         | je                  0x18a
            //   8b4514               | mov                 eax, dword ptr [ebp + 0x14]
            //   8b4d10               | mov                 ecx, dword ptr [ebp + 0x10]
            //   50                   | push                eax

        $sequence_5 = { 52 b802000000 e8???????? 33c9 83c408 }
            // n = 5, score = 100
            //   52                   | push                edx
            //   b802000000           | mov                 eax, 2
            //   e8????????           |                     
            //   33c9                 | xor                 ecx, ecx
            //   83c408               | add                 esp, 8

        $sequence_6 = { 56 88550b e8???????? 8b4d0c 6a01 8d550b 52 }
            // n = 7, score = 100
            //   56                   | push                esi
            //   88550b               | mov                 byte ptr [ebp + 0xb], dl
            //   e8????????           |                     
            //   8b4d0c               | mov                 ecx, dword ptr [ebp + 0xc]
            //   6a01                 | push                1
            //   8d550b               | lea                 edx, [ebp + 0xb]
            //   52                   | push                edx

        $sequence_7 = { 8b5d08 e9???????? 394dfc 0f84a50b0000 }
            // n = 4, score = 100
            //   8b5d08               | mov                 ebx, dword ptr [ebp + 8]
            //   e9????????           |                     
            //   394dfc               | cmp                 dword ptr [ebp - 4], ecx
            //   0f84a50b0000         | je                  0xbab

        $sequence_8 = { 5b 5d c3 8b15???????? 6a08 6a08 52 }
            // n = 7, score = 100
            //   5b                   | pop                 ebx
            //   5d                   | pop                 ebp
            //   c3                   | ret                 
            //   8b15????????         |                     
            //   6a08                 | push                8
            //   6a08                 | push                8
            //   52                   | push                edx

        $sequence_9 = { a1???????? 50 ffd7 8bf0 89742434 85f6 0f844b010000 }
            // n = 7, score = 100
            //   a1????????           |                     
            //   50                   | push                eax
            //   ffd7                 | call                edi
            //   8bf0                 | mov                 esi, eax
            //   89742434             | mov                 dword ptr [esp + 0x34], esi
            //   85f6                 | test                esi, esi
            //   0f844b010000         | je                  0x151

    condition:
        7 of them and filesize < 139264
}