rule elf_blackcat_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects elf.blackcat."
        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/elf.blackcat"
        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 = { 7227 b803000000 81fa???????? 721a }
            // n = 4, score = 200
            //   7227                 | nop                 word ptr cs:[eax + eax]
            //   b803000000           | nop                 
            //   81fa????????         |                     
            //   721a                 | add                 ebp, -0x61

        $sequence_1 = { e8???????? 0f0b e8???????? 0f0b 90 90 }
            // n = 6, score = 200
            //   e8????????           |                     
            //   0f0b                 | mov                 dword ptr [esp + 8], eax
            //   e8????????           |                     
            //   0f0b                 | ud2                 
            //   90                   | lea                 eax, [ebx - 0x2188]
            //   90                   | jmp                 0x72b

        $sequence_2 = { 83f826 0f95c1 83f801 0f95c0 20c8 0fb6e8 }
            // n = 6, score = 200
            //   83f826               | xorps               xmm0, xmm0
            //   0f95c1               | cmp                 eax, 0x20
            //   83f801               | jb                  0x20f
            //   0f95c0               | mov                 edi, eax
            //   20c8                 | lea                 esi, [edx + ebx + 0x10]
            //   0fb6e8               | xorps               xmm0, xmm0

        $sequence_3 = { 660f2ec8 19ed 660f2ec1 0fb6db }
            // n = 4, score = 200
            //   660f2ec8             | movzx               ecx, cl
            //   19ed                 | inc                 ecx
            //   660f2ec1             | cmovae              ecx, edx
            //   0fb6db               | cmp                 cl, 0xff

        $sequence_4 = { 81fa???????? 720d b805000000 81faffffff0f }
            // n = 4, score = 200
            //   81fa????????         |                     
            //   720d                 | jbe                 0x13e
            //   b805000000           | mov                 ebx, dword ptr [esp + 0x14]
            //   81faffffff0f         | ja                  0x177

        $sequence_5 = { 0f0b 0f0b 90 90 }
            // n = 4, score = 200
            //   0f0b                 | ud2                 
            //   0f0b                 | ud2                 
            //   90                   | dec                 eax
            //   90                   | lea                 edi, [0x2a6ec6]

        $sequence_6 = { b803000000 81f9???????? 721a b804000000 81f9???????? 720d }
            // n = 6, score = 200
            //   b803000000           | mov                 dword ptr [esp + 0x10], 0
            //   81f9????????         |                     
            //   721a                 | mov                 dword ptr [esp + 0xc], eax
            //   b804000000           | mov                 eax, 1
            //   81f9????????         |                     
            //   720d                 | jmp                 0x388

        $sequence_7 = { e8???????? 0f0b 90 55 53 }
            // n = 5, score = 200
            //   e8????????           |                     
            //   0f0b                 | ud2                 
            //   90                   | mov                 ebx, dword ptr [esp + 0x10]
            //   55                   | mov                 ecx, edx
            //   53                   | lea                 eax, [ebx - 0x14c4]

        $sequence_8 = { 8b00 85c0 7e11 83f826 0f95c1 }
            // n = 5, score = 200
            //   8b00                 | dec                 eax
            //   85c0                 | mov                 dword ptr [esp + 0x408], eax
            //   7e11                 | dec                 eax
            //   83f826               | mov                 dword ptr [esp + 0x410], 0
            //   0f95c1               | mov                 eax, 1

        $sequence_9 = { 83f903 7405 83f901 7513 }
            // n = 4, score = 200
            //   83f903               | cmp                 ecx, 2
            //   7405                 | mov                 dword ptr [esp + 0x18], 0
            //   83f901               | jne                 0x1dd
            //   7513                 | test                al, al

    condition:
        7 of them and filesize < 8011776
}