rule win_fuxsocy_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.fuxsocy."
        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.fuxsocy"
        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 = { 8975fc 4f 85ff 75b9 8b75f8 5f 8bc6 }
            // n = 7, score = 200
            //   8975fc               | mov                 dword ptr [ebp - 4], esi
            //   4f                   | dec                 edi
            //   85ff                 | test                edi, edi
            //   75b9                 | jne                 0xffffffbb
            //   8b75f8               | mov                 esi, dword ptr [ebp - 8]
            //   5f                   | pop                 edi
            //   8bc6                 | mov                 eax, esi

        $sequence_1 = { 8b5c2410 8bc2 55 8b29 56 8b30 57 }
            // n = 7, score = 200
            //   8b5c2410             | mov                 ebx, dword ptr [esp + 0x10]
            //   8bc2                 | mov                 eax, edx
            //   55                   | push                ebp
            //   8b29                 | mov                 ebp, dword ptr [ecx]
            //   56                   | push                esi
            //   8b30                 | mov                 esi, dword ptr [eax]
            //   57                   | push                edi

        $sequence_2 = { 85c9 7525 8bc7 47 83f814 7f1d ff15???????? }
            // n = 7, score = 200
            //   85c9                 | test                ecx, ecx
            //   7525                 | jne                 0x27
            //   8bc7                 | mov                 eax, edi
            //   47                   | inc                 edi
            //   83f814               | cmp                 eax, 0x14
            //   7f1d                 | jg                  0x1f
            //   ff15????????         |                     

        $sequence_3 = { 8b2d???????? d1f8 40 50 }
            // n = 4, score = 200
            //   8b2d????????         |                     
            //   d1f8                 | sar                 eax, 1
            //   40                   | inc                 eax
            //   50                   | push                eax

        $sequence_4 = { 85c9 0f8442010000 8d55ec 52 895dec 8b01 6a01 }
            // n = 7, score = 200
            //   85c9                 | test                ecx, ecx
            //   0f8442010000         | je                  0x148
            //   8d55ec               | lea                 edx, [ebp - 0x14]
            //   52                   | push                edx
            //   895dec               | mov                 dword ptr [ebp - 0x14], ebx
            //   8b01                 | mov                 eax, dword ptr [ecx]
            //   6a01                 | push                1

        $sequence_5 = { 50 8d942438020000 e8???????? 668b0d???????? 6a3a 8be8 58 }
            // n = 7, score = 200
            //   50                   | push                eax
            //   8d942438020000       | lea                 edx, [esp + 0x238]
            //   e8????????           |                     
            //   668b0d????????       |                     
            //   6a3a                 | push                0x3a
            //   8be8                 | mov                 ebp, eax
            //   58                   | pop                 eax

        $sequence_6 = { 8d4618 50 57 8d45fc 68???????? 50 e8???????? }
            // n = 7, score = 200
            //   8d4618               | lea                 eax, [esi + 0x18]
            //   50                   | push                eax
            //   57                   | push                edi
            //   8d45fc               | lea                 eax, [ebp - 4]
            //   68????????           |                     
            //   50                   | push                eax
            //   e8????????           |                     

        $sequence_7 = { c3 8b0d???????? 85c9 751a 68000000f0 6a18 }
            // n = 6, score = 200
            //   c3                   | ret                 
            //   8b0d????????         |                     
            //   85c9                 | test                ecx, ecx
            //   751a                 | jne                 0x1c
            //   68000000f0           | push                0xf0000000
            //   6a18                 | push                0x18

        $sequence_8 = { 83c018 8bc8 89442438 e8???????? 8bf8 85ff 0f847b010000 }
            // n = 7, score = 200
            //   83c018               | add                 eax, 0x18
            //   8bc8                 | mov                 ecx, eax
            //   89442438             | mov                 dword ptr [esp + 0x38], eax
            //   e8????????           |                     
            //   8bf8                 | mov                 edi, eax
            //   85ff                 | test                edi, edi
            //   0f847b010000         | je                  0x181

        $sequence_9 = { 8b442410 83c60c 47 3bf8 72cd 8b742414 }
            // n = 6, score = 200
            //   8b442410             | mov                 eax, dword ptr [esp + 0x10]
            //   83c60c               | add                 esi, 0xc
            //   47                   | inc                 edi
            //   3bf8                 | cmp                 edi, eax
            //   72cd                 | jb                  0xffffffcf
            //   8b742414             | mov                 esi, dword ptr [esp + 0x14]

    condition:
        7 of them and filesize < 131072
}