rule win_tuoni_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.tuoni."
        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.tuoni"
        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 = { 668b55fe c1e908 6a0a 8854382a 8b55f8 8b049530464500 884c382b }
            // n = 7, score = 100
            //   668b55fe             | mov                 dx, word ptr [ebp - 2]
            //   c1e908               | shr                 ecx, 8
            //   6a0a                 | push                0xa
            //   8854382a             | mov                 byte ptr [eax + edi + 0x2a], dl
            //   8b55f8               | mov                 edx, dword ptr [ebp - 8]
            //   8b049530464500       | mov                 eax, dword ptr [edx*4 + 0x454630]
            //   884c382b             | mov                 byte ptr [eax + edi + 0x2b], cl

        $sequence_1 = { e8???????? 59 8b4d08 e8???????? 3c32 7553 8d7304 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   8b4d08               | mov                 ecx, dword ptr [ebp + 8]
            //   e8????????           |                     
            //   3c32                 | cmp                 al, 0x32
            //   7553                 | jne                 0x55
            //   8d7304               | lea                 esi, [ebx + 4]

        $sequence_2 = { e8???????? c70021000000 eb44 c745e002000000 c745e414764400 8b4508 }
            // n = 6, score = 100
            //   e8????????           |                     
            //   c70021000000         | mov                 dword ptr [eax], 0x21
            //   eb44                 | jmp                 0x46
            //   c745e002000000       | mov                 dword ptr [ebp - 0x20], 2
            //   c745e414764400       | mov                 dword ptr [ebp - 0x1c], 0x447614
            //   8b4508               | mov                 eax, dword ptr [ebp + 8]

        $sequence_3 = { e8???????? 8b35???????? 8d85fcf8ffff 50 ffd6 8d85ecf8ffff }
            // n = 6, score = 100
            //   e8????????           |                     
            //   8b35????????         |                     
            //   8d85fcf8ffff         | lea                 eax, [ebp - 0x704]
            //   50                   | push                eax
            //   ffd6                 | call                esi
            //   8d85ecf8ffff         | lea                 eax, [ebp - 0x714]

        $sequence_4 = { ab 8b44240c 8bfa 83621000 8bf0 83621400 f3a5 }
            // n = 7, score = 100
            //   ab                   | stosd               dword ptr es:[edi], eax
            //   8b44240c             | mov                 eax, dword ptr [esp + 0xc]
            //   8bfa                 | mov                 edi, edx
            //   83621000             | and                 dword ptr [edx + 0x10], 0
            //   8bf0                 | mov                 esi, eax
            //   83621400             | and                 dword ptr [edx + 0x14], 0
            //   f3a5                 | rep movsd           dword ptr es:[edi], dword ptr [esi]

        $sequence_5 = { c645fc3a 50 68???????? e8???????? 59 59 8bc8 }
            // n = 7, score = 100
            //   c645fc3a             | mov                 byte ptr [ebp - 4], 0x3a
            //   50                   | push                eax
            //   68????????           |                     
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   59                   | pop                 ecx
            //   8bc8                 | mov                 ecx, eax

        $sequence_6 = { 33c0 40 c701???????? 894104 894108 89590c eb02 }
            // n = 7, score = 100
            //   33c0                 | xor                 eax, eax
            //   40                   | inc                 eax
            //   c701????????         |                     
            //   894104               | mov                 dword ptr [ecx + 4], eax
            //   894108               | mov                 dword ptr [ecx + 8], eax
            //   89590c               | mov                 dword ptr [ecx + 0xc], ebx
            //   eb02                 | jmp                 4

        $sequence_7 = { 8bf0 8d4601 50 e8???????? 83c410 897b10 8b7c2410 }
            // n = 7, score = 100
            //   8bf0                 | mov                 esi, eax
            //   8d4601               | lea                 eax, [esi + 1]
            //   50                   | push                eax
            //   e8????????           |                     
            //   83c410               | add                 esp, 0x10
            //   897b10               | mov                 dword ptr [ebx + 0x10], edi
            //   8b7c2410             | mov                 edi, dword ptr [esp + 0x10]

        $sequence_8 = { 8d8550fbffff 50 68???????? ff15???????? 6a00 6880000000 6a03 }
            // n = 7, score = 100
            //   8d8550fbffff         | lea                 eax, [ebp - 0x4b0]
            //   50                   | push                eax
            //   68????????           |                     
            //   ff15????????         |                     
            //   6a00                 | push                0
            //   6880000000           | push                0x80
            //   6a03                 | push                3

        $sequence_9 = { 7421 56 57 e8???????? 6a06 59 8bf5 }
            // n = 7, score = 100
            //   7421                 | je                  0x23
            //   56                   | push                esi
            //   57                   | push                edi
            //   e8????????           |                     
            //   6a06                 | push                6
            //   59                   | pop                 ecx
            //   8bf5                 | mov                 esi, ebp

    condition:
        7 of them and filesize < 734208
}