rule win_maggie_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.maggie."
        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.maggie"
        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 = { 663b05???????? 7505 e8???????? e8???????? }
            // n = 4, score = 300
            //   663b05????????       |                     
            //   7505                 | mov                 ecx, eax
            //   e8????????           |                     
            //   e8????????           |                     

        $sequence_1 = { ff15???????? 83f8ff 750f ff15???????? 2d33270000 f7d8 }
            // n = 6, score = 300
            //   ff15????????         |                     
            //   83f8ff               | mov                 eax, dword ptr [esp + 0xb78]
            //   750f                 | mov                 edx, 0x200
            //   ff15????????         |                     
            //   2d33270000           | dec                 eax
            //   f7d8                 | lea                 ecx, [esp + 0x940]

        $sequence_2 = { 750f ff15???????? 2d33270000 f7d8 }
            // n = 4, score = 300
            //   750f                 | mov                 dword ptr [esp + 0x18], eax
            //   ff15????????         |                     
            //   2d33270000           | dec                 esp
            //   f7d8                 | mov                 dword ptr [esp + 0x20], ecx

        $sequence_3 = { ff15???????? 83f8ff 750f ff15???????? 2d33270000 }
            // n = 5, score = 300
            //   ff15????????         |                     
            //   83f8ff               | dec                 eax
            //   750f                 | and                 dword ptr [ebx], 0
            //   ff15????????         |                     
            //   2d33270000           | dec                 eax

        $sequence_4 = { 750f ff15???????? 2d33270000 f7d8 1bc0 }
            // n = 5, score = 300
            //   750f                 | lea                 edx, [0x25034]
            //   ff15????????         |                     
            //   2d33270000           | dec                 eax
            //   f7d8                 | mov                 ecx, esi
            //   1bc0                 | xor                 al, al

        $sequence_5 = { b8ff000000 663b05???????? 7505 e8???????? e8???????? }
            // n = 5, score = 300
            //   b8ff000000           | mov                 dword ptr [esp + 0x28], eax
            //   663b05????????       |                     
            //   7505                 | dec                 esp
            //   e8????????           |                     
            //   e8????????           |                     

        $sequence_6 = { ff15???????? e8???????? 84c0 74ec e8???????? e8???????? }
            // n = 6, score = 300
            //   ff15????????         |                     
            //   e8????????           |                     
            //   84c0                 | dec                 eax
            //   74ec                 | mov                 dword ptr [esp + 0x20], eax
            //   e8????????           |                     
            //   e8????????           |                     

        $sequence_7 = { ff15???????? 83f8ff 750f ff15???????? 2d33270000 f7d8 1bc0 }
            // n = 7, score = 300
            //   ff15????????         |                     
            //   83f8ff               | cmp                 eax, -1
            //   750f                 | inc                 ebp
            //   ff15????????         |                     
            //   2d33270000           | cmovne              esp, ebp
            //   f7d8                 | mov                 eax, dword ptr [esp + 0x30]
            //   1bc0                 | dec                 eax

        $sequence_8 = { 7511 ff15???????? 85c0 7407 33c0 }
            // n = 5, score = 300
            //   7511                 | dec                 eax
            //   ff15????????         |                     
            //   85c0                 | mov                 ecx, esi
            //   7407                 | dec                 eax
            //   33c0                 | lea                 edx, [esp + 0x40]

        $sequence_9 = { 83f8ff 750f ff15???????? 2d33270000 }
            // n = 4, score = 300
            //   83f8ff               | dec                 esp
            //   750f                 | lea                 eax, [0x26280]
            //   ff15????????         |                     
            //   2d33270000           | dec                 eax

    condition:
        7 of them and filesize < 611328
}