rule win_mechanical_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.mechanical."
        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.mechanical"
        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 = { 03c7 3bca 72ed 5f }
            // n = 4, score = 200
            //   03c7                 | add                 eax, edi
            //   3bca                 | cmp                 ecx, edx
            //   72ed                 | jb                  0xffffffef
            //   5f                   | pop                 edi

        $sequence_1 = { 00686c 42 0023 d18a0688078a }
            // n = 4, score = 200
            //   00686c               | add                 byte ptr [eax + 0x6c], ch
            //   42                   | inc                 edx
            //   0023                 | add                 byte ptr [ebx], ah
            //   d18a0688078a         | ror                 dword ptr [edx - 0x75f877fa], 1

        $sequence_2 = { 030495c0e54200 eb05 b8???????? f6400420 }
            // n = 4, score = 200
            //   030495c0e54200       | add                 eax, dword ptr [edx*4 + 0x42e5c0]
            //   eb05                 | jmp                 7
            //   b8????????           |                     
            //   f6400420             | test                byte ptr [eax + 4], 0x20

        $sequence_3 = { 4889470e 488b05???????? 48894716 8b05???????? 89471e e8???????? }
            // n = 6, score = 200
            //   4889470e             | dec                 eax
            //   488b05????????       |                     
            //   48894716             | mov                 dword ptr [edi + 0xe], eax
            //   8b05????????         |                     
            //   89471e               | dec                 eax
            //   e8????????           |                     

        $sequence_4 = { 033485c0e54200 c745e401000000 33db 395e08 }
            // n = 4, score = 200
            //   033485c0e54200       | add                 esi, dword ptr [eax*4 + 0x42e5c0]
            //   c745e401000000       | mov                 dword ptr [ebp - 0x1c], 1
            //   33db                 | xor                 ebx, ebx
            //   395e08               | cmp                 dword ptr [esi + 8], ebx

        $sequence_5 = { 0401 3cbe 8844240b 76e2 }
            // n = 4, score = 200
            //   0401                 | add                 al, 1
            //   3cbe                 | cmp                 al, 0xbe
            //   8844240b             | mov                 byte ptr [esp + 0xb], al
            //   76e2                 | jbe                 0xffffffe4

        $sequence_6 = { 033485c0e54200 8b45e4 8b00 8906 }
            // n = 4, score = 200
            //   033485c0e54200       | add                 esi, dword ptr [eax*4 + 0x42e5c0]
            //   8b45e4               | mov                 eax, dword ptr [ebp - 0x1c]
            //   8b00                 | mov                 eax, dword ptr [eax]
            //   8906                 | mov                 dword ptr [esi], eax

        $sequence_7 = { 03ce c6840c3801000000 8d8424a05c0000 33f6 }
            // n = 4, score = 200
            //   03ce                 | add                 ecx, esi
            //   c6840c3801000000     | mov                 byte ptr [esp + ecx + 0x138], 0
            //   8d8424a05c0000       | lea                 eax, [esp + 0x5ca0]
            //   33f6                 | xor                 esi, esi

        $sequence_8 = { 488b0d???????? 48894a10 488b0d???????? 48894a18 }
            // n = 4, score = 200
            //   488b0d????????       |                     
            //   48894a10             | dec                 ecx
            //   488b0d????????       |                     
            //   48894a18             | sub                 ecx, 1

        $sequence_9 = { b922000000 66666690 666690 66666690 }
            // n = 4, score = 200
            //   b922000000           | je                  0x9d96
            //   66666690             | mov                 eax, dword ptr [esp + 0x30]
            //   666690               | dec                 eax
            //   66666690             | add                 edx, 1

        $sequence_10 = { 03c1 1bc9 0bc1 59 e9???????? e8???????? ff742404 }
            // n = 7, score = 200
            //   03c1                 | add                 eax, ecx
            //   1bc9                 | sbb                 ecx, ecx
            //   0bc1                 | or                  eax, ecx
            //   59                   | pop                 ecx
            //   e9????????           |                     
            //   e8????????           |                     
            //   ff742404             | push                dword ptr [esp + 4]

        $sequence_11 = { e9???????? c60229 eb7d c6023b eb78 c6022b }
            // n = 6, score = 200
            //   e9????????           |                     
            //   c60229               | dec                 eax
            //   eb7d                 | cmp                 eax, ecx
            //   c6023b               | je                  0x6f
            //   eb78                 | dec                 eax
            //   c6022b               | mov                 eax, dword ptr [edi + 0x110]

        $sequence_12 = { 488bcf ff15???????? 85c0 8903 0f848c9d0000 8b442430 }
            // n = 6, score = 200
            //   488bcf               | mov                 byte ptr [edx], 0x2b
            //   ff15????????         |                     
            //   85c0                 | dec                 ecx
            //   8903                 | add                 ebx, 1
            //   0f848c9d0000         | test                al, al
            //   8b442430             | je                  0xd

        $sequence_13 = { 7479 488d0d01fe0000 483bc1 746d 488b8710010000 }
            // n = 5, score = 200
            //   7479                 | mov                 dword ptr [edi + 0x16], eax
            //   488d0d01fe0000       | mov                 dword ptr [edi + 0x1e], eax
            //   483bc1               | je                  0x7b
            //   746d                 | dec                 eax
            //   488b8710010000       | lea                 ecx, [0xfe01]

        $sequence_14 = { 4983c301 84c0 7409 4983c001 }
            // n = 4, score = 200
            //   4983c301             | mov                 byte ptr [edx], 0x29
            //   84c0                 | jmp                 0x82
            //   7409                 | mov                 byte ptr [edx], 0x3b
            //   4983c001             | jmp                 0x7d

        $sequence_15 = { 4883c201 4983e901 0f853ffeffff 488d942480560000 488bcf ff15???????? 85c0 }
            // n = 7, score = 200
            //   4883c201             | dec                 ecx
            //   4983e901             | add                 eax, 1
            //   0f853ffeffff         | dec                 eax
            //   488d942480560000     | mov                 ecx, edi
            //   488bcf               | test                eax, eax
            //   ff15????????         |                     
            //   85c0                 | mov                 dword ptr [ebx], eax

    condition:
        7 of them and filesize < 434176
}