rule win_socks5_systemz_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.socks5_systemz."
        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.socks5_systemz"
        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 = { 50 8d4c2440 e8???????? c744244824000000 8974244c c74424640f000000 c744246000000000 }
            // n = 7, score = 500
            //   50                   | push                eax
            //   8d4c2440             | lea                 ecx, [esp + 0x40]
            //   e8????????           |                     
            //   c744244824000000     | mov                 dword ptr [esp + 0x48], 0x24
            //   8974244c             | mov                 dword ptr [esp + 0x4c], esi
            //   c74424640f000000     | mov                 dword ptr [esp + 0x64], 0xf
            //   c744246000000000     | mov                 dword ptr [esp + 0x60], 0

        $sequence_1 = { 53 ff15???????? 8b0e e8???????? 83c608 3bf7 7593 }
            // n = 7, score = 500
            //   53                   | push                ebx
            //   ff15????????         |                     
            //   8b0e                 | mov                 ecx, dword ptr [esi]
            //   e8????????           |                     
            //   83c608               | add                 esi, 8
            //   3bf7                 | cmp                 esi, edi
            //   7593                 | jne                 0xffffff95

        $sequence_2 = { 59 59 5d c3 a1???????? c3 6a08 }
            // n = 7, score = 500
            //   59                   | pop                 ecx
            //   59                   | pop                 ecx
            //   5d                   | pop                 ebp
            //   c3                   | ret                 
            //   a1????????           |                     
            //   c3                   | ret                 
            //   6a08                 | push                8

        $sequence_3 = { 53 e8???????? 8b5c241c 8bd0 83c408 8bca 33c0 }
            // n = 7, score = 500
            //   53                   | push                ebx
            //   e8????????           |                     
            //   8b5c241c             | mov                 ebx, dword ptr [esp + 0x1c]
            //   8bd0                 | mov                 edx, eax
            //   83c408               | add                 esp, 8
            //   8bca                 | mov                 ecx, edx
            //   33c0                 | xor                 eax, eax

        $sequence_4 = { 8d4c2414 e8???????? c744241c01000000 89742420 c74424380f000000 c744243400000000 c644242400 }
            // n = 7, score = 500
            //   8d4c2414             | lea                 ecx, [esp + 0x14]
            //   e8????????           |                     
            //   c744241c01000000     | mov                 dword ptr [esp + 0x1c], 1
            //   89742420             | mov                 dword ptr [esp + 0x20], esi
            //   c74424380f000000     | mov                 dword ptr [esp + 0x38], 0xf
            //   c744243400000000     | mov                 dword ptr [esp + 0x34], 0
            //   c644242400           | mov                 byte ptr [esp + 0x24], 0

        $sequence_5 = { 50 ff7314 ff7310 e8???????? 8b4310 83c410 8b3d???????? }
            // n = 7, score = 500
            //   50                   | push                eax
            //   ff7314               | push                dword ptr [ebx + 0x14]
            //   ff7310               | push                dword ptr [ebx + 0x10]
            //   e8????????           |                     
            //   8b4310               | mov                 eax, dword ptr [ebx + 0x10]
            //   83c410               | add                 esp, 0x10
            //   8b3d????????         |                     

        $sequence_6 = { 33c4 50 8d442424 64a300000000 a1???????? 83f8ff 7508 }
            // n = 7, score = 500
            //   33c4                 | xor                 eax, esp
            //   50                   | push                eax
            //   8d442424             | lea                 eax, [esp + 0x24]
            //   64a300000000         | mov                 dword ptr fs:[0], eax
            //   a1????????           |                     
            //   83f8ff               | cmp                 eax, -1
            //   7508                 | jne                 0xa

        $sequence_7 = { 0f8393000000 8b07 89442404 8d442404 50 e8???????? f744240400000080 }
            // n = 7, score = 500
            //   0f8393000000         | jae                 0x99
            //   8b07                 | mov                 eax, dword ptr [edi]
            //   89442404             | mov                 dword ptr [esp + 4], eax
            //   8d442404             | lea                 eax, [esp + 4]
            //   50                   | push                eax
            //   e8????????           |                     
            //   f744240400000080     | test                dword ptr [esp + 4], 0x80000000

    condition:
        7 of them and filesize < 1417216
}