rule win_satan_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.satan."
        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.satan"
        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 = { 8b5508 83e23f 6bc230 8b0c8d40e04700 0fb6540128 83e220 7412 }
            // n = 7, score = 100
            //   8b5508               | mov                 edx, dword ptr [ebp + 8]
            //   83e23f               | and                 edx, 0x3f
            //   6bc230               | imul                eax, edx, 0x30
            //   8b0c8d40e04700       | mov                 ecx, dword ptr [ecx*4 + 0x47e040]
            //   0fb6540128           | movzx               edx, byte ptr [ecx + eax + 0x28]
            //   83e220               | and                 edx, 0x20
            //   7412                 | je                  0x14

        $sequence_1 = { 0f85dd000000 8b01 80780c01 0f85d1000000 c6410c00 8b4604 8b4de8 }
            // n = 7, score = 100
            //   0f85dd000000         | jne                 0xe3
            //   8b01                 | mov                 eax, dword ptr [ecx]
            //   80780c01             | cmp                 byte ptr [eax + 0xc], 1
            //   0f85d1000000         | jne                 0xd7
            //   c6410c00             | mov                 byte ptr [ecx + 0xc], 0
            //   8b4604               | mov                 eax, dword ptr [esi + 4]
            //   8b4de8               | mov                 ecx, dword ptr [ebp - 0x18]

        $sequence_2 = { 7505 e8???????? 8bca 81e9???????? 0f1f4000 8a06 }
            // n = 6, score = 100
            //   7505                 | jne                 7
            //   e8????????           |                     
            //   8bca                 | mov                 ecx, edx
            //   81e9????????         |                     
            //   0f1f4000             | nop                 dword ptr [eax]
            //   8a06                 | mov                 al, byte ptr [esi]

        $sequence_3 = { c745fc05000000 e8???????? 8d4dd4 e8???????? 8ac3 eb02 }
            // n = 6, score = 100
            //   c745fc05000000       | mov                 dword ptr [ebp - 4], 5
            //   e8????????           |                     
            //   8d4dd4               | lea                 ecx, [ebp - 0x2c]
            //   e8????????           |                     
            //   8ac3                 | mov                 al, bl
            //   eb02                 | jmp                 4

        $sequence_4 = { 8d4dd4 c745fc05000000 e8???????? 8d4dd4 e8???????? 8ac3 }
            // n = 6, score = 100
            //   8d4dd4               | lea                 ecx, [ebp - 0x2c]
            //   c745fc05000000       | mov                 dword ptr [ebp - 4], 5
            //   e8????????           |                     
            //   8d4dd4               | lea                 ecx, [ebp - 0x2c]
            //   e8????????           |                     
            //   8ac3                 | mov                 al, bl

        $sequence_5 = { 8b55f0 52 e8???????? 83c404 85c0 7434 }
            // n = 6, score = 100
            //   8b55f0               | mov                 edx, dword ptr [ebp - 0x10]
            //   52                   | push                edx
            //   e8????????           |                     
            //   83c404               | add                 esp, 4
            //   85c0                 | test                eax, eax
            //   7434                 | je                  0x36

        $sequence_6 = { 8d4598 c745a000000000 0f57c0 8d4da8 50 660fd64598 }
            // n = 6, score = 100
            //   8d4598               | lea                 eax, [ebp - 0x68]
            //   c745a000000000       | mov                 dword ptr [ebp - 0x60], 0
            //   0f57c0               | xorps               xmm0, xmm0
            //   8d4da8               | lea                 ecx, [ebp - 0x58]
            //   50                   | push                eax
            //   660fd64598           | movq                qword ptr [ebp - 0x68], xmm0

        $sequence_7 = { c745e80f000000 c745e400000000 c645d400 8d4dd0 c745fc0d000000 e8???????? 8d4dd0 }
            // n = 7, score = 100
            //   c745e80f000000       | mov                 dword ptr [ebp - 0x18], 0xf
            //   c745e400000000       | mov                 dword ptr [ebp - 0x1c], 0
            //   c645d400             | mov                 byte ptr [ebp - 0x2c], 0
            //   8d4dd0               | lea                 ecx, [ebp - 0x30]
            //   c745fc0d000000       | mov                 dword ptr [ebp - 4], 0xd
            //   e8????????           |                     
            //   8d4dd0               | lea                 ecx, [ebp - 0x30]

        $sequence_8 = { 68???????? 8d4db8 c745fcffffffff e8???????? 8d45b8 c745fc02000000 }
            // n = 6, score = 100
            //   68????????           |                     
            //   8d4db8               | lea                 ecx, [ebp - 0x48]
            //   c745fcffffffff       | mov                 dword ptr [ebp - 4], 0xffffffff
            //   e8????????           |                     
            //   8d45b8               | lea                 eax, [ebp - 0x48]
            //   c745fc02000000       | mov                 dword ptr [ebp - 4], 2

        $sequence_9 = { 8bf8 85ff 7476 6a00 6a50 }
            // n = 5, score = 100
            //   8bf8                 | mov                 edi, eax
            //   85ff                 | test                edi, edi
            //   7476                 | je                  0x78
            //   6a00                 | push                0
            //   6a50                 | push                0x50

    condition:
        7 of them and filesize < 1163264
}