rule win_apocalipto_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-05-04"
        version = "1"
        description = "Detects win.apocalipto."
        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.apocalipto"
        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 = { 83ec08 a3???????? 85c0 0f84440a0000 c7442404???????? 891c24 ff15???????? }
            // n = 7, score = 100
            //   83ec08               | sub                 esp, 8
            //   a3????????           |                     
            //   85c0                 | test                eax, eax
            //   0f84440a0000         | je                  0xa4a
            //   c7442404????????     |                     
            //   891c24               | mov                 dword ptr [esp], ebx
            //   ff15????????         |                     

        $sequence_1 = { 84c9 740a 880a 42 43 }
            // n = 5, score = 100
            //   84c9                 | test                cl, cl
            //   740a                 | je                  0xc
            //   880a                 | mov                 byte ptr [edx], cl
            //   42                   | inc                 edx
            //   43                   | inc                 ebx

        $sequence_2 = { 83ec24 e8???????? 89c3 c7442404???????? 890424 }
            // n = 5, score = 100
            //   83ec24               | sub                 esp, 0x24
            //   e8????????           |                     
            //   89c3                 | mov                 ebx, eax
            //   c7442404????????     |                     
            //   890424               | mov                 dword ptr [esp], eax

        $sequence_3 = { e8???????? e9???????? c744240800400000 897c2404 893424 ff15???????? 83ec0c }
            // n = 7, score = 100
            //   e8????????           |                     
            //   e9????????           |                     
            //   c744240800400000     | mov                 dword ptr [esp + 8], 0x4000
            //   897c2404             | mov                 dword ptr [esp + 4], edi
            //   893424               | mov                 dword ptr [esp], esi
            //   ff15????????         |                     
            //   83ec0c               | sub                 esp, 0xc

        $sequence_4 = { 8b4d0c 39ce 75b8 8910 895804 }
            // n = 5, score = 100
            //   8b4d0c               | mov                 ecx, dword ptr [ebp + 0xc]
            //   39ce                 | cmp                 esi, ecx
            //   75b8                 | jne                 0xffffffba
            //   8910                 | mov                 dword ptr [eax], edx
            //   895804               | mov                 dword ptr [eax + 4], ebx

        $sequence_5 = { ff15???????? 83ec08 a3???????? 85c0 0f843f010000 }
            // n = 5, score = 100
            //   ff15????????         |                     
            //   83ec08               | sub                 esp, 8
            //   a3????????           |                     
            //   85c0                 | test                eax, eax
            //   0f843f010000         | je                  0x145

        $sequence_6 = { 89542404 893c24 e8???????? 89c2 85c0 7430 8b85c8f3ffff }
            // n = 7, score = 100
            //   89542404             | mov                 dword ptr [esp + 4], edx
            //   893c24               | mov                 dword ptr [esp], edi
            //   e8????????           |                     
            //   89c2                 | mov                 edx, eax
            //   85c0                 | test                eax, eax
            //   7430                 | je                  0x32
            //   8b85c8f3ffff         | mov                 eax, dword ptr [ebp - 0xc38]

        $sequence_7 = { a3???????? 85c0 0f8473070000 c7442404???????? 891c24 ff15???????? 83ec08 }
            // n = 7, score = 100
            //   a3????????           |                     
            //   85c0                 | test                eax, eax
            //   0f8473070000         | je                  0x779
            //   c7442404????????     |                     
            //   891c24               | mov                 dword ptr [esp], ebx
            //   ff15????????         |                     
            //   83ec08               | sub                 esp, 8

        $sequence_8 = { ff15???????? 83ec08 a3???????? 85c0 0f84850a0000 c7442404???????? }
            // n = 6, score = 100
            //   ff15????????         |                     
            //   83ec08               | sub                 esp, 8
            //   a3????????           |                     
            //   85c0                 | test                eax, eax
            //   0f84850a0000         | je                  0xa8b
            //   c7442404????????     |                     

        $sequence_9 = { 893424 e8???????? 89f0 83c40c 5b 5e }
            // n = 6, score = 100
            //   893424               | mov                 dword ptr [esp], esi
            //   e8????????           |                     
            //   89f0                 | mov                 eax, esi
            //   83c40c               | add                 esp, 0xc
            //   5b                   | pop                 ebx
            //   5e                   | pop                 esi

    condition:
        7 of them and filesize < 212992
}