rule win_satana_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.satana."
        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.satana"
        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 = { 8845f8 84c9 7426 0fb615???????? 0fb6c1 0fb680581e4100 }
            // n = 6, score = 100
            //   8845f8               | mov                 byte ptr [ebp - 8], al
            //   84c9                 | test                cl, cl
            //   7426                 | je                  0x28
            //   0fb615????????       |                     
            //   0fb6c1               | movzx               eax, cl
            //   0fb680581e4100       | movzx               eax, byte ptr [eax + 0x411e58]

        $sequence_1 = { 895df6 66895dfa ff15???????? 8945fc 83f8ff 7516 68???????? }
            // n = 7, score = 100
            //   895df6               | mov                 dword ptr [ebp - 0xa], ebx
            //   66895dfa             | mov                 word ptr [ebp - 6], bx
            //   ff15????????         |                     
            //   8945fc               | mov                 dword ptr [ebp - 4], eax
            //   83f8ff               | cmp                 eax, -1
            //   7516                 | jne                 0x18
            //   68????????           |                     

        $sequence_2 = { 884605 0fb64e06 0fb691a83f4100 885606 0fb64607 0fb688a83f4100 884e07 }
            // n = 7, score = 100
            //   884605               | mov                 byte ptr [esi + 5], al
            //   0fb64e06             | movzx               ecx, byte ptr [esi + 6]
            //   0fb691a83f4100       | movzx               edx, byte ptr [ecx + 0x413fa8]
            //   885606               | mov                 byte ptr [esi + 6], dl
            //   0fb64607             | movzx               eax, byte ptr [esi + 7]
            //   0fb688a83f4100       | movzx               ecx, byte ptr [eax + 0x413fa8]
            //   884e07               | mov                 byte ptr [esi + 7], cl

        $sequence_3 = { ffd6 83c40c 85c0 0f846a020000 }
            // n = 4, score = 100
            //   ffd6                 | call                esi
            //   83c40c               | add                 esp, 0xc
            //   85c0                 | test                eax, eax
            //   0f846a020000         | je                  0x270

        $sequence_4 = { a1???????? 8b0c85d8844100 6a0f 51 ff15???????? e9???????? }
            // n = 6, score = 100
            //   a1????????           |                     
            //   8b0c85d8844100       | mov                 ecx, dword ptr [eax*4 + 0x4184d8]
            //   6a0f                 | push                0xf
            //   51                   | push                ecx
            //   ff15????????         |                     
            //   e9????????           |                     

        $sequence_5 = { 8b45ec 0fb64c03fb 51 68???????? }
            // n = 4, score = 100
            //   8b45ec               | mov                 eax, dword ptr [ebp - 0x14]
            //   0fb64c03fb           | movzx               ecx, byte ptr [ebx + eax - 5]
            //   51                   | push                ecx
            //   68????????           |                     

        $sequence_6 = { b941000000 b8???????? 8d642400 8818 40 49 75fa }
            // n = 7, score = 100
            //   b941000000           | mov                 ecx, 0x41
            //   b8????????           |                     
            //   8d642400             | lea                 esp, [esp]
            //   8818                 | mov                 byte ptr [eax], bl
            //   40                   | inc                 eax
            //   49                   | dec                 ecx
            //   75fa                 | jne                 0xfffffffc

        $sequence_7 = { 880c02 40 84c9 75f6 c785e0feffff65000000 33c0 8da42400000000 }
            // n = 7, score = 100
            //   880c02               | mov                 byte ptr [edx + eax], cl
            //   40                   | inc                 eax
            //   84c9                 | test                cl, cl
            //   75f6                 | jne                 0xfffffff8
            //   c785e0feffff65000000     | mov    dword ptr [ebp - 0x120], 0x65
            //   33c0                 | xor                 eax, eax
            //   8da42400000000       | lea                 esp, [esp]

        $sequence_8 = { 6a00 6a00 ff15???????? 0fb60d???????? 89048df8864100 6a32 ffd7 }
            // n = 7, score = 100
            //   6a00                 | push                0
            //   6a00                 | push                0
            //   ff15????????         |                     
            //   0fb60d????????       |                     
            //   89048df8864100       | mov                 dword ptr [ecx*4 + 0x4186f8], eax
            //   6a32                 | push                0x32
            //   ffd7                 | call                edi

        $sequence_9 = { 68???????? 52 50 a3???????? ff15???????? 8b1d???????? 8bc3 }
            // n = 7, score = 100
            //   68????????           |                     
            //   52                   | push                edx
            //   50                   | push                eax
            //   a3????????           |                     
            //   ff15????????         |                     
            //   8b1d????????         |                     
            //   8bc3                 | mov                 eax, ebx

    condition:
        7 of them and filesize < 221184
}