rule win_graphsteel_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.graphsteel."
        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.graphsteel"
        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???????? 488b442438 c7030b000000 4883c448 5b 5e 5f }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488b442438           | mov                 eax, edi
            //   c7030b000000         | ret                 
            //   4883c448             | movzx               edx, byte ptr [eax + 1]
            //   5b                   | cmp                 dl, 0x62
            //   5e                   | ja                  0x1225
            //   5f                   | cmp                 dl, 0x2f

        $sequence_1 = { 7405 4589cd eb20 4939cc 7512 440fb6ac2411060000 4183f501 }
            // n = 7, score = 100
            //   7405                 | mov                 dword ptr [esp + 0x138], ecx
            //   4589cd               | dec                 eax
            //   eb20                 | mov                 ebx, ecx
            //   4939cc               | mov                 edi, edx
            //   7512                 | dec                 ebp
            //   440fb6ac2411060000     | mov    ebp, eax
            //   4183f501             | push                esi

        $sequence_2 = { e8???????? 488d0d080a4700 488908 488d15f6fc7100 48895008 488b9c2408010000 48c7435001000000 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488d0d080a4700       | dec                 eax
            //   488908               | mov                 edx, ebx
            //   488d15f6fc7100       | ret                 
            //   48895008             | dec                 esp
            //   488b9c2408010000     | mov                 ebx, ebp
            //   48c7435001000000     | dec                 esp

        $sequence_3 = { e8???????? 488b6d00 488d1546060000 4889942470010000 488b942440020000 4889942478010000 4c8b842410020000 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488b6d00             | dec                 eax
            //   488d1546060000       | mov                 ebx, edx
            //   4889942470010000     | dec                 eax
            //   488b942440020000     | lea                 ecx, [0x4dbed3]
            //   4889942478010000     | nop                 
            //   4c8b842410020000     | dec                 eax

        $sequence_4 = { e8???????? 4c8b542450 448b5c2448 45099acc000000 4183fe01 741f 498b0a }
            // n = 7, score = 100
            //   e8????????           |                     
            //   4c8b542450           | mov                 edx, 0xf
            //   448b5c2448           | dec                 esp
            //   45099acc000000       | mov                 ecx, esi
            //   4183fe01             | inc                 ecx
            //   741f                 | mov                 ebp, eax
            //   498b0a               | mov                 dword ptr [esp + 0xa8], 0

        $sequence_5 = { eb17 488d1550fa5a00 4c8d05e1f18500 eb07 31d2 4531c0 6690 }
            // n = 7, score = 100
            //   eb17                 | and                 edx, 4
            //   488d1550fa5a00       | dec                 eax
            //   4c8d05e1f18500       | mov                 edx, dword ptr [esp + 0xc0]
            //   eb07                 | dec                 eax
            //   31d2                 | mov                 dword ptr [edx + 0x80], ecx
            //   4531c0               | jne                 0x64a
            //   6690                 | dec                 eax

        $sequence_6 = { e8???????? e9???????? c78424c800000000000000 c78424b800000001000000 e9???????? 8b8424a0010000 4189d9 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   e9????????           |                     
            //   c78424c800000000000000     | dec    eax
            //   c78424b800000001000000     | mov    dword ptr [eax], ecx
            //   e9????????           |                     
            //   8b8424a0010000       | dec                 eax
            //   4189d9               | mov                 dword ptr [edx + 0x58], eax

        $sequence_7 = { e8???????? 488d05a6474f00 e8???????? 48c7400813000000 488d0db71c5400 488908 488b4c2410 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488d05a6474f00       | lea                 ecx, [0x2bf49a]
            //   e8????????           |                     
            //   48c7400813000000     | dec                 eax
            //   488d0db71c5400       | mov                 dword ptr [esp + 0x80], ecx
            //   488908               | dec                 eax
            //   488b4c2410           | lea                 ecx, [0x1b988b]

        $sequence_8 = { bf04000000 4889fe e8???????? 0f1f440000 4885db 7e5d 90 }
            // n = 7, score = 100
            //   bf04000000           | dec                 ebp
            //   4889fe               | mov                 dword ptr [esp + 0x20], esi
            //   e8????????           |                     
            //   0f1f440000           | test                eax, eax
            //   4885db               | mov                 eax, dword ptr [eax + 0xbc]
            //   7e5d                 | inc                 ecx
            //   90                   | mov                 dword ptr [ebp + 0xbc], eax

        $sequence_9 = { e8???????? 488d0554fe4e00 488b5c2438 488d0daf455500 bf0a000000 0f1f00 e8???????? }
            // n = 7, score = 100
            //   e8????????           |                     
            //   488d0554fe4e00       | lea                 eax, [0x4f1751]
            //   488b5c2438           | dec                 eax
            //   488d0daf455500       | mov                 dword ptr [eax + 8], 0x18
            //   bf0a000000           | ret                 
            //   0f1f00               | dec                 eax
            //   e8????????           |                     

    condition:
        7 of them and filesize < 19812352
}