rule win_lambert_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.lambert."
        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.lambert"
        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 = { 8b510c 8b421c 8945f4 8b4df4 894df0 8b55f4 }
            // n = 6, score = 300
            //   8b510c               | mov                 edx, dword ptr [ecx + 0xc]
            //   8b421c               | mov                 eax, dword ptr [edx + 0x1c]
            //   8945f4               | mov                 dword ptr [ebp - 0xc], eax
            //   8b4df4               | mov                 ecx, dword ptr [ebp - 0xc]
            //   894df0               | mov                 dword ptr [ebp - 0x10], ecx
            //   8b55f4               | mov                 edx, dword ptr [ebp - 0xc]

        $sequence_1 = { 0f82a4000000 83fe06 0f822cffffff 8bc1 }
            // n = 4, score = 300
            //   0f82a4000000         | jb                  0xaa
            //   83fe06               | cmp                 esi, 6
            //   0f822cffffff         | jb                  0xffffff32
            //   8bc1                 | mov                 eax, ecx

        $sequence_2 = { 33ce 314de8 890a 894de4 }
            // n = 4, score = 300
            //   33ce                 | xor                 ecx, esi
            //   314de8               | xor                 dword ptr [ebp - 0x18], ecx
            //   890a                 | mov                 dword ptr [edx], ecx
            //   894de4               | mov                 dword ptr [ebp - 0x1c], ecx

        $sequence_3 = { 8b4d08 03483c 894dfc 8b55fc 813a50450000 7402 }
            // n = 6, score = 300
            //   8b4d08               | mov                 ecx, dword ptr [ebp + 8]
            //   03483c               | add                 ecx, dword ptr [eax + 0x3c]
            //   894dfc               | mov                 dword ptr [ebp - 4], ecx
            //   8b55fc               | mov                 edx, dword ptr [ebp - 4]
            //   813a50450000         | cmp                 dword ptr [edx], 0x4550
            //   7402                 | je                  4

        $sequence_4 = { 83c078 8945f0 8b4df0 83790400 7502 eb4c }
            // n = 6, score = 300
            //   83c078               | add                 eax, 0x78
            //   8945f0               | mov                 dword ptr [ebp - 0x10], eax
            //   8b4df0               | mov                 ecx, dword ptr [ebp - 0x10]
            //   83790400             | cmp                 dword ptr [ecx + 4], 0
            //   7502                 | jne                 4
            //   eb4c                 | jmp                 0x4e

        $sequence_5 = { 7c12 0fb74d08 83f95a 7f09 0fb74508 83c020 eb04 }
            // n = 7, score = 300
            //   7c12                 | jl                  0x14
            //   0fb74d08             | movzx               ecx, word ptr [ebp + 8]
            //   83f95a               | cmp                 ecx, 0x5a
            //   7f09                 | jg                  0xb
            //   0fb74508             | movzx               eax, word ptr [ebp + 8]
            //   83c020               | add                 eax, 0x20
            //   eb04                 | jmp                 6

        $sequence_6 = { 33ce 33d1 33da 8970f0 }
            // n = 4, score = 300
            //   33ce                 | xor                 ecx, esi
            //   33d1                 | xor                 edx, ecx
            //   33da                 | xor                 ebx, edx
            //   8970f0               | mov                 dword ptr [eax - 0x10], esi

        $sequence_7 = { 2bc2 83f801 0f8208010000 803a00 }
            // n = 4, score = 300
            //   2bc2                 | sub                 eax, edx
            //   83f801               | cmp                 eax, 1
            //   0f8208010000         | jb                  0x10e
            //   803a00               | cmp                 byte ptr [edx], 0

        $sequence_8 = { 8b55fc 83c201 8955fc ebb9 8b45fc }
            // n = 5, score = 300
            //   8b55fc               | mov                 edx, dword ptr [ebp - 4]
            //   83c201               | add                 edx, 1
            //   8955fc               | mov                 dword ptr [ebp - 4], edx
            //   ebb9                 | jmp                 0xffffffbb
            //   8b45fc               | mov                 eax, dword ptr [ebp - 4]

        $sequence_9 = { 0fb6c8 0bd1 c1e208 0bd1 }
            // n = 4, score = 300
            //   0fb6c8               | movzx               ecx, al
            //   0bd1                 | or                  edx, ecx
            //   c1e208               | shl                 edx, 8
            //   0bd1                 | or                  edx, ecx

        $sequence_10 = { 0fb70c50 894df0 eb02 ebb8 }
            // n = 4, score = 300
            //   0fb70c50             | movzx               ecx, word ptr [eax + edx*2]
            //   894df0               | mov                 dword ptr [ebp - 0x10], ecx
            //   eb02                 | jmp                 4
            //   ebb8                 | jmp                 0xffffffba

        $sequence_11 = { 8b4d0c 8b55fc 3b5118 7334 }
            // n = 4, score = 300
            //   8b4d0c               | mov                 ecx, dword ptr [ebp + 0xc]
            //   8b55fc               | mov                 edx, dword ptr [ebp - 4]
            //   3b5118               | cmp                 edx, dword ptr [ecx + 0x18]
            //   7334                 | jae                 0x36

        $sequence_12 = { 4f 42 3b7d10 724d 3bf9 }
            // n = 5, score = 300
            //   4f                   | dec                 edi
            //   42                   | inc                 edx
            //   3b7d10               | cmp                 edi, dword ptr [ebp + 0x10]
            //   724d                 | jb                  0x4f
            //   3bf9                 | cmp                 edi, ecx

        $sequence_13 = { 4f 42 42 eb56 }
            // n = 4, score = 300
            //   4f                   | dec                 edi
            //   42                   | inc                 edx
            //   42                   | inc                 edx
            //   eb56                 | jmp                 0x58

        $sequence_14 = { 334f14 c1e808 c1ee18 0fb6c0 }
            // n = 4, score = 300
            //   334f14               | xor                 ecx, dword ptr [edi + 0x14]
            //   c1e808               | shr                 eax, 8
            //   c1ee18               | shr                 esi, 0x18
            //   0fb6c0               | movzx               eax, al

        $sequence_15 = { 8b4508 034220 8945ec 8b4d0c 8b5508 035124 }
            // n = 6, score = 300
            //   8b4508               | mov                 eax, dword ptr [ebp + 8]
            //   034220               | add                 eax, dword ptr [edx + 0x20]
            //   8945ec               | mov                 dword ptr [ebp - 0x14], eax
            //   8b4d0c               | mov                 ecx, dword ptr [ebp + 0xc]
            //   8b5508               | mov                 edx, dword ptr [ebp + 8]
            //   035124               | add                 edx, dword ptr [ecx + 0x24]

    condition:
        7 of them and filesize < 1205248
}