rule win_tonerjam_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.tonerjam."
        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.tonerjam"
        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 = { 48d3cf 4933fa 4b87bcfe601d0200 33c0 488b5c2450 488b6c2458 }
            // n = 6, score = 100
            //   48d3cf               | inc                 ebp
            //   4933fa               | xor                 esi, esi
            //   4b87bcfe601d0200     | dec                 eax
            //   33c0                 | lea                 ecx, [0x1b623]
            //   488b5c2450           | dec                 eax
            //   488b6c2458           | sub                 esp, 0xe20

        $sequence_1 = { 4883ec28 488d0ded900100 e8???????? 488d0df9900100 e8???????? b001 }
            // n = 6, score = 100
            //   4883ec28             | mov                 ecx, dword ptr [eax + 0x217d0]
            //   488d0ded900100       | inc                 ebx
            //   e8????????           |                     
            //   488d0df9900100       | jmp                 0x126e
            //   e8????????           |                     
            //   b001                 | dec                 eax

        $sequence_2 = { 498784f6c01c0200 eb1e 488bc3 498784f6c01c0200 4885c0 }
            // n = 5, score = 100
            //   498784f6c01c0200     | mov                 dword ptr [esp + 0x10], esi
            //   eb1e                 | push                edi
            //   488bc3               | dec                 esp
            //   498784f6c01c0200     | mov                 edx, edx
            //   4885c0               | dec                 eax

        $sequence_3 = { 33c9 ff15???????? 488d0da09a0100 eb0c 83f901 }
            // n = 5, score = 100
            //   33c9                 | mov                 eax, dword ptr [esp + 0x38]
            //   ff15????????         |                     
            //   488d0da09a0100       | int                 0x29
            //   eb0c                 | dec                 eax
            //   83f901               | lea                 ecx, [0x1e036]

        $sequence_4 = { 4883ec20 33db 488d1561600100 4533c0 }
            // n = 4, score = 100
            //   4883ec20             | lea                 ecx, [esp + 0x40]
            //   33db                 | dec                 eax
            //   488d1561600100       | mov                 edx, eax
            //   4533c0               | dec                 esp

        $sequence_5 = { 895c2428 488d0dd39c0000 4533c9 4489442420 }
            // n = 4, score = 100
            //   895c2428             | xor                 edx, edx
            //   488d0dd39c0000       | dec                 eax
            //   4533c9               | lea                 ecx, [ebp - 0x10]
            //   4489442420           | dec                 eax

        $sequence_6 = { 83b97004000002 0f848c010000 4c8d356f0c0100 897350 }
            // n = 4, score = 100
            //   83b97004000002       | dec                 eax
            //   0f848c010000         | mov                 eax, ecx
            //   4c8d356f0c0100       | and                 ecx, 0x3f
            //   897350               | dec                 eax

        $sequence_7 = { 4885c0 7429 48833d????????00 741f 48833d????????00 7415 }
            // n = 6, score = 100
            //   4885c0               | je                  0x1f5
            //   7429                 | nop                 dword ptr [eax + eax]
            //   48833d????????00     |                     
            //   741f                 | dec                 eax
            //   48833d????????00     |                     
            //   7415                 | inc                 eax

        $sequence_8 = { 0f1f8000000000 488d15d1c50100 488d4c244c e8???????? 85c0 7460 }
            // n = 6, score = 100
            //   0f1f8000000000       | mov                 dword ptr [ebp - 0x49], ebp
            //   488d15d1c50100       | dec                 eax
            //   488d4c244c           | test                ecx, ecx
            //   e8????????           |                     
            //   85c0                 | dec                 ebp
            //   7460                 | mov                 ecx, dword ptr [edi + eax*8 + 0x217d0]

        $sequence_9 = { 2bc8 48d3cf 4933fa 4b87bcfe601d0200 33c0 488b5c2450 }
            // n = 6, score = 100
            //   2bc8                 | movdqu              xmmword ptr [ebp + 0x50], xmm0
            //   48d3cf               | movdqu              xmmword ptr [ebp + 0x40], xmm1
            //   4933fa               | movdqu              xmmword ptr [ebp - 0x60], xmm1
            //   4b87bcfe601d0200     | movdqu              xmmword ptr [ebp - 0x50], xmm0
            //   33c0                 | movdqu              xmmword ptr [ebp - 0x40], xmm1
            //   488b5c2450           | movdqu              xmmword ptr [ebp - 0x30], xmm0

    condition:
        7 of them and filesize < 315392
}