rule win_cerber_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.cerber."
        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.cerber"
        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 = { 83ec10 56 33f6 3bfe }
            // n = 4, score = 1200
            //   83ec10               | sub                 esp, 0x10
            //   56                   | push                esi
            //   33f6                 | xor                 esi, esi
            //   3bfe                 | cmp                 edi, esi

        $sequence_1 = { 33ff 0b3a 33c9 0bf1 8bef }
            // n = 5, score = 1200
            //   33ff                 | xor                 edi, edi
            //   0b3a                 | or                  edi, dword ptr [edx]
            //   33c9                 | xor                 ecx, ecx
            //   0bf1                 | or                  esi, ecx
            //   8bef                 | mov                 ebp, edi

        $sequence_2 = { 394510 0f82e7000000 7709 39450c 0f86dc000000 8b550c }
            // n = 6, score = 1200
            //   394510               | cmp                 dword ptr [ebp + 0x10], eax
            //   0f82e7000000         | jb                  0xed
            //   7709                 | ja                  0xb
            //   39450c               | cmp                 dword ptr [ebp + 0xc], eax
            //   0f86dc000000         | jbe                 0xe2
            //   8b550c               | mov                 edx, dword ptr [ebp + 0xc]

        $sequence_3 = { 83f801 750b 4a b800000080 83e904 eb02 d1e8 }
            // n = 7, score = 1200
            //   83f801               | cmp                 eax, 1
            //   750b                 | jne                 0xd
            //   4a                   | dec                 edx
            //   b800000080           | mov                 eax, 0x80000000
            //   83e904               | sub                 ecx, 4
            //   eb02                 | jmp                 4
            //   d1e8                 | shr                 eax, 1

        $sequence_4 = { 3945fc 0f8224ffffff 33c0 5b }
            // n = 4, score = 1200
            //   3945fc               | cmp                 dword ptr [ebp - 4], eax
            //   0f8224ffffff         | jb                  0xffffff2a
            //   33c0                 | xor                 eax, eax
            //   5b                   | pop                 ebx

        $sequence_5 = { 83ec0c 53 56 57 6a20 5b 3bcb }
            // n = 7, score = 1200
            //   83ec0c               | sub                 esp, 0xc
            //   53                   | push                ebx
            //   56                   | push                esi
            //   57                   | push                edi
            //   6a20                 | push                0x20
            //   5b                   | pop                 ebx
            //   3bcb                 | cmp                 ecx, ebx

        $sequence_6 = { 3bd1 7304 8bda eb02 8bd9 f6c307 7532 }
            // n = 7, score = 1200
            //   3bd1                 | cmp                 edx, ecx
            //   7304                 | jae                 6
            //   8bda                 | mov                 ebx, edx
            //   eb02                 | jmp                 4
            //   8bd9                 | mov                 ebx, ecx
            //   f6c307               | test                bl, 7
            //   7532                 | jne                 0x34

        $sequence_7 = { 83ec10 57 8b7d10 85ff 0f8400010000 }
            // n = 5, score = 1200
            //   83ec10               | sub                 esp, 0x10
            //   57                   | push                edi
            //   8b7d10               | mov                 edi, dword ptr [ebp + 0x10]
            //   85ff                 | test                edi, edi
            //   0f8400010000         | je                  0x106

    condition:
        7 of them and filesize < 573440
}