rule win_raccoon_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.raccoon."
        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.raccoon"
        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 = { 85c0 0f85dd000000 57 57 57 }
            // n = 5, score = 2400
            //   85c0                 | test                eax, eax
            //   0f85dd000000         | jne                 0xe3
            //   57                   | push                edi
            //   57                   | push                edi
            //   57                   | push                edi

        $sequence_1 = { 8b3f 56 33c0 50 50 50 50 }
            // n = 7, score = 2400
            //   8b3f                 | mov                 edi, dword ptr [edi]
            //   56                   | push                esi
            //   33c0                 | xor                 eax, eax
            //   50                   | push                eax
            //   50                   | push                eax
            //   50                   | push                eax
            //   50                   | push                eax

        $sequence_2 = { 6819000200 33ff 894df0 57 56 6801000080 ff15???????? }
            // n = 7, score = 2400
            //   6819000200           | push                0x20019
            //   33ff                 | xor                 edi, edi
            //   894df0               | mov                 dword ptr [ebp - 0x10], ecx
            //   57                   | push                edi
            //   56                   | push                esi
            //   6801000080           | push                0x80000001
            //   ff15????????         |                     

        $sequence_3 = { e8???????? 56 e8???????? 83c414 8b33 }
            // n = 5, score = 2400
            //   e8????????           |                     
            //   56                   | push                esi
            //   e8????????           |                     
            //   83c414               | add                 esp, 0x14
            //   8b33                 | mov                 esi, dword ptr [ebx]

        $sequence_4 = { 7409 ff36 57 ff15???????? 833e00 7408 ff36 }
            // n = 7, score = 2400
            //   7409                 | je                  0xb
            //   ff36                 | push                dword ptr [esi]
            //   57                   | push                edi
            //   ff15????????         |                     
            //   833e00               | cmp                 dword ptr [esi], 0
            //   7408                 | je                  0xa
            //   ff36                 | push                dword ptr [esi]

        $sequence_5 = { 8bd6 8bcf e8???????? 6a01 ba???????? 8bcf e8???????? }
            // n = 7, score = 2400
            //   8bd6                 | mov                 edx, esi
            //   8bcf                 | mov                 ecx, edi
            //   e8????????           |                     
            //   6a01                 | push                1
            //   ba????????           |                     
            //   8bcf                 | mov                 ecx, edi
            //   e8????????           |                     

        $sequence_6 = { eb0f 0fbe06 50 e8???????? 59 85c0 7505 }
            // n = 7, score = 2400
            //   eb0f                 | jmp                 0x11
            //   0fbe06               | movsx               eax, byte ptr [esi]
            //   50                   | push                eax
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   85c0                 | test                eax, eax
            //   7505                 | jne                 7

        $sequence_7 = { 8d041f ff75fc 50 e8???????? 8b45f8 83c40c }
            // n = 6, score = 2400
            //   8d041f               | lea                 eax, [edi + ebx]
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   50                   | push                eax
            //   e8????????           |                     
            //   8b45f8               | mov                 eax, dword ptr [ebp - 8]
            //   83c40c               | add                 esp, 0xc

        $sequence_8 = { 833e00 53 740c ff36 ff15???????? 8bd8 }
            // n = 6, score = 2400
            //   833e00               | cmp                 dword ptr [esi], 0
            //   53                   | push                ebx
            //   740c                 | je                  0xe
            //   ff36                 | push                dword ptr [esi]
            //   ff15????????         |                     
            //   8bd8                 | mov                 ebx, eax

        $sequence_9 = { 8b4328 83f806 0f8fa5000000 747e 83e801 7474 }
            // n = 6, score = 2400
            //   8b4328               | mov                 eax, dword ptr [ebx + 0x28]
            //   83f806               | cmp                 eax, 6
            //   0f8fa5000000         | jg                  0xab
            //   747e                 | je                  0x80
            //   83e801               | sub                 eax, 1
            //   7474                 | je                  0x76

    condition:
        7 of them and filesize < 1212416
}