rule win_homefry_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.homefry."
        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.homefry"
        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 = { 48030d???????? e8???????? 84c0 7431 8b0b }
            // n = 5, score = 100
            //   48030d????????       |                     
            //   e8????????           |                     
            //   84c0                 | dec                 eax
            //   7431                 | lea                 ecx, [0x190c]
            //   8b0b                 | jne                 0x3d1

        $sequence_1 = { 03c2 c1e806 6bc065 2bf8 4585c9 7504 }
            // n = 6, score = 100
            //   03c2                 | mov                 eax, dword ptr [ebp + 0x10]
            //   c1e806               | dec                 eax
            //   6bc065               | mov                 dword ptr [eax + 0x10], 0
            //   2bf8                 | dec                 eax
            //   4585c9               | mov                 ebx, dword ptr [esp + 0x40]
            //   7504                 | dec                 eax

        $sequence_2 = { c1e806 6bc065 2bf0 488d2d192a0000 488bc5 397008 7509 }
            // n = 7, score = 100
            //   c1e806               | jne                 0xe9e
            //   6bc065               | jne                 0xebe
            //   2bf0                 | xor                 eax, eax
            //   488d2d192a0000       | dec                 eax
            //   488bc5               | add                 esp, 0x68
            //   397008               | ret                 
            //   7509                 | mov                 eax, 1

        $sequence_3 = { 4881ec90000000 488bea 488bf9 e8???????? 84c0 0f8418010000 }
            // n = 6, score = 100
            //   4881ec90000000       | dec                 eax
            //   488bea               | add                 ecx, ebx
            //   488bf9               | test                eax, eax
            //   e8????????           |                     
            //   84c0                 | dec                 eax
            //   0f8418010000         | lea                 ebp, [0x2a19]

        $sequence_4 = { 488b08 488d9424a0000000 482b0d???????? 48030d???????? e8???????? }
            // n = 5, score = 100
            //   488b08               | imul                eax, eax, 0x65
            //   488d9424a0000000     | sub                 edi, eax
            //   482b0d????????       |                     
            //   48030d????????       |                     
            //   e8????????           |                     

        $sequence_5 = { b938000000 488bf8 ff15???????? 4c8b0d???????? 488b0d???????? }
            // n = 5, score = 100
            //   b938000000           | mov                 eax, ebx
            //   488bf8               | dec                 eax
            //   ff15????????         |                     
            //   4c8b0d????????       |                     
            //   488b0d????????       |                     

        $sequence_6 = { 482b0d???????? 48030d???????? e8???????? 84c0 7437 b990000000 }
            // n = 6, score = 100
            //   482b0d????????       |                     
            //   48030d????????       |                     
            //   e8????????           |                     
            //   84c0                 | dec                 eax
            //   7437                 | lea                 ecx, [0x20a8]
            //   b990000000           | mov                 eax, 1

        $sequence_7 = { eb07 488d0d16100000 e8???????? 4c8bb42480000000 488bbc24b0000000 488bb424a8000000 }
            // n = 6, score = 100
            //   eb07                 | dec                 eax
            //   488d0d16100000       | test                eax, eax
            //   e8????????           |                     
            //   4c8bb42480000000     | cmp                 dword ptr [ebp + 0x2f8], esi
            //   488bbc24b0000000     | jbe                 0x1a4
            //   488bb424a8000000     | nop                 dword ptr [eax]

        $sequence_8 = { 488bac24b0000000 4885ff 7542 8b9c24b8000000 }
            // n = 4, score = 100
            //   488bac24b0000000     | dec                 ebp
            //   4885ff               | mov                 esi, eax
            //   7542                 | dec                 eax
            //   8b9c24b8000000       | sub                 esp, 0x20

        $sequence_9 = { 2bf0 488d2d192a0000 488bc5 397008 }
            // n = 4, score = 100
            //   2bf0                 | dec                 eax
            //   488d2d192a0000       | lea                 eax, [esp + 0x80]
            //   488bc5               | inc                 ebp
            //   397008               | lea                 ecx, [esi + 4]

    condition:
        7 of them and filesize < 65536
}