SYMBOLCOMMON_NAMEaka. SYNONYMS
win.royal_dns (Back to overview)

Royal DNS

Actor(s): Mirage

VTCollection    

RoyalDNS is a DNS based backdoor used by APT15 that persistences on a system through a service called 'Nwsapagent'.

References
2020-01-01 ⋅ Secureworks ⋅ SecureWorks
BRONZE PALACE
BS2005 Enfal Mirage RoyalCli Royal DNS APT15
2018-03-16 ⋅ Github (nccgroup) ⋅ NCC Group PLC
Royal APT - APT15 Repository
BS2005 MS Exchange Tool RoyalCli Royal DNS APT15
2018-03-10 ⋅ NCC Group ⋅ Rob Smallridge
APT15 is alive and strong: An analysis of RoyalCli and RoyalDNS
BS2005 MS Exchange Tool RoyalCli Royal DNS APT15
Yara Rules
[TLP:WHITE] win_royal_dns_auto (20260917 | Detects win.royal_dns.)
rule win_royal_dns_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.royal_dns."
        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.royal_dns"
        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 = { 83ff02 7314 5f b03d 884102 5e }
            // n = 6, score = 100
            //   83ff02               | cmp                 edi, 2
            //   7314                 | jae                 0x16
            //   5f                   | pop                 edi
            //   b03d                 | mov                 al, 0x3d
            //   884102               | mov                 byte ptr [ecx + 2], al
            //   5e                   | pop                 esi

        $sequence_1 = { 8bd6 e8???????? 8d85b1fcffff 83c404 8d5001 }
            // n = 5, score = 100
            //   8bd6                 | mov                 edx, esi
            //   e8????????           |                     
            //   8d85b1fcffff         | lea                 eax, [ebp - 0x34f]
            //   83c404               | add                 esp, 4
            //   8d5001               | lea                 edx, [eax + 1]

        $sequence_2 = { 8bf0 c1e605 8bf8 c1ef02 03f7 0fbe39 03f7 }
            // n = 7, score = 100
            //   8bf0                 | mov                 esi, eax
            //   c1e605               | shl                 esi, 5
            //   8bf8                 | mov                 edi, eax
            //   c1ef02               | shr                 edi, 2
            //   03f7                 | add                 esi, edi
            //   0fbe39               | movsx               edi, byte ptr [ecx]
            //   03f7                 | add                 esi, edi

        $sequence_3 = { 84c9 75f9 eb5f 8b8db0fcffff }
            // n = 4, score = 100
            //   84c9                 | test                cl, cl
            //   75f9                 | jne                 0xfffffffb
            //   eb5f                 | jmp                 0x61
            //   8b8db0fcffff         | mov                 ecx, dword ptr [ebp - 0x350]

        $sequence_4 = { 50 83c611 ffd3 b9ff000000 663bc1 760e }
            // n = 6, score = 100
            //   50                   | push                eax
            //   83c611               | add                 esi, 0x11
            //   ffd3                 | call                ebx
            //   b9ff000000           | mov                 ecx, 0xff
            //   663bc1               | cmp                 ax, cx
            //   760e                 | jbe                 0x10

        $sequence_5 = { 7468 0fb606 c1e802 0fb68070132500 8801 }
            // n = 5, score = 100
            //   7468                 | je                  0x6a
            //   0fb606               | movzx               eax, byte ptr [esi]
            //   c1e802               | shr                 eax, 2
            //   0fb68070132500       | movzx               eax, byte ptr [eax + 0x251370]
            //   8801                 | mov                 byte ptr [ecx], al

        $sequence_6 = { 8d95ecf5ffff 52 8b95f8f5ffff 8d85fcf5ffff 50 8d8de8f5ffff 51 }
            // n = 7, score = 100
            //   8d95ecf5ffff         | lea                 edx, [ebp - 0xa14]
            //   52                   | push                edx
            //   8b95f8f5ffff         | mov                 edx, dword ptr [ebp - 0xa08]
            //   8d85fcf5ffff         | lea                 eax, [ebp - 0xa04]
            //   50                   | push                eax
            //   8d8de8f5ffff         | lea                 ecx, [ebp - 0xa18]
            //   51                   | push                ecx

        $sequence_7 = { 68ff070000 8d85fdf5ffff 6a00 bb???????? 50 }
            // n = 5, score = 100
            //   68ff070000           | push                0x7ff
            //   8d85fdf5ffff         | lea                 eax, [ebp - 0xa03]
            //   6a00                 | push                0
            //   bb????????           |                     
            //   50                   | push                eax

        $sequence_8 = { 3bf8 721d 8bce 8d5580 }
            // n = 4, score = 100
            //   3bf8                 | cmp                 edi, eax
            //   721d                 | jb                  0x1f
            //   8bce                 | mov                 ecx, esi
            //   8d5580               | lea                 edx, [ebp - 0x80]

        $sequence_9 = { 8b8d9cfcffff a4 89858cfcffff 8b01 }
            // n = 4, score = 100
            //   8b8d9cfcffff         | mov                 ecx, dword ptr [ebp - 0x364]
            //   a4                   | movsb               byte ptr es:[edi], byte ptr [esi]
            //   89858cfcffff         | mov                 dword ptr [ebp - 0x374], eax
            //   8b01                 | mov                 eax, dword ptr [ecx]

    condition:
        7 of them and filesize < 204800
}
[TLP:WHITE] win_royal_dns_w0   (20180312 | Detects malware from APT 15 report by NCC Group)
import "pe"

