rule win_sfile_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.sfile."
        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.sfile"
        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 = { 8b4508 8b4810 81c1e8030000 894df8 }
            // n = 4, score = 300
            //   8b4508               | mov                 eax, dword ptr [ebp + 8]
            //   8b4810               | mov                 ecx, dword ptr [eax + 0x10]
            //   81c1e8030000         | add                 ecx, 0x3e8
            //   894df8               | mov                 dword ptr [ebp - 8], ecx

        $sequence_1 = { c745ec00000000 c745f400000000 8b4d0c 51 }
            // n = 4, score = 300
            //   c745ec00000000       | mov                 dword ptr [ebp - 0x14], 0
            //   c745f400000000       | mov                 dword ptr [ebp - 0xc], 0
            //   8b4d0c               | mov                 ecx, dword ptr [ebp + 0xc]
            //   51                   | push                ecx

        $sequence_2 = { c7818805000000000000 8b55f8 c7828005000000000000 8b45f8 }
            // n = 4, score = 300
            //   c7818805000000000000     | mov    dword ptr [ecx + 0x588], 0
            //   8b55f8               | mov                 edx, dword ptr [ebp - 8]
            //   c7828005000000000000     | mov    dword ptr [edx + 0x580], 0
            //   8b45f8               | mov                 eax, dword ptr [ebp - 8]

        $sequence_3 = { 8bec 83ec10 c745f000000000 6a48 e8???????? }
            // n = 5, score = 300
            //   8bec                 | mov                 ebp, esp
            //   83ec10               | sub                 esp, 0x10
            //   c745f000000000       | mov                 dword ptr [ebp - 0x10], 0
            //   6a48                 | push                0x48
            //   e8????????           |                     

        $sequence_4 = { e8???????? 8b4df8 83795800 740d 8b55f8 }
            // n = 5, score = 300
            //   e8????????           |                     
            //   8b4df8               | mov                 ecx, dword ptr [ebp - 8]
            //   83795800             | cmp                 dword ptr [ecx + 0x58], 0
            //   740d                 | je                  0xf
            //   8b55f8               | mov                 edx, dword ptr [ebp - 8]

        $sequence_5 = { c745cc00000000 c785b8fdffff04000000 83bdb8fdffff08 7309 c745fc08000000 eb09 }
            // n = 6, score = 300
            //   c745cc00000000       | mov                 dword ptr [ebp - 0x34], 0
            //   c785b8fdffff04000000     | mov    dword ptr [ebp - 0x248], 4
            //   83bdb8fdffff08       | cmp                 dword ptr [ebp - 0x248], 8
            //   7309                 | jae                 0xb
            //   c745fc08000000       | mov                 dword ptr [ebp - 4], 8
            //   eb09                 | jmp                 0xb

        $sequence_6 = { 8b55f8 8b4128 2b4224 50 }
            // n = 4, score = 300
            //   8b55f8               | mov                 edx, dword ptr [ebp - 8]
            //   8b4128               | mov                 eax, dword ptr [ecx + 0x28]
            //   2b4224               | sub                 eax, dword ptr [edx + 0x24]
            //   50                   | push                eax

        $sequence_7 = { 8b5508 8b4210 8b4a14 8b55fc }
            // n = 4, score = 300
            //   8b5508               | mov                 edx, dword ptr [ebp + 8]
            //   8b4210               | mov                 eax, dword ptr [edx + 0x10]
            //   8b4a14               | mov                 ecx, dword ptr [edx + 0x14]
            //   8b55fc               | mov                 edx, dword ptr [ebp - 4]

        $sequence_8 = { 8b751c 8b4d20 f3a4 837d0802 }
            // n = 4, score = 300
            //   8b751c               | mov                 esi, dword ptr [ebp + 0x1c]
            //   8b4d20               | mov                 ecx, dword ptr [ebp + 0x20]
            //   f3a4                 | rep movsb           byte ptr es:[edi], byte ptr [esi]
            //   837d0802             | cmp                 dword ptr [ebp + 8], 2

        $sequence_9 = { 7434 8b4508 83780400 740d 8b4d08 8b5104 }
            // n = 6, score = 300
            //   7434                 | je                  0x36
            //   8b4508               | mov                 eax, dword ptr [ebp + 8]
            //   83780400             | cmp                 dword ptr [eax + 4], 0
            //   740d                 | je                  0xf
            //   8b4d08               | mov                 ecx, dword ptr [ebp + 8]
            //   8b5104               | mov                 edx, dword ptr [ecx + 4]

    condition:
        7 of them and filesize < 588800
}