rule win_ave_maria_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.ave_maria."
        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.ave_maria"
        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 = { 5e 2bd6 8b75f4 8b7d0c 6a02 58 03c8 }
            // n = 7, score = 400
            //   5e                   | pop                 esi
            //   2bd6                 | sub                 edx, esi
            //   8b75f4               | mov                 esi, dword ptr [ebp - 0xc]
            //   8b7d0c               | mov                 edi, dword ptr [ebp + 0xc]
            //   6a02                 | push                2
            //   58                   | pop                 eax
            //   03c8                 | add                 ecx, eax

        $sequence_1 = { 6801000080 ff15???????? 85c0 7532 8d45fc c745fc04010000 50 }
            // n = 7, score = 400
            //   6801000080           | push                0x80000001
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax
            //   7532                 | jne                 0x34
            //   8d45fc               | lea                 eax, [ebp - 4]
            //   c745fc04010000       | mov                 dword ptr [ebp - 4], 0x104
            //   50                   | push                eax

        $sequence_2 = { 8b450c 8d55fc 56 52 51 33f6 }
            // n = 6, score = 400
            //   8b450c               | mov                 eax, dword ptr [ebp + 0xc]
            //   8d55fc               | lea                 edx, [ebp - 4]
            //   56                   | push                esi
            //   52                   | push                edx
            //   51                   | push                ecx
            //   33f6                 | xor                 esi, esi

        $sequence_3 = { e8???????? 8d4de0 e8???????? 5f 5e c9 c3 }
            // n = 7, score = 400
            //   e8????????           |                     
            //   8d4de0               | lea                 ecx, [ebp - 0x20]
            //   e8????????           |                     
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi
            //   c9                   | leave               
            //   c3                   | ret                 

        $sequence_4 = { 8d4ddc e8???????? 50 8d4dec e8???????? 8b4ddc e8???????? }
            // n = 7, score = 400
            //   8d4ddc               | lea                 ecx, [ebp - 0x24]
            //   e8????????           |                     
            //   50                   | push                eax
            //   8d4dec               | lea                 ecx, [ebp - 0x14]
            //   e8????????           |                     
            //   8b4ddc               | mov                 ecx, dword ptr [ebp - 0x24]
            //   e8????????           |                     

        $sequence_5 = { 55 8bec 81ec00010000 33c0 53 56 }
            // n = 6, score = 400
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp
            //   81ec00010000         | sub                 esp, 0x100
            //   33c0                 | xor                 eax, eax
            //   53                   | push                ebx
            //   56                   | push                esi

        $sequence_6 = { 56 8bf1 833e00 7505 33c0 40 }
            // n = 6, score = 400
            //   56                   | push                esi
            //   8bf1                 | mov                 esi, ecx
            //   833e00               | cmp                 dword ptr [esi], 0
            //   7505                 | jne                 7
            //   33c0                 | xor                 eax, eax
            //   40                   | inc                 eax

        $sequence_7 = { ff75e0 56 e9???????? 53 eb93 8b75ec e9???????? }
            // n = 7, score = 400
            //   ff75e0               | push                dword ptr [ebp - 0x20]
            //   56                   | push                esi
            //   e9????????           |                     
            //   53                   | push                ebx
            //   eb93                 | jmp                 0xffffff95
            //   8b75ec               | mov                 esi, dword ptr [ebp - 0x14]
            //   e9????????           |                     

        $sequence_8 = { 8b45fc 8d55f4 57 52 6a01 8b08 50 }
            // n = 7, score = 400
            //   8b45fc               | mov                 eax, dword ptr [ebp - 4]
            //   8d55f4               | lea                 edx, [ebp - 0xc]
            //   57                   | push                edi
            //   52                   | push                edx
            //   6a01                 | push                1
            //   8b08                 | mov                 ecx, dword ptr [eax]
            //   50                   | push                eax

        $sequence_9 = { 83660c00 83660800 5f 5e c3 55 8bec }
            // n = 7, score = 400
            //   83660c00             | and                 dword ptr [esi + 0xc], 0
            //   83660800             | and                 dword ptr [esi + 8], 0
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi
            //   c3                   | ret                 
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp

    condition:
        7 of them and filesize < 237568
}