rule win_gameover_p2p_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.gameover_p2p."
        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.gameover_p2p"
        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 = { e8???????? 84c0 745a 51 51 6a14 5a }
            // n = 7, score = 100
            //   e8????????           |                     
            //   84c0                 | test                al, al
            //   745a                 | je                  0x5c
            //   51                   | push                ecx
            //   51                   | push                ecx
            //   6a14                 | push                0x14
            //   5a                   | pop                 edx

        $sequence_1 = { 57 8d3c9548373d02 8b0f 334f04 23cb 330f 8bc1 }
            // n = 7, score = 100
            //   57                   | push                edi
            //   8d3c9548373d02       | lea                 edi, [edx*4 + 0x23d3748]
            //   8b0f                 | mov                 ecx, dword ptr [edi]
            //   334f04               | xor                 ecx, dword ptr [edi + 4]
            //   23cb                 | and                 ecx, ebx
            //   330f                 | xor                 ecx, dword ptr [edi]
            //   8bc1                 | mov                 eax, ecx

        $sequence_2 = { 85db 7468 6a67 8d542440 59 e8???????? 6a68 }
            // n = 7, score = 100
            //   85db                 | test                ebx, ebx
            //   7468                 | je                  0x6a
            //   6a67                 | push                0x67
            //   8d542440             | lea                 edx, [esp + 0x40]
            //   59                   | pop                 ecx
            //   e8????????           |                     
            //   6a68                 | push                0x68

        $sequence_3 = { 743f 53 8d442420 50 57 56 ff742428 }
            // n = 7, score = 100
            //   743f                 | je                  0x41
            //   53                   | push                ebx
            //   8d442420             | lea                 eax, [esp + 0x20]
            //   50                   | push                eax
            //   57                   | push                edi
            //   56                   | push                esi
            //   ff742428             | push                dword ptr [esp + 0x28]

        $sequence_4 = { 57 ff75fc bf04010000 68???????? 53 8d85f0fdffff 57 }
            // n = 7, score = 100
            //   57                   | push                edi
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   bf04010000           | mov                 edi, 0x104
            //   68????????           |                     
            //   53                   | push                ebx
            //   8d85f0fdffff         | lea                 eax, [ebp - 0x210]
            //   57                   | push                edi

        $sequence_5 = { e8???????? 803d????????04 51 8b4dfc 1bd2 f7da 81c289000000 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   803d????????04       |                     
            //   51                   | push                ecx
            //   8b4dfc               | mov                 ecx, dword ptr [ebp - 4]
            //   1bd2                 | sbb                 edx, edx
            //   f7da                 | neg                 edx
            //   81c289000000         | add                 edx, 0x89

        $sequence_6 = { 5e 5b c9 c20800 85db 7427 }
            // n = 6, score = 100
            //   5e                   | pop                 esi
            //   5b                   | pop                 ebx
            //   c9                   | leave               
            //   c20800               | ret                 8
            //   85db                 | test                ebx, ebx
            //   7427                 | je                  0x29

        $sequence_7 = { 83fe03 7510 51 51 6a14 5a 8d4c247c }
            // n = 7, score = 100
            //   83fe03               | cmp                 esi, 3
            //   7510                 | jne                 0x12
            //   51                   | push                ecx
            //   51                   | push                ecx
            //   6a14                 | push                0x14
            //   5a                   | pop                 edx
            //   8d4c247c             | lea                 ecx, [esp + 0x7c]

        $sequence_8 = { 8d4c245c e8???????? 81fe00c80000 7646 6a03 58 8bfb }
            // n = 7, score = 100
            //   8d4c245c             | lea                 ecx, [esp + 0x5c]
            //   e8????????           |                     
            //   81fe00c80000         | cmp                 esi, 0xc800
            //   7646                 | jbe                 0x48
            //   6a03                 | push                3
            //   58                   | pop                 eax
            //   8bfb                 | mov                 edi, ebx

        $sequence_9 = { 894dcc 8d4ddc 51 6880000000 50 57 ff15???????? }
            // n = 7, score = 100
            //   894dcc               | mov                 dword ptr [ebp - 0x34], ecx
            //   8d4ddc               | lea                 ecx, [ebp - 0x24]
            //   51                   | push                ecx
            //   6880000000           | push                0x80
            //   50                   | push                eax
            //   57                   | push                edi
            //   ff15????????         |                     

    condition:
        7 of them and filesize < 598016
}