rule win_3cx_backdoor_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.3cx_backdoor."
        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.3cx_backdoor"
        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 = { 448be6 4183e43f 410fbaec07 81feff070000 7f0d 81ce00300000 c1ee06 }
            // n = 7, score = 100
            //   448be6               | dec                 eax
            //   4183e43f             | mov                 ebx, eax
            //   410fbaec07           | dec                 esp
            //   81feff070000         | mov                 eax, dword ptr [eax + 0x10]
            //   7f0d                 | ja                  0xf5f
            //   81ce00300000         | dec                 esp
            //   c1ee06               | mov                 dword ptr [esp + 0x60], esi

        $sequence_1 = { 894640 83f80d 0f84ebf9ffff 83f80a 0f85d1070000 48834310f8 4c8b85e0010000 }
            // n = 7, score = 100
            //   894640               | dec                 eax
            //   83f80d               | mov                 dword ptr [esp + 0x20], eax
            //   0f84ebf9ffff         | mov                 edx, 0xfff
            //   83f80a               | dec                 eax
            //   0f85d1070000         | lea                 ecx, [ebp + 0x1e0]
            //   48834310f8           | inc                 ebp
            //   4c8b85e0010000       | mov                 ecx, esi

        $sequence_2 = { 448826 48894608 498b07 48894608 c60605 4d8b4608 498b06 }
            // n = 7, score = 100
            //   448826               | mov                 eax, ecx
            //   48894608             | jne                 0xc16
            //   498b07               | dec                 eax
            //   48894608             | lea                 edx, [ebx + 0x98]
            //   c60605               | dec                 ecx
            //   4d8b4608             | mov                 ecx, ebp
            //   498b06               | test                al, al

        $sequence_3 = { 4883c0f8 4883f81f 0f8779010000 e8???????? 4c897c2478 }
            // n = 5, score = 100
            //   4883c0f8             | movzx               eax, byte ptr [eax + ebp + 0x73fc]
            //   4883f81f             | inc                 ecx
            //   0f8779010000         | mov                 ecx, dword ptr [ebp + eax*4 + 0x73d4]
            //   e8????????           |                     
            //   4c897c2478           | dec                 ecx

        $sequence_4 = { e8???????? 83f82a 0f84aa000000 83f82f 7413 488d052d460300 }
            // n = 6, score = 100
            //   e8????????           |                     
            //   83f82a               | mov                 dword ptr [esp + 0x50], 0xf
            //   0f84aa000000         | inc                 eax
            //   83f82f               | mov                 byte ptr [esp + 0x38], dh
            //   7413                 | cmp                 eax, 0x2a
            //   488d052d460300       | je                  0x544

        $sequence_5 = { 493bec e9???????? 488bc3 4c8d3d4187feff 498784f708240400 4885c0 7409 }
            // n = 7, score = 100
            //   493bec               | mov                 edx, esi
            //   e9????????           |                     
            //   488bc3               | dec                 eax
            //   4c8d3d4187feff       | cmp                 dword ptr [esi + 0x18], 0x10
            //   498784f708240400     | jb                  0x916
            //   4885c0               | dec                 eax
            //   7409                 | mov                 edx, dword ptr [esi]

        $sequence_6 = { 0f85eb020000 498b08 4c3bc9 0f85ea000000 498b4810 80791800 756d }
            // n = 7, score = 100
            //   0f85eb020000         | mov                 edx, 0x50
            //   498b08               | dec                 eax
            //   4c3bc9               | add                 esp, 0x20
            //   0f85ea000000         | pop                 ebx
            //   498b4810             | dec                 eax
            //   80791800             | mov                 ebx, dword ptr [eax]
            //   756d                 | dec                 eax

        $sequence_7 = { ffe1 0f57c0 0f11442460 b910000000 e8???????? 488bd8 }
            // n = 6, score = 100
            //   ffe1                 | lea                 edx, [0x1b12c]
            //   0f57c0               | dec                 eax
            //   0f11442460           | lea                 ecx, [0x1b185]
            //   b910000000           | ret                 
            //   e8????????           |                     
            //   488bd8               | dec                 eax

        $sequence_8 = { 488b9598000000 4883fa10 0f8294090000 48ffc2 488b8d80000000 488bc1 4881fa00100000 }
            // n = 7, score = 100
            //   488b9598000000       | dec                 eax
            //   4883fa10             | sub                 esp, 0x40
            //   0f8294090000         | dec                 eax
            //   48ffc2               | xor                 eax, esp
            //   488b8d80000000       | dec                 eax
            //   488bc1               | mov                 dword ptr [esp + 0x38], eax
            //   4881fa00100000       | dec                 eax

        $sequence_9 = { 0f84f6140000 498bcc e8???????? 894340 83f80c 0f85af050000 c6859001000000 }
            // n = 7, score = 100
            //   0f84f6140000         | mov                 esp, 0x19
            //   498bcc               | dec                 esp
            //   e8????????           |                     
            //   894340               | mov                 dword ptr [esp + 0x28], esp
            //   83f80c               | dec                 esp
            //   0f85af050000         | lea                 esi, [0x31537]
            //   c6859001000000       | inc                 ebp

    condition:
        7 of them and filesize < 585728
}