rule win_mail_o_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.mail_o."
        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.mail_o"
        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 = { eb12 41b849040000 488d154eef0b00 e8???????? f6430801 488b4c2450 7416 }
            // n = 7, score = 100
            //   eb12                 | dec                 eax
            //   41b849040000         | lea                 edx, [0x11df76]
            //   488d154eef0b00       | inc                 ecx
            //   e8????????           |                     
            //   f6430801             | mov                 eax, 0x25
            //   488b4c2450           | dec                 eax
            //   7416                 | mov                 ecx, ebx

        $sequence_1 = { e8???????? 85c0 7513 c744242010010000 41b8a3000000 e9???????? 488b06 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   85c0                 | lea                 edx, [0x1339bb]
            //   7513                 | inc                 ecx
            //   c744242010010000     | mov                 eax, 0x55
            //   41b8a3000000         | dec                 eax
            //   e9????????           |                     
            //   488b06               | mov                 ecx, ebx

        $sequence_2 = { 7504 8bda eb09 488b442450 48635820 488d052dd50b00 4a8b04f8 }
            // n = 7, score = 100
            //   7504                 | dec                 eax
            //   8bda                 | add                 esp, 0x30
            //   eb09                 | inc                 ecx
            //   488b442450           | pop                 edi
            //   48635820             | inc                 ecx
            //   488d052dd50b00       | mov                 byte ptr [ebx], al
            //   4a8b04f8             | dec                 ecx

        $sequence_3 = { eb2f c7839800000002000000 b880020000 41b870000000 eb18 b85a020000 41b866000000 }
            // n = 7, score = 100
            //   eb2f                 | mov                 ecx, dword ptr [ebx + 0x500]
            //   c7839800000002000000     | mov    dword ptr [ebx + 0xc8], 1
            //   b880020000           | dec                 eax
            //   41b870000000         | mov                 dword ptr [ecx + 0x1f8], eax
            //   eb18                 | dec                 eax
            //   b85a020000           | mov                 eax, dword ptr [ebx + 0x500]
            //   41b866000000         | dec                 eax

        $sequence_4 = { eb5d 4d85d2 740f c744242885070000 ba32000000 eb43 83b9ec06000000 }
            // n = 7, score = 100
            //   eb5d                 | je                  0x14c7
            //   4d85d2               | dec                 eax
            //   740f                 | mov                 eax, dword ptr [ebx + 0xa8]
            //   c744242885070000     | test                dword ptr [eax], 0x100
            //   ba32000000           | jne                 0x156a
            //   eb43                 | dec                 eax
            //   83b9ec06000000       | mov                 ecx, dword ptr [ebx + 0x448]

        $sequence_5 = { eb5a c7442428a10d0000 ba50000000 41b9f9000000 41b87e010000 48896c2420 e8???????? }
            // n = 7, score = 100
            //   eb5a                 | dec                 eax
            //   c7442428a10d0000     | lea                 ecx, [ebx + 0x800]
            //   ba50000000           | dec                 eax
            //   41b9f9000000         | mov                 eax, dword ptr [ebx + 0xa8]
            //   41b87e010000         | mov                 dword ptr [eax + 0xf4], edi
            //   48896c2420           | mov                 dword ptr [ebx + 0xd80], esi
            //   e8????????           |                     

        $sequence_6 = { 488d0d13951500 eb92 488d1512961500 488d4c2440 e8???????? 85c0 0f84da000000 }
            // n = 7, score = 100
            //   488d0d13951500       | mov                 ecx, ebx
            //   eb92                 | inc                 esp
            //   488d1512961500       | mov                 ecx, ebp
            //   488d4c2440           | dec                 esp
            //   e8????????           |                     
            //   85c0                 | lea                 eax, [0x1119fe]
            //   0f84da000000         | mov                 edx, 0xd

        $sequence_7 = { 898ab4000000 8bce c1e903 33c8 418bc3 338c24a0000000 898ab8000000 }
            // n = 7, score = 100
            //   898ab4000000         | dec                 eax
            //   8bce                 | arpl                dx, di
            //   c1e903               | dec                 eax
            //   33c8                 | mov                 ebx, ecx
            //   418bc3               | cmp                 edi, dword ptr [ecx + 0xc]
            //   338c24a0000000       | jle                 0xafd
            //   898ab8000000         | cmp                 edi, 0x7fffff

        $sequence_8 = { c7870802000001000000 eb30 c7870802000002000000 eb14 483bce 7407 b837000000 }
            // n = 7, score = 100
            //   c7870802000001000000     | mov    dword ptr [edi + 4], eax
            //   eb30                 | inc                 ecx
            //   c7870802000002000000     | mov    ebx, dword ptr [esi]
            //   eb14                 | dec                 eax
            //   483bce               | mov                 dword ptr [esp + 0x50], ebx
            //   7407                 | dec                 eax
            //   b837000000           | cmp                 dword ptr [esp + 0x50], ebx

        $sequence_9 = { e9???????? 8b8784010000 898380100000 488b87e8030000 b905000000 4c89a42450010000 f6407c07 }
            // n = 7, score = 100
            //   e9????????           |                     
            //   8b8784010000         | dec                 eax
            //   898380100000         | mov                 edx, edi
            //   488b87e8030000       | dec                 esp
            //   b905000000           | lea                 eax, [esi + 0x1208]
            //   4c89a42450010000     | dec                 ecx
            //   f6407c07             | mov                 ecx, esi

    condition:
        7 of them and filesize < 5985280
}