rule win_rad_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.rad."
        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.rad"
        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 = { e9???????? 8d8d58fdffff ff25???????? 8db540fbffff e9???????? 8db55cfbffff }
            // n = 6, score = 100
            //   e9????????           |                     
            //   8d8d58fdffff         | lea                 ecx, [ebp - 0x2a8]
            //   ff25????????         |                     
            //   8db540fbffff         | lea                 esi, [ebp - 0x4c0]
            //   e9????????           |                     
            //   8db55cfbffff         | lea                 esi, [ebp - 0x4a4]

        $sequence_1 = { c684240001000007 85f6 7417 8bce ff15???????? c706???????? }
            // n = 6, score = 100
            //   c684240001000007     | mov                 byte ptr [esp + 0x100], 7
            //   85f6                 | test                esi, esi
            //   7417                 | je                  0x19
            //   8bce                 | mov                 ecx, esi
            //   ff15????????         |                     
            //   c706????????         |                     

        $sequence_2 = { 7305 83c8ff eb08 33c0 83fb0a 0f95c0 85c0 }
            // n = 7, score = 100
            //   7305                 | jae                 7
            //   83c8ff               | or                  eax, 0xffffffff
            //   eb08                 | jmp                 0xa
            //   33c0                 | xor                 eax, eax
            //   83fb0a               | cmp                 ebx, 0xa
            //   0f95c0               | setne               al
            //   85c0                 | test                eax, eax

        $sequence_3 = { 7533 8b8568fbffff c645fc05 8b487c 8b11 8b4204 6a02 }
            // n = 7, score = 100
            //   7533                 | jne                 0x35
            //   8b8568fbffff         | mov                 eax, dword ptr [ebp - 0x498]
            //   c645fc05             | mov                 byte ptr [ebp - 4], 5
            //   8b487c               | mov                 ecx, dword ptr [eax + 0x7c]
            //   8b11                 | mov                 edx, dword ptr [ecx]
            //   8b4204               | mov                 eax, dword ptr [edx + 4]
            //   6a02                 | push                2

        $sequence_4 = { 56 8d7098 8b4664 50 c706???????? ff15???????? 83c404 }
            // n = 7, score = 100
            //   56                   | push                esi
            //   8d7098               | lea                 esi, [eax - 0x68]
            //   8b4664               | mov                 eax, dword ptr [esi + 0x64]
            //   50                   | push                eax
            //   c706????????         |                     
            //   ff15????????         |                     
            //   83c404               | add                 esp, 4

        $sequence_5 = { c745fc00000000 8b5e48 b9???????? 894dec }
            // n = 4, score = 100
            //   c745fc00000000       | mov                 dword ptr [ebp - 4], 0
            //   8b5e48               | mov                 ebx, dword ptr [esi + 0x48]
            //   b9????????           |                     
            //   894dec               | mov                 dword ptr [ebp - 0x14], ecx

        $sequence_6 = { 8b4720 50 e8???????? 8d4f04 c645fc00 }
            // n = 5, score = 100
            //   8b4720               | mov                 eax, dword ptr [edi + 0x20]
            //   50                   | push                eax
            //   e8????????           |                     
            //   8d4f04               | lea                 ecx, [edi + 4]
            //   c645fc00             | mov                 byte ptr [ebp - 4], 0

        $sequence_7 = { 50 c645fc04 e8???????? 8d4f64 83c408 51 50 }
            // n = 7, score = 100
            //   50                   | push                eax
            //   c645fc04             | mov                 byte ptr [ebp - 4], 4
            //   e8????????           |                     
            //   8d4f64               | lea                 ecx, [edi + 0x64]
            //   83c408               | add                 esp, 8
            //   51                   | push                ecx
            //   50                   | push                eax

        $sequence_8 = { 8b4e50 8b01 8b5004 837c0a0c00 }
            // n = 4, score = 100
            //   8b4e50               | mov                 ecx, dword ptr [esi + 0x50]
            //   8b01                 | mov                 eax, dword ptr [ecx]
            //   8b5004               | mov                 edx, dword ptr [eax + 4]
            //   837c0a0c00           | cmp                 dword ptr [edx + ecx + 0xc], 0

        $sequence_9 = { 85c0 7514 83fb07 7305 83c8ff eb08 33c0 }
            // n = 7, score = 100
            //   85c0                 | test                eax, eax
            //   7514                 | jne                 0x16
            //   83fb07               | cmp                 ebx, 7
            //   7305                 | jae                 7
            //   83c8ff               | or                  eax, 0xffffffff
            //   eb08                 | jmp                 0xa
            //   33c0                 | xor                 eax, eax

    condition:
        7 of them and filesize < 207872
}