rule win_havoc_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.havoc."
        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.havoc"
        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???????? ba01000000 ffc8 750c }
            // n = 4, score = 800
            //   e8????????           |                     
            //   ba01000000           | dec                 eax
            //   ffc8                 | mov                 eax, dword ptr [ebp]
            //   750c                 | dec                 eax

        $sequence_1 = { 7407 488b442428 eb1b 488b06 }
            // n = 4, score = 800
            //   7407                 | mov                 edx, dword ptr [ebx + 0xc]
            //   488b442428           | dec                 ebp
            //   eb1b                 | mov                 ecx, esp
            //   488b06               | dec                 ecx

        $sequence_2 = { 4885c9 7406 488b01 ff5010 488d65c8 }
            // n = 5, score = 800
            //   4885c9               | mov                 cl, byte ptr [esp + 0x3d]
            //   7406                 | mov                 byte ptr [esp + 0x3d], al
            //   488b01               | mov                 al, byte ptr [esp + 0x32]
            //   ff5010               | mov                 byte ptr [esp + 0x36], cl
            //   488d65c8             | mov                 cl, byte ptr [esp + 0x3f]

        $sequence_3 = { 48c1e204 4b8d0c01 8b01 49034412f0 }
            // n = 4, score = 800
            //   48c1e204             | call                dword ptr [eax + 0x254]
            //   4b8d0c01             | mov                 edx, eax
            //   8b01                 | mov                 ecx, 1
            //   49034412f0           | dec                 eax

        $sequence_4 = { 41b914000008 f3ab 488b05???????? b901000000 488b00 }
            // n = 5, score = 800
            //   41b914000008         | mov                 ecx, dword ptr [esi + 8]
            //   f3ab                 | call                dword ptr [eax + 0x34c]
            //   488b05????????       |                     
            //   b901000000           | jb                  0x15ec
            //   488b00               | inc                 sp

        $sequence_5 = { 488b01 ff5048 85c0 75ab 488b0e 488b01 ff5050 }
            // n = 7, score = 800
            //   488b01               | mov                 edx, dword ptr [eax + 0x6a8]
            //   ff5048               | dec                 eax
            //   85c0                 | test                edx, edx
            //   75ab                 | je                  0x18ee
            //   488b0e               | dec                 eax
            //   488b01               | mov                 ebx, eax
            //   ff5050               | dec                 eax

        $sequence_6 = { 3241ff 4488491c 4488411d 88511e 88411f 4183fb3c 7589 }
            // n = 7, score = 800
            //   3241ff               | sub                 esp, -0x80
            //   4488491c             | pop                 ebx
            //   4488411d             | pop                 edi
            //   88511e               | inc                 ecx
            //   88411f               | pop                 esp
            //   4183fb3c             | xor                 eax, eax
            //   7589                 | dec                 eax

        $sequence_7 = { 8903 668b44244e 448b4c2440 66894304 }
            // n = 4, score = 800
            //   8903                 | mov                 edx, 0xa66df372
            //   668b44244e           | dec                 eax
            //   448b4c2440           | mov                 edx, dword ptr [ebx]
            //   66894304             | dec                 eax

        $sequence_8 = { 4989d0 31d2 4c898c2488000000 498b0424 4c8d8c2480000000 4c894c2438 }
            // n = 6, score = 800
            //   4989d0               | test                eax, eax
            //   31d2                 | je                  0x397
            //   4c898c2488000000     | dec                 eax
            //   498b0424             | mov                 eax, dword ptr [ebx + 0x28]
            //   4c8d8c2480000000     | mov                 ecx, 2
            //   4c894c2438           | test                eax, eax

        $sequence_9 = { 488b15???????? 4c8d842408010000 488b01 ff10 }
            // n = 4, score = 800
            //   488b15????????       |                     
            //   4c8d842408010000     | mov                 ecx, dword ptr [edx + 0x614]
            //   488b01               | mov                 edx, 0x99a3156a
            //   ff10                 | dec                 eax

    condition:
        7 of them and filesize < 164864
}