rule win_gtpdoor_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.gtpdoor."
        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.gtpdoor"
        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 = { fc b932000000 b800000000 f3aa }
            // n = 4, score = 200
            //   fc                   | cld                 
            //   b932000000           | mov                 ecx, 0x32
            //   b800000000           | mov                 eax, 0
            //   f3aa                 | rep stosb           byte ptr es:[edi], al

        $sequence_1 = { 0fb600 31d0 8801 8045fb01 8345fc01 }
            // n = 5, score = 200
            //   0fb600               | movzx               eax, byte ptr [eax]
            //   31d0                 | xor                 eax, edx
            //   8801                 | mov                 byte ptr [ecx], al
            //   8045fb01             | add                 byte ptr [ebp - 5], 1
            //   8345fc01             | add                 dword ptr [ebp - 4], 1

        $sequence_2 = { 4889c2 488d85c0f7ffff 4801d0 488945f0 c785b8f7ffff00000000 488b45f0 }
            // n = 6, score = 100
            //   4889c2               | dec                 eax
            //   488d85c0f7ffff       | mov                 edx, eax
            //   4801d0               | dec                 eax
            //   488945f0             | lea                 eax, [ebp - 0x840]
            //   c785b8f7ffff00000000     | dec    eax
            //   488b45f0             | add                 eax, edx

        $sequence_3 = { e8???????? bfd0040000 e8???????? 89c2 }
            // n = 4, score = 100
            //   e8????????           |                     
            //   bfd0040000           | dec                 eax
            //   e8????????           |                     
            //   89c2                 | mov                 dword ptr [ebp - 0x10], eax

        $sequence_4 = { 8b45e0 0fb74002 668945e6 8b45e0 0fb710 8b45e0 66895002 }
            // n = 7, score = 100
            //   8b45e0               | mov                 eax, dword ptr [ebp - 0x20]
            //   0fb74002             | movzx               eax, word ptr [eax + 2]
            //   668945e6             | mov                 word ptr [ebp - 0x1a], ax
            //   8b45e0               | mov                 eax, dword ptr [ebp - 0x20]
            //   0fb710               | movzx               edx, word ptr [eax]
            //   8b45e0               | mov                 eax, dword ptr [ebp - 0x20]
            //   66895002             | mov                 word ptr [eax + 2], dx

        $sequence_5 = { 4883c00c 8b00 8905???????? 488dbdd0f1ffff }
            // n = 4, score = 100
            //   4883c00c             | dec                 eax
            //   8b00                 | mov                 edx, eax
            //   8905????????         |                     
            //   488dbdd0f1ffff       | dec                 eax

        $sequence_6 = { 0fb645fb 3a45e4 7204 c645fb00 }
            // n = 4, score = 100
            //   0fb645fb             | lea                 eax, [ebp - 0x840]
            //   3a45e4               | dec                 eax
            //   7204                 | add                 eax, edx
            //   c645fb00             | dec                 eax

        $sequence_7 = { 8d850afaffff 01d0 8b5514 89c7 89d6 }
            // n = 5, score = 100
            //   8d850afaffff         | lea                 eax, [ebp - 0x5f6]
            //   01d0                 | add                 eax, edx
            //   8b5514               | mov                 edx, dword ptr [ebp + 0x14]
            //   89c7                 | mov                 edi, eax
            //   89d6                 | mov                 esi, edx

        $sequence_8 = { 48c1ea10 480fb745f8 488d0402 488945f8 }
            // n = 4, score = 100
            //   48c1ea10             | lea                 edi, [ebp - 0xe30]
            //   480fb745f8           | movzx               eax, byte ptr [ebp - 5]
            //   488d0402             | cmp                 al, byte ptr [ebp - 0x1c]
            //   488945f8             | jb                  9

        $sequence_9 = { 750f 837dec00 755a c745f001000000 eb51 }
            // n = 5, score = 100
            //   750f                 | jne                 0x11
            //   837dec00             | cmp                 dword ptr [ebp - 0x14], 0
            //   755a                 | jne                 0x5c
            //   c745f001000000       | mov                 dword ptr [ebp - 0x10], 1
            //   eb51                 | jmp                 0x53

        $sequence_10 = { 6689420a 488b45f0 0fb7400a 83c010 0fb7f8 e8???????? 89c2 }
            // n = 7, score = 100
            //   6689420a             | mov                 dword ptr [ebp - 0x18], eax
            //   488b45f0             | mov                 eax, dword ptr [ebp - 0x24]
            //   0fb7400a             | dec                 eax
            //   83c010               | add                 eax, 0xc
            //   0fb7f8               | mov                 eax, dword ptr [eax]
            //   e8????????           |                     
            //   89c2                 | dec                 eax

        $sequence_11 = { b800000000 fc 8b7dd4 f2ae 89c8 }
            // n = 5, score = 100
            //   b800000000           | mov                 eax, 0
            //   fc                   | cld                 
            //   8b7dd4               | mov                 edi, dword ptr [ebp - 0x2c]
            //   f2ae                 | repne scasb         al, byte ptr es:[edi]
            //   89c8                 | mov                 eax, ecx

        $sequence_12 = { 8945e8 8b45e8 83c434 5f 5d c3 }
            // n = 6, score = 100
            //   8945e8               | mov                 dword ptr [ebp - 0x18], eax
            //   8b45e8               | mov                 eax, dword ptr [ebp - 0x18]
            //   83c434               | add                 esp, 0x34
            //   5f                   | pop                 edi
            //   5d                   | pop                 ebp
            //   c3                   | ret                 

        $sequence_13 = { e8???????? 66c78580feffff0200 8b4508 8b400c }
            // n = 4, score = 100
            //   e8????????           |                     
            //   66c78580feffff0200     | mov    word ptr [ebp - 0x180], 2
            //   8b4508               | mov                 eax, dword ptr [ebp + 8]
            //   8b400c               | mov                 eax, dword ptr [eax + 0xc]

    condition:
        7 of them and filesize < 4210688
}