rule win_sierras_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.sierras."
        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.sierras"
        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 = { 8d542408 8d442410 52 6a00 }
            // n = 4, score = 200
            //   8d542408             | lea                 edx, [esp + 8]
            //   8d442410             | lea                 eax, [esp + 0x10]
            //   52                   | push                edx
            //   6a00                 | push                0

        $sequence_1 = { 81c474010000 c21000 6a6d 56 }
            // n = 4, score = 200
            //   81c474010000         | add                 esp, 0x174
            //   c21000               | ret                 0x10
            //   6a6d                 | push                0x6d
            //   56                   | push                esi

        $sequence_2 = { 8b45f0 3b4510 72c3 eb62 }
            // n = 4, score = 200
            //   8b45f0               | mov                 eax, dword ptr [ebp - 0x10]
            //   3b4510               | cmp                 eax, dword ptr [ebp + 0x10]
            //   72c3                 | jb                  0xffffffc5
            //   eb62                 | jmp                 0x64

        $sequence_3 = { 3bf8 7cce 8b442418 83c520 40 83f803 89442418 }
            // n = 7, score = 200
            //   3bf8                 | cmp                 edi, eax
            //   7cce                 | jl                  0xffffffd0
            //   8b442418             | mov                 eax, dword ptr [esp + 0x18]
            //   83c520               | add                 ebp, 0x20
            //   40                   | inc                 eax
            //   83f803               | cmp                 eax, 3
            //   89442418             | mov                 dword ptr [esp + 0x18], eax

        $sequence_4 = { 8d5060 3beb 7421 8bca 2bc8 8d4429a0 }
            // n = 6, score = 200
            //   8d5060               | lea                 edx, [eax + 0x60]
            //   3beb                 | cmp                 ebp, ebx
            //   7421                 | je                  0x23
            //   8bca                 | mov                 ecx, edx
            //   2bc8                 | sub                 ecx, eax
            //   8d4429a0             | lea                 eax, [ecx + ebp - 0x60]

        $sequence_5 = { 8d4e04 8bc6 3bf1 740d }
            // n = 4, score = 200
            //   8d4e04               | lea                 ecx, [esi + 4]
            //   8bc6                 | mov                 eax, esi
            //   3bf1                 | cmp                 esi, ecx
            //   740d                 | je                  0xf

        $sequence_6 = { 56 8bf1 e8???????? 8b8610010000 }
            // n = 4, score = 200
            //   56                   | push                esi
            //   8bf1                 | mov                 esi, ecx
            //   e8????????           |                     
            //   8b8610010000         | mov                 eax, dword ptr [esi + 0x110]

        $sequence_7 = { c1fa04 8bc2 c1e81f 03d0 83fa01 0f838a000000 }
            // n = 6, score = 200
            //   c1fa04               | sar                 edx, 4
            //   8bc2                 | mov                 eax, edx
            //   c1e81f               | shr                 eax, 0x1f
            //   03d0                 | add                 edx, eax
            //   83fa01               | cmp                 edx, 1
            //   0f838a000000         | jae                 0x90

        $sequence_8 = { 8d4de0 e8???????? 0175f0 017514 03fb 3b7d10 72b0 }
            // n = 7, score = 200
            //   8d4de0               | lea                 ecx, [ebp - 0x20]
            //   e8????????           |                     
            //   0175f0               | add                 dword ptr [ebp - 0x10], esi
            //   017514               | add                 dword ptr [ebp + 0x14], esi
            //   03fb                 | add                 edi, ebx
            //   3b7d10               | cmp                 edi, dword ptr [ebp + 0x10]
            //   72b0                 | jb                  0xffffffb2

        $sequence_9 = { c21800 56 8bf1 57 68???????? }
            // n = 5, score = 200
            //   c21800               | ret                 0x18
            //   56                   | push                esi
            //   8bf1                 | mov                 esi, ecx
            //   57                   | push                edi
            //   68????????           |                     

        $sequence_10 = { 51 8d542418 68???????? 52 e8???????? 83c41c }
            // n = 6, score = 200
            //   51                   | push                ecx
            //   8d542418             | lea                 edx, [esp + 0x18]
            //   68????????           |                     
            //   52                   | push                edx
            //   e8????????           |                     
            //   83c41c               | add                 esp, 0x1c

        $sequence_11 = { e8???????? 8b8610010000 5e c3 56 8bf1 }
            // n = 6, score = 200
            //   e8????????           |                     
            //   8b8610010000         | mov                 eax, dword ptr [esi + 0x110]
            //   5e                   | pop                 esi
            //   c3                   | ret                 
            //   56                   | push                esi
            //   8bf1                 | mov                 esi, ecx

        $sequence_12 = { 730d 391488 7403 41 }
            // n = 4, score = 200
            //   730d                 | jae                 0xf
            //   391488               | cmp                 dword ptr [eax + ecx*4], edx
            //   7403                 | je                  5
            //   41                   | inc                 ecx

        $sequence_13 = { 72c3 eb62 837d1000 8d5ef8 7656 8b4514 894514 }
            // n = 7, score = 200
            //   72c3                 | jb                  0xffffffc5
            //   eb62                 | jmp                 0x64
            //   837d1000             | cmp                 dword ptr [ebp + 0x10], 0
            //   8d5ef8               | lea                 ebx, [esi - 8]
            //   7656                 | jbe                 0x58
            //   8b4514               | mov                 eax, dword ptr [ebp + 0x14]
            //   894514               | mov                 dword ptr [ebp + 0x14], eax

        $sequence_14 = { c706???????? 50 ff15???????? 8d4e04 e8???????? 5e c3 }
            // n = 7, score = 200
            //   c706????????         |                     
            //   50                   | push                eax
            //   ff15????????         |                     
            //   8d4e04               | lea                 ecx, [esi + 4]
            //   e8????????           |                     
            //   5e                   | pop                 esi
            //   c3                   | ret                 

        $sequence_15 = { 8bf1 c706???????? e8???????? 8b7608 }
            // n = 4, score = 200
            //   8bf1                 | mov                 esi, ecx
            //   c706????????         |                     
            //   e8????????           |                     
            //   8b7608               | mov                 esi, dword ptr [esi + 8]

    condition:
        7 of them and filesize < 131072
}