rule win_dyepack_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-05-04"
        version = "1"
        description = "Detects win.dyepack."
        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.dyepack"
        malpedia_rule_date = "20260422"
        malpedia_hash = "a182e35da64e6d71cb55f125c4d4225196523f14"
        malpedia_version = "20260504"
        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 = { 8b842434100000 53 6800000040 50 ff15???????? 8bf0 }
            // n = 6, score = 300
            //   8b842434100000       | mov                 eax, dword ptr [esp + 0x1034]
            //   53                   | push                ebx
            //   6800000040           | push                0x40000000
            //   50                   | push                eax
            //   ff15????????         |                     
            //   8bf0                 | mov                 esi, eax

        $sequence_1 = { ff15???????? 56 ff15???????? 8b8c2428100000 53 }
            // n = 5, score = 300
            //   ff15????????         |                     
            //   56                   | push                esi
            //   ff15????????         |                     
            //   8b8c2428100000       | mov                 ecx, dword ptr [esp + 0x1028]
            //   53                   | push                ebx

        $sequence_2 = { 3be9 72ac 56 ff15???????? 56 ff15???????? 8b8c2428100000 }
            // n = 7, score = 300
            //   3be9                 | cmp                 ebp, ecx
            //   72ac                 | jb                  0xffffffae
            //   56                   | push                esi
            //   ff15????????         |                     
            //   56                   | push                esi
            //   ff15????????         |                     
            //   8b8c2428100000       | mov                 ecx, dword ptr [esp + 0x1028]

        $sequence_3 = { 8b442414 13fb 3bf8 7cb2 7f08 }
            // n = 5, score = 300
            //   8b442414             | mov                 eax, dword ptr [esp + 0x14]
            //   13fb                 | adc                 edi, ebx
            //   3bf8                 | cmp                 edi, eax
            //   7cb2                 | jl                  0xffffffb4
            //   7f08                 | jg                  0xa

        $sequence_4 = { 53 53 53 56 ffd7 8b442414 }
            // n = 6, score = 300
            //   53                   | push                ebx
            //   53                   | push                ebx
            //   53                   | push                ebx
            //   56                   | push                esi
            //   ffd7                 | call                edi
            //   8b442414             | mov                 eax, dword ptr [esp + 0x14]

        $sequence_5 = { b9ff030000 33c0 8d7c2421 885c2420 }
            // n = 4, score = 300
            //   b9ff030000           | mov                 ecx, 0x3ff
            //   33c0                 | xor                 eax, eax
            //   8d7c2421             | lea                 edi, [esp + 0x21]
            //   885c2420             | mov                 byte ptr [esp + 0x20], bl

        $sequence_6 = { 53 51 8d54242c 6a01 52 56 ff15???????? }
            // n = 7, score = 300
            //   53                   | push                ebx
            //   51                   | push                ecx
            //   8d54242c             | lea                 edx, [esp + 0x2c]
            //   6a01                 | push                1
            //   52                   | push                edx
            //   56                   | push                esi
            //   ff15????????         |                     

        $sequence_7 = { 7cb2 7f08 8b4c2410 3be9 72ac 56 ff15???????? }
            // n = 7, score = 300
            //   7cb2                 | jl                  0xffffffb4
            //   7f08                 | jg                  0xa
            //   8b4c2410             | mov                 ecx, dword ptr [esp + 0x10]
            //   3be9                 | cmp                 ebp, ecx
            //   72ac                 | jb                  0xffffffae
            //   56                   | push                esi
            //   ff15????????         |                     

        $sequence_8 = { 8d4c2418 53 51 8d54242c 6a01 52 56 }
            // n = 7, score = 300
            //   8d4c2418             | lea                 ecx, [esp + 0x18]
            //   53                   | push                ebx
            //   51                   | push                ecx
            //   8d54242c             | lea                 edx, [esp + 0x2c]
            //   6a01                 | push                1
            //   52                   | push                edx
            //   56                   | push                esi

        $sequence_9 = { 53 52 8d44242c 51 }
            // n = 4, score = 300
            //   53                   | push                ebx
            //   52                   | push                edx
            //   8d44242c             | lea                 eax, [esp + 0x2c]
            //   51                   | push                ecx

    condition:
        7 of them and filesize < 212992
}