rule win_cargobay_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.cargobay."
        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.cargobay"
        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 = { e8???????? 4883bc240001000000 0f8497000000 488db42408010000 488dbc2450020000 41b8d8000000 4889f9 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   4883bc240001000000     | jmp    0x8a8
            //   0f8497000000         | inc                 ebp
            //   488db42408010000     | xor                 ecx, ecx
            //   488dbc2450020000     | xor                 eax, eax
            //   41b8d8000000         | jae                 0x8b9
            //   4889f9               | test                dl, dl

        $sequence_1 = { f30f7f00 49ffc7 4883c6d0 e9???????? 488b4c2450 482b4c2428 488b442430 }
            // n = 7, score = 100
            //   f30f7f00             | lea                 ecx, [esp + 0xa0]
            //   49ffc7               | test                eax, eax
            //   4883c6d0             | je                  0xfffff63e
            //   e9????????           |                     
            //   488b4c2450           | test                eax, eax
            //   482b4c2428           | je                  0x660
            //   488b442430           | mov                 ebx, eax

        $sequence_2 = { e8???????? 488d5c2420 4889d9 4c89fa 4989f8 e8???????? 0f1003 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488d5c2420           | jmp                 0x8fa
            //   4889d9               | dec                 eax
            //   4c89fa               | cmp                 edx, dword ptr [ebp - 0x18]
            //   4989f8               | jne                 0x8e1
            //   e8????????           |                     
            //   0f1003               | dec                 eax

        $sequence_3 = { e8???????? 488b4618 4885c0 741e 486bd038 488b4e10 41b808000000 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488b4618             | je                  0x13b
            //   4885c0               | dec                 eax
            //   741e                 | lea                 edi, [ecx + 0x58]
            //   486bd038             | dec                 eax
            //   488b4e10             | mov                 eax, dword ptr [ecx]
            //   41b808000000         | dec                 eax

        $sequence_4 = { eb1c 80fb5b 7517 c6462800 ebaa 83f82c 750c }
            // n = 7, score = 100
            //   eb1c                 | je                  0x211
            //   80fb5b               | movzx               eax, byte ptr [ecx]
            //   7517                 | cmp                 eax, 0x22
            //   c6462800             | dec                 eax
            //   ebaa                 | lea                 ecx, [ebx + 0x200]
            //   83f82c               | je                  0x294
            //   750c                 | cmp                 eax, 0x2d

        $sequence_5 = { e8???????? 3c14 759e 488b842488000000 483b842480000000 758c eb12 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   3c14                 | movzx               edx, dx
            //   759e                 | dec                 eax
            //   488b842488000000     | lea                 ebx, [0xc9798]
            //   483b842480000000     | movzx               edx, word ptr [ebx + edx*2]
            //   758c                 | imul                ecx, ecx, 0x147b
            //   eb12                 | shr                 ecx, 0x11

        $sequence_6 = { 488d4d70 e8???????? 488d8d88000000 e8???????? 488d4dc0 e8???????? 0f28742420 }
            // n = 7, score = 100
            //   488d4d70             | dec                 eax
            //   e8????????           |                     
            //   488d8d88000000       | lea                 ecx, [esp + 0x20]
            //   e8????????           |                     
            //   488d4dc0             | movups              xmmword ptr [ecx + 8], xmm0
            //   e8????????           |                     
            //   0f28742420           | dec                 eax

        $sequence_7 = { 56 57 53 4883ec50 4889ce 4c8b9c24a0000000 488b8210020000 }
            // n = 7, score = 100
            //   56                   | dec                 esp
            //   57                   | add                 ecx, ecx
            //   53                   | dec                 esp
            //   4883ec50             | mov                 ebp, dword ptr [esp + 0x20]
            //   4889ce               | dec                 ecx
            //   4c8b9c24a0000000     | rol                 esp, 0x30
            //   488b8210020000       | dec                 ecx

        $sequence_8 = { 4889f1 4889fa e8???????? 488b06 4885c0 7479 488b4c2438 }
            // n = 7, score = 100
            //   4889f1               | mov                 ebx, dword ptr [edi + 0x10]
            //   4889fa               | dec                 eax
            //   e8????????           |                     
            //   488b06               | mov                 eax, dword ptr [edi + 0x20]
            //   4885c0               | dec                 eax
            //   7479                 | mov                 edi, dword ptr [edi + 0x28]
            //   488b4c2438           | dec                 eax

        $sequence_9 = { 488d1d703c0d00 e8???????? 0f57f6 410f11b424c8000000 410f11b424b8000000 410f11b424a8000000 410f11b42498000000 }
            // n = 7, score = 100
            //   488d1d703c0d00       | mov                 ecx, dword ptr [esi]
            //   e8????????           |                     
            //   0f57f6               | dec                 eax
            //   410f11b424c8000000     | mov    edx, dword ptr [esi + 0x10]
            //   410f11b424b8000000     | dec    eax
            //   410f11b424a8000000     | test    ecx, ecx
            //   410f11b42498000000     | jne    0x4b9

    condition:
        7 of them and filesize < 3432448
}