rule win_logpos_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.logpos."
        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.logpos"
        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 = { b800000000 eb2f 48 8b442430 8a08 e8???????? 83f801 }
            // n = 7, score = 100
            //   b800000000           | mov                 eax, 0
            //   eb2f                 | jmp                 0x31
            //   48                   | dec                 eax
            //   8b442430             | mov                 eax, dword ptr [esp + 0x30]
            //   8a08                 | mov                 cl, byte ptr [eax]
            //   e8????????           |                     
            //   83f801               | cmp                 eax, 1

        $sequence_1 = { 8d9be6090000 8945f4 8d45fc 31c9 49 50 ff75f4 }
            // n = 7, score = 100
            //   8d9be6090000         | lea                 ebx, [ebx + 0x9e6]
            //   8945f4               | mov                 dword ptr [ebp - 0xc], eax
            //   8d45fc               | lea                 eax, [ebp - 4]
            //   31c9                 | xor                 ecx, ecx
            //   49                   | dec                 ecx
            //   50                   | push                eax
            //   ff75f4               | push                dword ptr [ebp - 0xc]

        $sequence_2 = { 683ef3b1bf 6858ea1100 89e3 83ec6e }
            // n = 4, score = 100
            //   683ef3b1bf           | push                0xbfb1f33e
            //   6858ea1100           | push                0x11ea58
            //   89e3                 | mov                 ebx, esp
            //   83ec6e               | sub                 esp, 0x6e

        $sequence_3 = { 894358 6814c55d73 ff33 ff7370 53 e8???????? 89435c }
            // n = 7, score = 100
            //   894358               | mov                 dword ptr [ebx + 0x58], eax
            //   6814c55d73           | push                0x735dc514
            //   ff33                 | push                dword ptr [ebx]
            //   ff7370               | push                dword ptr [ebx + 0x70]
            //   53                   | push                ebx
            //   e8????????           |                     
            //   89435c               | mov                 dword ptr [ebx + 0x5c], eax

        $sequence_4 = { 31db 48 ffc3 48 31f6 }
            // n = 5, score = 100
            //   31db                 | xor                 ebx, ebx
            //   48                   | dec                 eax
            //   ffc3                 | inc                 ebx
            //   48                   | dec                 eax
            //   31f6                 | xor                 esi, esi

        $sequence_5 = { 4c 0fb601 4c 0fb60a 4d }
            // n = 5, score = 100
            //   4c                   | dec                 esp
            //   0fb601               | movzx               eax, byte ptr [ecx]
            //   4c                   | dec                 esp
            //   0fb60a               | movzx               ecx, byte ptr [edx]
            //   4d                   | dec                 ebp

        $sequence_6 = { 89cf 48 89d0 4c 89c1 fc f3aa }
            // n = 7, score = 100
            //   89cf                 | mov                 edi, ecx
            //   48                   | dec                 eax
            //   89d0                 | mov                 eax, edx
            //   4c                   | dec                 esp
            //   89c1                 | mov                 ecx, eax
            //   fc                   | cld                 
            //   f3aa                 | rep stosb           byte ptr es:[edi], al

        $sequence_7 = { 01c0 0fb6542407 48 63d2 48 }
            // n = 5, score = 100
            //   01c0                 | add                 eax, eax
            //   0fb6542407           | movzx               edx, byte ptr [esp + 7]
            //   48                   | dec                 eax
            //   63d2                 | arpl                dx, dx
            //   48                   | dec                 eax

        $sequence_8 = { 89e5 60 b9???????? 8b5508 8b750c }
            // n = 5, score = 100
            //   89e5                 | mov                 ebp, esp
            //   60                   | pushal              
            //   b9????????           |                     
            //   8b5508               | mov                 edx, dword ptr [ebp + 8]
            //   8b750c               | mov                 esi, dword ptr [ebp + 0xc]

        $sequence_9 = { 833800 7505 8b45fc eb0e 8b45fc 8b00 }
            // n = 6, score = 100
            //   833800               | cmp                 dword ptr [eax], 0
            //   7505                 | jne                 7
            //   8b45fc               | mov                 eax, dword ptr [ebp - 4]
            //   eb0e                 | jmp                 0x10
            //   8b45fc               | mov                 eax, dword ptr [ebp - 4]
            //   8b00                 | mov                 eax, dword ptr [eax]

    condition:
        7 of them and filesize < 57344
}