rule win_ave_maria_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-05-04"
        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 = "20260422"
        malpedia_hash = "a182e35da64e6d71cb55f125c4d4225196523f14"
        malpedia_version = "20260504"
        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 = { 6aff ff30 6a00 68e9fd0000 ff15???????? 53 8d4dfc }
            // n = 7, score = 400
            //   6aff                 | push                -1
            //   ff30                 | push                dword ptr [eax]
            //   6a00                 | push                0
            //   68e9fd0000           | push                0xfde9
            //   ff15????????         |                     
            //   53                   | push                ebx
            //   8d4dfc               | lea                 ecx, [ebp - 4]

        $sequence_1 = { 6a08 59 e8???????? 8bf0 85f6 743e c706???????? }
            // n = 7, score = 400
            //   6a08                 | push                8
            //   59                   | pop                 ecx
            //   e8????????           |                     
            //   8bf0                 | mov                 esi, eax
            //   85f6                 | test                esi, esi
            //   743e                 | je                  0x40
            //   c706????????         |                     

        $sequence_2 = { 7e4c 6a05 ff75fc ff5754 6a05 ff75fc 8945b0 }
            // n = 7, score = 400
            //   7e4c                 | jle                 0x4e
            //   6a05                 | push                5
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   ff5754               | call                dword ptr [edi + 0x54]
            //   6a05                 | push                5
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   8945b0               | mov                 dword ptr [ebp - 0x50], eax

        $sequence_3 = { 55 8bec 51 57 8bf9 8d5710 e8???????? }
            // n = 7, score = 400
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp
            //   51                   | push                ecx
            //   57                   | push                edi
            //   8bf9                 | mov                 edi, ecx
            //   8d5710               | lea                 edx, [edi + 0x10]
            //   e8????????           |                     

        $sequence_4 = { 7406 51 e8???????? 8b4df0 890b 897304 eb02 }
            // n = 7, score = 400
            //   7406                 | je                  8
            //   51                   | push                ecx
            //   e8????????           |                     
            //   8b4df0               | mov                 ecx, dword ptr [ebp - 0x10]
            //   890b                 | mov                 dword ptr [ebx], ecx
            //   897304               | mov                 dword ptr [ebx + 4], esi
            //   eb02                 | jmp                 4

        $sequence_5 = { 0bcb e8???????? 85c0 741d 8930 8d4804 }
            // n = 6, score = 400
            //   0bcb                 | or                  ecx, ebx
            //   e8????????           |                     
            //   85c0                 | test                eax, eax
            //   741d                 | je                  0x1f
            //   8930                 | mov                 dword ptr [eax], esi
            //   8d4804               | lea                 ecx, [eax + 4]

        $sequence_6 = { 83c204 e8???????? 59 50 8d4e04 e8???????? 8b4d08 }
            // n = 7, score = 400
            //   83c204               | add                 edx, 4
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   50                   | push                eax
            //   8d4e04               | lea                 ecx, [esi + 4]
            //   e8????????           |                     
            //   8b4d08               | mov                 ecx, dword ptr [ebp + 8]

        $sequence_7 = { 8bca 0fbf07 99 0fa4c210 c1e010 03f0 8b45fc }
            // n = 7, score = 400
            //   8bca                 | mov                 ecx, edx
            //   0fbf07               | movsx               eax, word ptr [edi]
            //   99                   | cdq                 
            //   0fa4c210             | shld                edx, eax, 0x10
            //   c1e010               | shl                 eax, 0x10
            //   03f0                 | add                 esi, eax
            //   8b45fc               | mov                 eax, dword ptr [ebp - 4]

        $sequence_8 = { 03c1 59 8bf8 f3a5 8d4d30 51 8d4828 }
            // n = 7, score = 400
            //   03c1                 | add                 eax, ecx
            //   59                   | pop                 ecx
            //   8bf8                 | mov                 edi, eax
            //   f3a5                 | rep movsd           dword ptr es:[edi], dword ptr [esi]
            //   8d4d30               | lea                 ecx, [ebp + 0x30]
            //   51                   | push                ecx
            //   8d4828               | lea                 ecx, [eax + 0x28]

        $sequence_9 = { 8bc1 c74104???????? 83610800 83610c00 c3 c20400 55 }
            // n = 7, score = 400
            //   8bc1                 | mov                 eax, ecx
            //   c74104????????       |                     
            //   83610800             | and                 dword ptr [ecx + 8], 0
            //   83610c00             | and                 dword ptr [ecx + 0xc], 0
            //   c3                   | ret                 
            //   c20400               | ret                 4
            //   55                   | push                ebp

    condition:
        7 of them and filesize < 237568
}