rule win_mailto_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.mailto."
        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.mailto"
        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 = { 89742418 6689442416 e8???????? 6a01 8d4c2418 51 8b4058 }
            // n = 7, score = 400
            //   89742418             | mov                 dword ptr [esp + 0x18], esi
            //   6689442416           | mov                 word ptr [esp + 0x16], ax
            //   e8????????           |                     
            //   6a01                 | push                1
            //   8d4c2418             | lea                 ecx, [esp + 0x18]
            //   51                   | push                ecx
            //   8b4058               | mov                 eax, dword ptr [eax + 0x58]

        $sequence_1 = { 51 ff742434 8d4c2434 51 }
            // n = 4, score = 400
            //   51                   | push                ecx
            //   ff742434             | push                dword ptr [esp + 0x34]
            //   8d4c2434             | lea                 ecx, [esp + 0x34]
            //   51                   | push                ecx

        $sequence_2 = { 885c2412 85ed 0f847d000000 8d4e32 0f1f440000 }
            // n = 5, score = 400
            //   885c2412             | mov                 byte ptr [esp + 0x12], bl
            //   85ed                 | test                ebp, ebp
            //   0f847d000000         | je                  0x83
            //   8d4e32               | lea                 ecx, [esi + 0x32]
            //   0f1f440000           | nop                 dword ptr [eax + eax]

        $sequence_3 = { e8???????? 83c404 5d 53 e8???????? 83c404 5b }
            // n = 7, score = 400
            //   e8????????           |                     
            //   83c404               | add                 esp, 4
            //   5d                   | pop                 ebp
            //   53                   | push                ebx
            //   e8????????           |                     
            //   83c404               | add                 esp, 4
            //   5b                   | pop                 ebx

        $sequence_4 = { 33c0 5b 83c410 c3 8b442410 8b4c241c 8b5078 }
            // n = 7, score = 400
            //   33c0                 | xor                 eax, eax
            //   5b                   | pop                 ebx
            //   83c410               | add                 esp, 0x10
            //   c3                   | ret                 
            //   8b442410             | mov                 eax, dword ptr [esp + 0x10]
            //   8b4c241c             | mov                 ecx, dword ptr [esp + 0x1c]
            //   8b5078               | mov                 edx, dword ptr [eax + 0x78]

        $sequence_5 = { 33c0 5e c3 8d46ff 5e c3 8d44240c }
            // n = 7, score = 400
            //   33c0                 | xor                 eax, eax
            //   5e                   | pop                 esi
            //   c3                   | ret                 
            //   8d46ff               | lea                 eax, [esi - 1]
            //   5e                   | pop                 esi
            //   c3                   | ret                 
            //   8d44240c             | lea                 eax, [esp + 0xc]

        $sequence_6 = { 55 56 57 e8???????? 83c40c 85c0 741a }
            // n = 7, score = 400
            //   55                   | push                ebp
            //   56                   | push                esi
            //   57                   | push                edi
            //   e8????????           |                     
            //   83c40c               | add                 esp, 0xc
            //   85c0                 | test                eax, eax
            //   741a                 | je                  0x1c

        $sequence_7 = { 83c40c c7400c01000000 8d4704 5f 5e 5b c3 }
            // n = 7, score = 400
            //   83c40c               | add                 esp, 0xc
            //   c7400c01000000       | mov                 dword ptr [eax + 0xc], 1
            //   8d4704               | lea                 eax, [edi + 4]
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi
            //   5b                   | pop                 ebx
            //   c3                   | ret                 

        $sequence_8 = { 75d1 8b6c2414 55 e8???????? 8b6c242c 83c404 }
            // n = 6, score = 400
            //   75d1                 | jne                 0xffffffd3
            //   8b6c2414             | mov                 ebp, dword ptr [esp + 0x14]
            //   55                   | push                ebp
            //   e8????????           |                     
            //   8b6c242c             | mov                 ebp, dword ptr [esp + 0x2c]
            //   83c404               | add                 esp, 4

        $sequence_9 = { 89842484000000 8944246c 8b442420 03c5 c1c707 33d0 897c2410 }
            // n = 7, score = 400
            //   89842484000000       | mov                 dword ptr [esp + 0x84], eax
            //   8944246c             | mov                 dword ptr [esp + 0x6c], eax
            //   8b442420             | mov                 eax, dword ptr [esp + 0x20]
            //   03c5                 | add                 eax, ebp
            //   c1c707               | rol                 edi, 7
            //   33d0                 | xor                 edx, eax
            //   897c2410             | mov                 dword ptr [esp + 0x10], edi

    condition:
        7 of them and filesize < 180224
}