rule win_anchor_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.anchor."
        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.anchor"
        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 = { c6400365 eb0a 66c74001646c c640036c }
            // n = 4, score = 800
            //   c6400365             | mov                 byte ptr [eax + 3], 0x65
            //   eb0a                 | jmp                 0xc
            //   66c74001646c         | mov                 word ptr [eax + 1], 0x6c64
            //   c640036c             | mov                 byte ptr [eax + 3], 0x6c

        $sequence_1 = { 740c 66c740016578 c6400365 eb0a }
            // n = 4, score = 800
            //   740c                 | je                  0xe
            //   66c740016578         | mov                 word ptr [eax + 1], 0x7865
            //   c6400365             | mov                 byte ptr [eax + 3], 0x65
            //   eb0a                 | jmp                 0xc

        $sequence_2 = { 51 e8???????? 8b0d???????? c1e102 51 }
            // n = 5, score = 600
            //   51                   | push                ecx
            //   e8????????           |                     
            //   8b0d????????         |                     
            //   c1e102               | shl                 ecx, 2
            //   51                   | push                ecx

        $sequence_3 = { ff750c 51 8bce e8???????? 83c414 }
            // n = 5, score = 600
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   51                   | push                ecx
            //   8bce                 | mov                 ecx, esi
            //   e8????????           |                     
            //   83c414               | add                 esp, 0x14

        $sequence_4 = { 66895008 8b4608 6689580a 8b4608 }
            // n = 4, score = 600
            //   66895008             | mov                 word ptr [eax + 8], dx
            //   8b4608               | mov                 eax, dword ptr [esi + 8]
            //   6689580a             | mov                 word ptr [eax + 0xa], bx
            //   8b4608               | mov                 eax, dword ptr [esi + 8]

        $sequence_5 = { b101 e8???????? e8???????? 84c0 }
            // n = 4, score = 600
            //   b101                 | mov                 cl, 1
            //   e8????????           |                     
            //   e8????????           |                     
            //   84c0                 | test                al, al

        $sequence_6 = { 750c ff35???????? ff15???????? 6aff ff35???????? ff15???????? ff35???????? }
            // n = 7, score = 600
            //   750c                 | mov                 eax, eax
            //   ff35????????         |                     
            //   ff15????????         |                     
            //   6aff                 | dec                 eax
            //   ff35????????         |                     
            //   ff15????????         |                     
            //   ff35????????         |                     

        $sequence_7 = { 48 3d80ee3600 890d???????? 0f97c0 84c0 }
            // n = 5, score = 600
            //   48                   | dec                 eax
            //   3d80ee3600           | cmp                 eax, 0x36ee80
            //   890d????????         |                     
            //   0f97c0               | seta                al
            //   84c0                 | test                al, al

        $sequence_8 = { 8b4638 5f 66894812 33c9 }
            // n = 4, score = 600
            //   8b4638               | mov                 eax, dword ptr [esi + 0x38]
            //   5f                   | pop                 edi
            //   66894812             | mov                 word ptr [eax + 0x12], cx
            //   33c9                 | xor                 ecx, ecx

        $sequence_9 = { 7e49 488d0db84c0200 e8???????? 3935???????? 7535 4488642430 }
            // n = 6, score = 200
            //   7e49                 | or                  eax, ecx
            //   488d0db84c0200       | dec                 eax
            //   e8????????           |                     
            //   3935????????         |                     
            //   7535                 | cwde                
            //   4488642430           | dec                 eax

        $sequence_10 = { 0000 83bd641a0000ff 0f85fc040000 c6859412000000 }
            // n = 4, score = 200
            //   0000                 | add                 byte ptr [eax], al
            //   83bd641a0000ff       | cmp                 dword ptr [ebp + 0x1a64], -1
            //   0f85fc040000         | jne                 0x502
            //   c6859412000000       | mov                 byte ptr [ebp + 0x1294], 0

        $sequence_11 = { 03c2 c1f802 6bc003 894504 }
            // n = 4, score = 200
            //   03c2                 | mov                 dword ptr [ebp + 0xf4], 0
            //   c1f802               | movzx               eax, byte ptr [ebp + 0xf4]
            //   6bc003               | add                 eax, edx
            //   894504               | sar                 eax, 2

        $sequence_12 = { 05e0930400 894544 8b5544 488b4508 }
            // n = 4, score = 200
            //   05e0930400           | add                 ecx, eax
            //   894544               | mov                 eax, ecx
            //   8b5544               | mov                 dword ptr [ebp + 0xa4], eax
            //   488b4508             | dec                 eax

        $sequence_13 = { 488d3dccc90100 488bcf e8???????? 4c8bc0 488bd7 488bcb }
            // n = 6, score = 200
            //   488d3dccc90100       | lea                 ecx, [0x29212]
            //   488bcf               | dec                 eax
            //   e8????????           |                     
            //   4c8bc0               | mov                 edx, dword ptr [ebp + 0x28]
            //   488bd7               | movzx               eax, byte ptr [ecx + eax]
            //   488bcb               | or                  eax, ecx

        $sequence_14 = { 0bc1 488b4d48 8801 488b4548 }
            // n = 4, score = 200
            //   0bc1                 | mov                 eax, dword ptr [ebp + 8]
            //   488b4d48             | add                 eax, 0x493e0
            //   8801                 | mov                 dword ptr [ebp + 0x44], eax
            //   488b4548             | mov                 edx, dword ptr [ebp + 0x44]

        $sequence_15 = { 034524 3b8520010000 760c c785f400000001000000 }
            // n = 4, score = 200
            //   034524               | mov                 byte ptr [ebp + 0x1294], 0
            //   3b8520010000         | mov                 byte ptr [ebp + 0x12b4], 0
            //   760c                 | add                 eax, dword ptr [ebp + 0x24]
            //   c785f400000001000000     | cmp    eax, dword ptr [ebp + 0x120]

        $sequence_16 = { 0bc1 4898 488d0d12920200 488b5528 }
            // n = 4, score = 200
            //   0bc1                 | mov                 byte ptr [ecx], al
            //   4898                 | dec                 eax
            //   488d0d12920200       | mov                 eax, dword ptr [ebp + 0x48]
            //   488b5528             | dec                 eax

        $sequence_17 = { 03c8 8bc1 8985a4000000 488d8da8010000 }
            // n = 4, score = 200
            //   03c8                 | inc                 eax
            //   8bc1                 | add                 eax, edx
            //   8985a4000000         | sar                 eax, 2
            //   488d8da8010000       | imul                eax, eax, 3

        $sequence_18 = { 33ff c705????????61006e00 488d15dcfeffff 66893d???????? }
            // n = 4, score = 200
            //   33ff                 | dec                 eax
            //   c705????????61006e00     |     
            //   488d15dcfeffff       | mov                 edx, dword ptr [ebp + 0x28]
            //   66893d????????       |                     

        $sequence_19 = { e8???????? 488bf8 488d5802 488bcb }
            // n = 4, score = 200
            //   e8????????           |                     
            //   488bf8               | cwde                
            //   488d5802             | dec                 eax
            //   488bcb               | lea                 ecx, [0x29212]

        $sequence_20 = { 4833cc e8???????? 4c8d9c2430010000 498b5b10 498b7b20 498be3 5d }
            // n = 7, score = 200
            //   4833cc               | dec                 eax
            //   e8????????           |                     
            //   4c8d9c2430010000     | cwde                
            //   498b5b10             | dec                 eax
            //   498b7b20             | lea                 ecx, [0x29212]
            //   498be3               | dec                 eax
            //   5d                   | mov                 edx, dword ptr [ebp + 0x28]

        $sequence_21 = { 00040f 830905 0000 83bd641a0000ff }
            // n = 4, score = 200
            //   00040f               | mov                 eax, 0x11
            //   830905               | mov                 edx, 2
            //   0000                 | add                 byte ptr [edi + ecx], al
            //   83bd641a0000ff       | or                  dword ptr [ecx], 5

    condition:
        7 of them and filesize < 778240
}