rule win_royal_dns_w0 {
    meta:
        author = "Florian Roth"
        description = "Detects malware from APT 15 report by NCC Group"
        reference = "https://goo.gl/HZ5XMN"
        date = "2018-03-10"
        hash = "bc937f6e958b339f6925023bc2af375d669084e9551fd3753e501ef26e36b39d"
        malpedia_reference = "https://malpedia.caad.fkie.fraunhofer.de/details/win.royal_dns"
        malpedia_version = "20180312"
        malpedia_license = "CC BY-NC-SA 4.0"
        malpedia_sharing = "TLP:WHITE"
    strings:
        $x1 = "del c:\\windows\\temp\\r.exe /f /q" fullword ascii
        $x2 = "%s\\r.exe" fullword ascii

        $s1 = "rights.dll" fullword ascii
        $s2 = "\"%s\">>\"%s\"\\s.txt" fullword ascii
        $s3 = "Nwsapagent" fullword ascii
        $s4 = "%s\\r.bat" fullword ascii
        $s5 = "%s\\s.txt" fullword ascii
        $s6 = "runexe" fullword ascii
    condition:
        1 of ($x*) or 2 of them
}
[TLP:WHITE] win_royal_dns_w1   (20180312 | DLL implant, originally rights.dll and runs as a service)
rule win_royal_dns_w1 {
    meta:
        author = "David Cannings"
        description = "DLL implant, originally rights.dll and runs as a service"
        hash = "bc937f6e958b339f6925023bc2af375d669084e9551fd3753e501ef26e36b39d"
        malpedia_reference = "https://malpedia.caad.fkie.fraunhofer.de/details/win.royal_dns"
        malpedia_version = "20180312"
        malpedia_license = "CC BY-NC-SA 4.0"
        malpedia_sharing = "TLP:WHITE"
    strings:
        /*
        56                push    esi
        B8 A7 C6 67 4E    mov     eax, 4E67C6A7h
        83 C1 02          add     ecx, 2
        BA 04 00 00 00    mov     edx, 4
        57                push    edi
        90                nop
        */
        // JSHash implementation (Justin Sobel's hash algorithm)
        $opcodes_jshash = { B8 A7 C6 67 4E 83 C1 02 BA 04 00 00 00 57 90 }

        /*
        0F B6 1C 03       movzx   ebx, byte ptr [ebx+eax]
        8B 55 08          mov     edx, [ebp+arg_0]
        30 1C 17          xor     [edi+edx], bl
        47                inc     edi
        3B 7D 0C          cmp     edi, [ebp+arg_4]
        72 A4             jb      short loc_10003F31
        */
        // Encode loop, used to "encrypt" data before DNS request
        $opcodes_encode = { 0F B6 1C 03 8B 55 08 30 1C 17 47 3B 7D 0C }

        /*
        68 88 13 00 00    push    5000 # Also seen 3000, included below
        FF D6             call    esi ; Sleep
        4F                dec     edi
        75 F6             jnz     short loc_10001554
        */
        // Sleep loop
        $opcodes_sleep_loop = { 68 (88|B8) (13|0B) 00 00 FF D6 4F 75 F6 }

        // Generic strings
        $ = "Nwsapagent" fullword
        $ = "\"%s\">>\"%s\"\\s.txt"
        $ = "myWObject" fullword
        $ = "del c:\\windows\\temp\\r.exe /f /q"
        $ = "del c:\\windows\\temp\\r.ini /f /q"

    condition:
        3 of them
}
Download all Yara Rules