rule win_mimic_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.mimic."
        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.mimic"
        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 = { 0fb6c2 0fb60485e88e5b00 330c85e8a65b00 894e08 3bbdf0000000 0f8c92feffff 5f }
            // n = 7, score = 100
            //   0fb6c2               | movzx               eax, dl
            //   0fb60485e88e5b00     | movzx               eax, byte ptr [eax*4 + 0x5b8ee8]
            //   330c85e8a65b00       | xor                 ecx, dword ptr [eax*4 + 0x5ba6e8]
            //   894e08               | mov                 dword ptr [esi + 8], ecx
            //   3bbdf0000000         | cmp                 edi, dword ptr [ebp + 0xf0]
            //   0f8c92feffff         | jl                  0xfffffe98
            //   5f                   | pop                 edi

        $sequence_1 = { 50 51 6a00 6a00 6a10 8d4dc4 51 }
            // n = 7, score = 100
            //   50                   | push                eax
            //   51                   | push                ecx
            //   6a00                 | push                0
            //   6a00                 | push                0
            //   6a10                 | push                0x10
            //   8d4dc4               | lea                 ecx, [ebp - 0x3c]
            //   51                   | push                ecx

        $sequence_2 = { 74df ff15???????? b001 eb16 ff15???????? 50 68???????? }
            // n = 7, score = 100
            //   74df                 | je                  0xffffffe1
            //   ff15????????         |                     
            //   b001                 | mov                 al, 1
            //   eb16                 | jmp                 0x18
            //   ff15????????         |                     
            //   50                   | push                eax
            //   68????????           |                     

        $sequence_3 = { 8b09 3b856cfdffff 750d 50 e8???????? 83c404 85c0 }
            // n = 7, score = 100
            //   8b09                 | mov                 ecx, dword ptr [ecx]
            //   3b856cfdffff         | cmp                 eax, dword ptr [ebp - 0x294]
            //   750d                 | jne                 0xf
            //   50                   | push                eax
            //   e8????????           |                     
            //   83c404               | add                 esp, 4
            //   85c0                 | test                eax, eax

        $sequence_4 = { ffb54cfeffff 8d45cc b9???????? 50 8d8540feffff 50 e8???????? }
            // n = 7, score = 100
            //   ffb54cfeffff         | push                dword ptr [ebp - 0x1b4]
            //   8d45cc               | lea                 eax, [ebp - 0x34]
            //   b9????????           |                     
            //   50                   | push                eax
            //   8d8540feffff         | lea                 eax, [ebp - 0x1c0]
            //   50                   | push                eax
            //   e8????????           |                     

        $sequence_5 = { 8d4d90 0f4355c0 03da c745a000000000 837dd410 c745a407000000 0f437dc0 }
            // n = 7, score = 100
            //   8d4d90               | lea                 ecx, [ebp - 0x70]
            //   0f4355c0             | cmovae              edx, dword ptr [ebp - 0x40]
            //   03da                 | add                 ebx, edx
            //   c745a000000000       | mov                 dword ptr [ebp - 0x60], 0
            //   837dd410             | cmp                 dword ptr [ebp - 0x2c], 0x10
            //   c745a407000000       | mov                 dword ptr [ebp - 0x5c], 7
            //   0f437dc0             | cmovae              edi, dword ptr [ebp - 0x40]

        $sequence_6 = { c745fc00000000 8b4e10 8b5614 c745ec01000000 3bca 7318 8d4101 }
            // n = 7, score = 100
            //   c745fc00000000       | mov                 dword ptr [ebp - 4], 0
            //   8b4e10               | mov                 ecx, dword ptr [esi + 0x10]
            //   8b5614               | mov                 edx, dword ptr [esi + 0x14]
            //   c745ec01000000       | mov                 dword ptr [ebp - 0x14], 1
            //   3bca                 | cmp                 ecx, edx
            //   7318                 | jae                 0x1a
            //   8d4101               | lea                 eax, [ecx + 1]

        $sequence_7 = { 33c0 894dec c7411000000000 c7411407000000 668901 8d4508 3bc8 }
            // n = 7, score = 100
            //   33c0                 | xor                 eax, eax
            //   894dec               | mov                 dword ptr [ebp - 0x14], ecx
            //   c7411000000000       | mov                 dword ptr [ecx + 0x10], 0
            //   c7411407000000       | mov                 dword ptr [ecx + 0x14], 7
            //   668901               | mov                 word ptr [ecx], ax
            //   8d4508               | lea                 eax, [ebp + 8]
            //   3bc8                 | cmp                 ecx, eax

        $sequence_8 = { 68???????? 53 ffd7 8bc8 8945d4 85c9 0f85bafeffff }
            // n = 7, score = 100
            //   68????????           |                     
            //   53                   | push                ebx
            //   ffd7                 | call                edi
            //   8bc8                 | mov                 ecx, eax
            //   8945d4               | mov                 dword ptr [ebp - 0x2c], eax
            //   85c9                 | test                ecx, ecx
            //   0f85bafeffff         | jne                 0xfffffec0

        $sequence_9 = { 6a00 6a00 68???????? 6802000080 ff15???????? 85c0 7520 }
            // n = 7, score = 100
            //   6a00                 | push                0
            //   6a00                 | push                0
            //   68????????           |                     
            //   6802000080           | push                0x80000002
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax
            //   7520                 | jne                 0x22

    condition:
        7 of them and filesize < 4204544
}