rule win_pony_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.pony."
        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.pony"
        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 = { 55 8bec 837d0c00 7416 ff7510 ff750c ff7508 }
            // n = 7, score = 800
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp
            //   837d0c00             | cmp                 dword ptr [ebp + 0xc], 0
            //   7416                 | je                  0x18
            //   ff7510               | push                dword ptr [ebp + 0x10]
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   ff7508               | push                dword ptr [ebp + 8]

        $sequence_1 = { c745f400000000 8d45f8 50 ff7508 6a00 ff15???????? }
            // n = 6, score = 800
            //   c745f400000000       | mov                 dword ptr [ebp - 0xc], 0
            //   8d45f8               | lea                 eax, [ebp - 8]
            //   50                   | push                eax
            //   ff7508               | push                dword ptr [ebp + 8]
            //   6a00                 | push                0
            //   ff15????????         |                     

        $sequence_2 = { 6a01 ff7508 e8???????? ff750c ff7508 e8???????? 8b5510 }
            // n = 7, score = 800
            //   6a01                 | push                1
            //   ff7508               | push                dword ptr [ebp + 8]
            //   e8????????           |                     
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   ff7508               | push                dword ptr [ebp + 8]
            //   e8????????           |                     
            //   8b5510               | mov                 edx, dword ptr [ebp + 0x10]

        $sequence_3 = { 83c4fc 6a00 6a45 ff7508 }
            // n = 4, score = 800
            //   83c4fc               | add                 esp, -4
            //   6a00                 | push                0
            //   6a45                 | push                0x45
            //   ff7508               | push                dword ptr [ebp + 8]

        $sequence_4 = { 8f45d8 c745d000000000 8d45cc 50 }
            // n = 4, score = 800
            //   8f45d8               | pop                 dword ptr [ebp - 0x28]
            //   c745d000000000       | mov                 dword ptr [ebp - 0x30], 0
            //   8d45cc               | lea                 eax, [ebp - 0x34]
            //   50                   | push                eax

        $sequence_5 = { 85c0 785e 0fb645ff 50 0fb645fe 50 0fb645fd }
            // n = 7, score = 800
            //   85c0                 | test                eax, eax
            //   785e                 | js                  0x60
            //   0fb645ff             | movzx               eax, byte ptr [ebp - 1]
            //   50                   | push                eax
            //   0fb645fe             | movzx               eax, byte ptr [ebp - 2]
            //   50                   | push                eax
            //   0fb645fd             | movzx               eax, byte ptr [ebp - 3]

        $sequence_6 = { ff750c ff75fc 50 ff7508 }
            // n = 4, score = 800
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   50                   | push                eax
            //   ff7508               | push                dword ptr [ebp + 8]

        $sequence_7 = { 8bec 83c4e4 53 833d????????00 7412 }
            // n = 5, score = 800
            //   8bec                 | mov                 ebp, esp
            //   83c4e4               | add                 esp, -0x1c
            //   53                   | push                ebx
            //   833d????????00       |                     
            //   7412                 | je                  0x14

        $sequence_8 = { 0bfb 33f9 8d8407c3595b65 034630 c1c006 03c3 }
            // n = 6, score = 800
            //   0bfb                 | or                  edi, ebx
            //   33f9                 | xor                 edi, ecx
            //   8d8407c3595b65       | lea                 eax, [edi + eax + 0x655b59c3]
            //   034630               | add                 eax, dword ptr [esi + 0x30]
            //   c1c006               | rol                 eax, 6
            //   03c3                 | add                 eax, ebx

        $sequence_9 = { 0f853a020000 c745f800000000 c745f4ff070000 6a00 6a00 6a00 }
            // n = 6, score = 800
            //   0f853a020000         | jne                 0x240
            //   c745f800000000       | mov                 dword ptr [ebp - 8], 0
            //   c745f4ff070000       | mov                 dword ptr [ebp - 0xc], 0x7ff
            //   6a00                 | push                0
            //   6a00                 | push                0
            //   6a00                 | push                0

    condition:
        7 of them and filesize < 262144
}