rule win_gh0sttimes_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.gh0sttimes."
        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.gh0sttimes"
        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 = { 742a 8b432c 83f804 7422 83f802 }
            // n = 5, score = 800
            //   742a                 | je                  0x2c
            //   8b432c               | mov                 eax, dword ptr [ebx + 0x2c]
            //   83f804               | cmp                 eax, 4
            //   7422                 | je                  0x24
            //   83f802               | cmp                 eax, 2

        $sequence_1 = { 7f06 43 83fb0f 7cde 83fb0f }
            // n = 5, score = 800
            //   7f06                 | jg                  8
            //   43                   | inc                 ebx
            //   83fb0f               | cmp                 ebx, 0xf
            //   7cde                 | jl                  0xffffffe0
            //   83fb0f               | cmp                 ebx, 0xf

        $sequence_2 = { 83c40c 52 6a40 ff15???????? 8b8decfbffff 8b5710 6a00 }
            // n = 7, score = 800
            //   83c40c               | add                 esp, 0xc
            //   52                   | push                edx
            //   6a40                 | push                0x40
            //   ff15????????         |                     
            //   8b8decfbffff         | mov                 ecx, dword ptr [ebp - 0x414]
            //   8b5710               | mov                 edx, dword ptr [edi + 0x10]
            //   6a00                 | push                0

        $sequence_3 = { 80bdd0fcffff2e 7448 f685a4fcffff10 8d85d0fcffff }
            // n = 4, score = 800
            //   80bdd0fcffff2e       | cmp                 byte ptr [ebp - 0x330], 0x2e
            //   7448                 | je                  0x4a
            //   f685a4fcffff10       | test                byte ptr [ebp - 0x35c], 0x10
            //   8d85d0fcffff         | lea                 eax, [ebp - 0x330]

        $sequence_4 = { 56 52 ff15???????? 8b85f0fbffff 50 8bce }
            // n = 6, score = 800
            //   56                   | push                esi
            //   52                   | push                edx
            //   ff15????????         |                     
            //   8b85f0fbffff         | mov                 eax, dword ptr [ebp - 0x410]
            //   50                   | push                eax
            //   8bce                 | mov                 ecx, esi

        $sequence_5 = { e8???????? 57 8bf0 ff15???????? 8b959cfdffff }
            // n = 5, score = 800
            //   e8????????           |                     
            //   57                   | push                edi
            //   8bf0                 | mov                 esi, eax
            //   ff15????????         |                     
            //   8b959cfdffff         | mov                 edx, dword ptr [ebp - 0x264]

        $sequence_6 = { 6a00 c70200000000 68???????? c70300000000 e8???????? 8bf0 85f6 }
            // n = 7, score = 800
            //   6a00                 | push                0
            //   c70200000000         | mov                 dword ptr [edx], 0
            //   68????????           |                     
            //   c70300000000         | mov                 dword ptr [ebx], 0
            //   e8????????           |                     
            //   8bf0                 | mov                 esi, eax
            //   85f6                 | test                esi, esi

        $sequence_7 = { 899574fbffff c78570fbffff01000000 ff15???????? 85c0 }
            // n = 4, score = 800
            //   899574fbffff         | mov                 dword ptr [ebp - 0x48c], edx
            //   c78570fbffff01000000     | mov    dword ptr [ebp - 0x490], 1
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax

        $sequence_8 = { 488b442420 8b4018 394128 7502 eb5a }
            // n = 5, score = 600
            //   488b442420           | dec                 eax
            //   8b4018               | test                ecx, ecx
            //   394128               | je                  0x13
            //   7502                 | dec                 eax
            //   eb5a                 | xor                 eax, esp

        $sequence_9 = { c740089a020000 837c244800 7407 837c244802 7521 }
            // n = 5, score = 600
            //   c740089a020000       | mov                 eax, dword ptr [ecx + 8]
            //   837c244800           | dec                 eax
            //   7407                 | mov                 eax, dword ptr [esp + 0x20]
            //   837c244802           | mov                 eax, dword ptr [eax + 0x18]
            //   7521                 | cmp                 dword ptr [ecx + 0x28], eax

        $sequence_10 = { 488d4c2458 488d1539d10200 e8???????? 488b8f38010000 }
            // n = 4, score = 600
            //   488d4c2458           | dec                 eax
            //   488d1539d10200       | mov                 dword ptr [esp + 0x860], eax
            //   e8????????           |                     
            //   488b8f38010000       | dec                 eax

        $sequence_11 = { 488b8ba0000000 4889bb98000000 4885c9 740e }
            // n = 4, score = 600
            //   488b8ba0000000       | lea                 ecx, [esp + 0x50]
            //   4889bb98000000       | dec                 eax
            //   4885c9               | mov                 ecx, dword ptr [ebx + 0x130]
            //   740e                 | dec                 eax

        $sequence_12 = { 33d2 33c9 ff15???????? 4889842480000000 }
            // n = 4, score = 600
            //   33d2                 | dec                 eax
            //   33c9                 | lea                 edx, [0x2d139]
            //   ff15????????         |                     
            //   4889842480000000     | dec                 eax

        $sequence_13 = { 4889442469 4889442471 4889442479 88842481000000 ff15???????? }
            // n = 5, score = 600
            //   4889442469           | jne                 0xa
            //   4889442471           | jmp                 0x64
            //   4889442479           | dec                 eax
            //   88842481000000       | lea                 ecx, [esp + 0x58]
            //   ff15????????         |                     

        $sequence_14 = { 488b05???????? 4833c4 4889842460080000 488b4108 }
            // n = 4, score = 600
            //   488b05????????       |                     
            //   4833c4               | mov                 ecx, dword ptr [ebx + 0xa0]
            //   4889842460080000     | dec                 eax
            //   488b4108             | mov                 dword ptr [ebx + 0x98], edi

        $sequence_15 = { 89542420 488d15c3d20200 488d4c2450 e8???????? 488b8b30010000 }
            // n = 5, score = 600
            //   89542420             | mov                 dword ptr [esp + 0x20], edx
            //   488d15c3d20200       | dec                 eax
            //   488d4c2450           | lea                 edx, [0x2d2c3]
            //   e8????????           |                     
            //   488b8b30010000       | dec                 eax

    condition:
        7 of them and filesize < 548864
}