rule win_whispergate_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.whispergate."
        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.whispergate"
        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 = { 892c24 e8???????? 89f2 89e8 e8???????? 83f8ff 898610010000 }
            // n = 7, score = 300
            //   892c24               | mov                 dword ptr [esp], ebp
            //   e8????????           |                     
            //   89f2                 | mov                 edx, esi
            //   89e8                 | mov                 eax, ebp
            //   e8????????           |                     
            //   83f8ff               | cmp                 eax, -1
            //   898610010000         | mov                 dword ptr [esi + 0x110], eax

        $sequence_1 = { ffd6 a1???????? 85c0 743a }
            // n = 4, score = 300
            //   ffd6                 | call                esi
            //   a1????????           |                     
            //   85c0                 | test                eax, eax
            //   743a                 | je                  0x3c

        $sequence_2 = { 8b54241c 29c6 85f6 0f8483000000 89d0 }
            // n = 5, score = 300
            //   8b54241c             | mov                 edx, dword ptr [esp + 0x1c]
            //   29c6                 | sub                 esi, eax
            //   85f6                 | test                esi, esi
            //   0f8483000000         | je                  0x89
            //   89d0                 | mov                 eax, edx

        $sequence_3 = { 8d7c240c 893c24 89442404 e8???????? 31c9 }
            // n = 5, score = 300
            //   8d7c240c             | lea                 edi, [esp + 0xc]
            //   893c24               | mov                 dword ptr [esp], edi
            //   89442404             | mov                 dword ptr [esp + 4], eax
            //   e8????????           |                     
            //   31c9                 | xor                 ecx, ecx

        $sequence_4 = { 83d803 29f8 ba2a000000 89fb 66891407 }
            // n = 5, score = 300
            //   83d803               | sbb                 eax, 3
            //   29f8                 | sub                 eax, edi
            //   ba2a000000           | mov                 edx, 0x2a
            //   89fb                 | mov                 ebx, edi
            //   66891407             | mov                 word ptr [edi + eax], dx

        $sequence_5 = { 5e 5f 5d c3 0fbe57ff 85d2 }
            // n = 6, score = 300
            //   5e                   | pop                 esi
            //   5f                   | pop                 edi
            //   5d                   | pop                 ebp
            //   c3                   | ret                 
            //   0fbe57ff             | movsx               edx, byte ptr [edi - 1]
            //   85d2                 | test                edx, edx

        $sequence_6 = { 0f8581000000 8b0d???????? bb???????? 85c9 0f84be000000 bb???????? 8b4308 }
            // n = 7, score = 300
            //   0f8581000000         | jne                 0x87
            //   8b0d????????         |                     
            //   bb????????           |                     
            //   85c9                 | test                ecx, ecx
            //   0f84be000000         | je                  0xc4
            //   bb????????           |                     
            //   8b4308               | mov                 eax, dword ptr [ebx + 8]

        $sequence_7 = { e9???????? 8b5508 89f0 e8???????? e9???????? c745c000000000 e9???????? }
            // n = 7, score = 300
            //   e9????????           |                     
            //   8b5508               | mov                 edx, dword ptr [ebp + 8]
            //   89f0                 | mov                 eax, esi
            //   e8????????           |                     
            //   e9????????           |                     
            //   c745c000000000       | mov                 dword ptr [ebp - 0x40], 0
            //   e9????????           |                     

        $sequence_8 = { 895c2408 c74424041c000000 c70424???????? e8???????? a1???????? }
            // n = 5, score = 300
            //   895c2408             | mov                 dword ptr [esp + 8], ebx
            //   c74424041c000000     | mov                 dword ptr [esp + 4], 0x1c
            //   c70424????????       |                     
            //   e8????????           |                     
            //   a1????????           |                     

        $sequence_9 = { c706???????? 893424 8b4d10 89fa 89d8 e8???????? }
            // n = 6, score = 300
            //   c706????????         |                     
            //   893424               | mov                 dword ptr [esp], esi
            //   8b4d10               | mov                 ecx, dword ptr [ebp + 0x10]
            //   89fa                 | mov                 edx, edi
            //   89d8                 | mov                 eax, ebx
            //   e8????????           |                     

    condition:
        7 of them and filesize < 114688
}