rule win_socks5_systemz_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-05-04"
        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 = "20260422"
        malpedia_hash = "a182e35da64e6d71cb55f125c4d4225196523f14"
        malpedia_version = "20260504"
        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 = { c744241800000000 c744240801000000 ff742420 8bce e8???????? 8b4640 c706???????? }
            // n = 7, score = 500
            //   c744241800000000     | mov                 dword ptr [esp + 0x18], 0
            //   c744240801000000     | mov                 dword ptr [esp + 8], 1
            //   ff742420             | push                dword ptr [esp + 0x20]
            //   8bce                 | mov                 ecx, esi
            //   e8????????           |                     
            //   8b4640               | mov                 eax, dword ptr [esi + 0x40]
            //   c706????????         |                     

        $sequence_1 = { 0f840f000000 8365ecfe 8b4df0 83c148 e9???????? c3 8b542408 }
            // n = 7, score = 500
            //   0f840f000000         | je                  0x15
            //   8365ecfe             | and                 dword ptr [ebp - 0x14], 0xfffffffe
            //   8b4df0               | mov                 ecx, dword ptr [ebp - 0x10]
            //   83c148               | add                 ecx, 0x48
            //   e9????????           |                     
            //   c3                   | ret                 
            //   8b542408             | mov                 edx, dword ptr [esp + 8]

        $sequence_2 = { 50 8d442410 64a300000000 8bf1 6a4c e8???????? 8bc8 }
            // n = 7, score = 500
            //   50                   | push                eax
            //   8d442410             | lea                 eax, [esp + 0x10]
            //   64a300000000         | mov                 dword ptr fs:[0], eax
            //   8bf1                 | mov                 esi, ecx
            //   6a4c                 | push                0x4c
            //   e8????????           |                     
            //   8bc8                 | mov                 ecx, eax

        $sequence_3 = { 50 ffd3 56 e8???????? 83c404 83c704 3bfd }
            // n = 7, score = 500
            //   50                   | push                eax
            //   ffd3                 | call                ebx
            //   56                   | push                esi
            //   e8????????           |                     
            //   83c404               | add                 esp, 4
            //   83c704               | add                 edi, 4
            //   3bfd                 | cmp                 edi, ebp

        $sequence_4 = { 7407 51 ff15???????? 897e0c 5f 8b460c 5e }
            // n = 7, score = 500
            //   7407                 | je                  9
            //   51                   | push                ecx
            //   ff15????????         |                     
            //   897e0c               | mov                 dword ptr [esi + 0xc], edi
            //   5f                   | pop                 edi
            //   8b460c               | mov                 eax, dword ptr [esi + 0xc]
            //   5e                   | pop                 esi

        $sequence_5 = { 0f8ee5000000 f00fba2b1e 0f82da000000 8bcb e8???????? 50 e9???????? }
            // n = 7, score = 500
            //   0f8ee5000000         | jle                 0xeb
            //   f00fba2b1e           | lock bts            dword ptr [ebx], 0x1e
            //   0f82da000000         | jb                  0xe0
            //   8bcb                 | mov                 ecx, ebx
            //   e8????????           |                     
            //   50                   | push                eax
            //   e9????????           |                     

        $sequence_6 = { 50 8d442454 50 e8???????? 50 8d442410 c78424a400000000000000 }
            // n = 7, score = 500
            //   50                   | push                eax
            //   8d442454             | lea                 eax, [esp + 0x54]
            //   50                   | push                eax
            //   e8????????           |                     
            //   50                   | push                eax
            //   8d442410             | lea                 eax, [esp + 0x10]
            //   c78424a400000000000000     | mov    dword ptr [esp + 0xa4], 0

        $sequence_7 = { 57 8d7e10 750a 51 57 e8???????? 83c408 }
            // n = 7, score = 500
            //   57                   | push                edi
            //   8d7e10               | lea                 edi, [esi + 0x10]
            //   750a                 | jne                 0xc
            //   51                   | push                ecx
            //   57                   | push                edi
            //   e8????????           |                     
            //   83c408               | add                 esp, 8

    condition:
        7 of them and filesize < 1417216
}