rule win_jfmbackdoor_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.jfmbackdoor."
        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.jfmbackdoor"
        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 = { 8d4540 6880000000 50 50 e8???????? 55 e8???????? }
            // n = 7, score = 100
            //   8d4540               | lea                 eax, [ebp + 0x40]
            //   6880000000           | push                0x80
            //   50                   | push                eax
            //   50                   | push                eax
            //   e8????????           |                     
            //   55                   | push                ebp
            //   e8????????           |                     

        $sequence_1 = { c1c105 81c19979825a 8b402c 89442444 8bc3 034c2444 33c2 }
            // n = 7, score = 100
            //   c1c105               | rol                 ecx, 5
            //   81c19979825a         | add                 ecx, 0x5a827999
            //   8b402c               | mov                 eax, dword ptr [eax + 0x2c]
            //   89442444             | mov                 dword ptr [esp + 0x44], eax
            //   8bc3                 | mov                 eax, ebx
            //   034c2444             | add                 ecx, dword ptr [esp + 0x44]
            //   33c2                 | xor                 eax, edx

        $sequence_2 = { 8d4614 50 e8???????? 83c404 85c0 0f85fa050000 8d4614 }
            // n = 7, score = 100
            //   8d4614               | lea                 eax, [esi + 0x14]
            //   50                   | push                eax
            //   e8????????           |                     
            //   83c404               | add                 esp, 4
            //   85c0                 | test                eax, eax
            //   0f85fa050000         | jne                 0x600
            //   8d4614               | lea                 eax, [esi + 0x14]

        $sequence_3 = { ba???????? b904000000 e9???????? ba???????? b908000000 e9???????? ba???????? }
            // n = 7, score = 100
            //   ba????????           |                     
            //   b904000000           | mov                 ecx, 4
            //   e9????????           |                     
            //   ba????????           |                     
            //   b908000000           | mov                 ecx, 8
            //   e9????????           |                     
            //   ba????????           |                     

        $sequence_4 = { 8bf0 83c41c 85f6 0f8526030000 8d442464 c744242403000000 89442428 }
            // n = 7, score = 100
            //   8bf0                 | mov                 esi, eax
            //   83c41c               | add                 esp, 0x1c
            //   85f6                 | test                esi, esi
            //   0f8526030000         | jne                 0x32c
            //   8d442464             | lea                 eax, [esp + 0x64]
            //   c744242403000000     | mov                 dword ptr [esp + 0x24], 3
            //   89442428             | mov                 dword ptr [esp + 0x28], eax

        $sequence_5 = { e8???????? 83c404 c744240801000000 57 e8???????? 83c404 8d4620 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   83c404               | add                 esp, 4
            //   c744240801000000     | mov                 dword ptr [esp + 8], 1
            //   57                   | push                edi
            //   e8????????           |                     
            //   83c404               | add                 esp, 4
            //   8d4620               | lea                 eax, [esi + 0x20]

        $sequence_6 = { 8d854cfbffff 50 ff15???????? 85c0 0f84e8040000 80bd1ffbffff00 0f84de000000 }
            // n = 7, score = 100
            //   8d854cfbffff         | lea                 eax, [ebp - 0x4b4]
            //   50                   | push                eax
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax
            //   0f84e8040000         | je                  0x4ee
            //   80bd1ffbffff00       | cmp                 byte ptr [ebp - 0x4e1], 0
            //   0f84de000000         | je                  0xe4

        $sequence_7 = { 8988f8010000 8990fc010000 85f6 7421 83c8ff f00fc14604 7517 }
            // n = 7, score = 100
            //   8988f8010000         | mov                 dword ptr [eax + 0x1f8], ecx
            //   8990fc010000         | mov                 dword ptr [eax + 0x1fc], edx
            //   85f6                 | test                esi, esi
            //   7421                 | je                  0x23
            //   83c8ff               | or                  eax, 0xffffffff
            //   f00fc14604           | lock xadd           dword ptr [esi + 4], eax
            //   7517                 | jne                 0x19

        $sequence_8 = { 8d5824 895c2418 3be8 7522 0f104058 0f11442424 0f104068 }
            // n = 7, score = 100
            //   8d5824               | lea                 ebx, [eax + 0x24]
            //   895c2418             | mov                 dword ptr [esp + 0x18], ebx
            //   3be8                 | cmp                 ebp, eax
            //   7522                 | jne                 0x24
            //   0f104058             | movups              xmm0, xmmword ptr [eax + 0x58]
            //   0f11442424           | movups              xmmword ptr [esp + 0x24], xmm0
            //   0f104068             | movups              xmm0, xmmword ptr [eax + 0x68]

        $sequence_9 = { ff15???????? 6689459a 8b8588fdffff 8bc8 898560fdffff 83781410 7208 }
            // n = 7, score = 100
            //   ff15????????         |                     
            //   6689459a             | mov                 word ptr [ebp - 0x66], ax
            //   8b8588fdffff         | mov                 eax, dword ptr [ebp - 0x278]
            //   8bc8                 | mov                 ecx, eax
            //   898560fdffff         | mov                 dword ptr [ebp - 0x2a0], eax
            //   83781410             | cmp                 dword ptr [eax + 0x14], 0x10
            //   7208                 | jb                  0xa

    condition:
        7 of them and filesize < 2339840
}