SYMBOLCOMMON_NAMEaka. SYNONYMS
win.royal_dns (Back to overview)

Royal DNS

Actor(s): Mirage


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

References
2020SecureworksSecureWorks
@online{secureworks:2020:bronze:134ec2b, author = {SecureWorks}, title = {{BRONZE PALACE}}, date = {2020}, organization = {Secureworks}, url = {https://www.secureworks.com/research/threat-profiles/bronze-palace}, language = {English}, urldate = {2020-05-23} } BRONZE PALACE
BS2005 Enfal Mirage RoyalCli Royal DNS Mirage
2018-03-16Github (nccgroup)NCC Group PLC
@online{plc:20180316:royal:7ff57f8, author = {NCC Group PLC}, title = {{Royal APT - APT15 Repository}}, date = {2018-03-16}, organization = {Github (nccgroup)}, url = {https://github.com/nccgroup/Royal_APT}, language = {English}, urldate = {2020-01-09} } Royal APT - APT15 Repository
BS2005 MS Exchange Tool RoyalCli Royal DNS Mirage
2018-03-10NCC GroupRob Smallridge
@online{smallridge:20180310:apt15:e5e7ef0, author = {Rob Smallridge}, title = {{APT15 is alive and strong: An analysis of RoyalCli and RoyalDNS}}, date = {2018-03-10}, organization = {NCC Group}, url = {https://www.nccgroup.trust/uk/about-us/newsroom-and-events/blogs/2018/march/apt15-is-alive-and-strong-an-analysis-of-royalcli-and-royaldns/}, language = {English}, urldate = {2019-12-19} } APT15 is alive and strong: An analysis of RoyalCli and RoyalDNS
BS2005 MS Exchange Tool RoyalCli Royal DNS Mirage
Yara Rules
[TLP:WHITE] win_royal_dns_auto (20201014 | autogenerated rule brought to you by yara-signator)
rule win_royal_dns_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2020-10-14"
        version = "1"
        description = "autogenerated rule brought to you by yara-signator"
        tool = "yara-signator v0.5.0"
        tool_config = "callsandjumps;datarefs;binvalue"
        malpedia_reference = "https://malpedia.caad.fkie.fraunhofer.de/details/win.royal_dns"
        malpedia_rule_date = "20201014"
        malpedia_hash = "a7e3bd57eaf12bf3ea29a863c041091ba3af9ac9"
        malpedia_version = "20201014"
        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 = { 33ff 33c9 33f6 84db 744c 90 80fb3d }
            // n = 7, score = 100
            //   33ff                 | xor                 edi, edi
            //   33c9                 | xor                 ecx, ecx
            //   33f6                 | xor                 esi, esi
            //   84db                 | test                bl, bl
            //   744c                 | je                  0x4e
            //   90                   | nop                 
            //   80fb3d               | cmp                 bl, 0x3d

        $sequence_1 = { c685f0feffff00 e8???????? 83c40c 6803010000 8d85e9fdffff 6a00 50 }
            // n = 7, score = 100
            //   c685f0feffff00       | mov                 byte ptr [ebp - 0x110], 0
            //   e8????????           |                     
            //   83c40c               | add                 esp, 0xc
            //   6803010000           | push                0x103
            //   8d85e9fdffff         | lea                 eax, [ebp - 0x217]
            //   6a00                 | push                0
            //   50                   | push                eax

        $sequence_2 = { 8bd8 83c404 85db 7507 6aff e8???????? }
            // n = 6, score = 100
            //   8bd8                 | mov                 ebx, eax
            //   83c404               | add                 esp, 4
            //   85db                 | test                ebx, ebx
            //   7507                 | jne                 9
            //   6aff                 | push                -1
            //   e8????????           |                     

        $sequence_3 = { 40 ff8df8feffff 880c37 75d6 8b4dfc }
            // n = 5, score = 100
            //   40                   | inc                 eax
            //   ff8df8feffff         | dec                 dword ptr [ebp - 0x108]
            //   880c37               | mov                 byte ptr [edi + esi], cl
            //   75d6                 | jne                 0xffffffd8
            //   8b4dfc               | mov                 ecx, dword ptr [ebp - 4]

        $sequence_4 = { 0fb61406 c1ea03 0fb69248132500 8811 0fb61c06 0fb6540601 c1ea06 }
            // n = 7, score = 100
            //   0fb61406             | movzx               edx, byte ptr [esi + eax]
            //   c1ea03               | shr                 edx, 3
            //   0fb69248132500       | movzx               edx, byte ptr [edx + 0x251348]
            //   8811                 | mov                 byte ptr [ecx], dl
            //   0fb61c06             | movzx               ebx, byte ptr [esi + eax]
            //   0fb6540601           | movzx               edx, byte ptr [esi + eax + 1]
            //   c1ea06               | shr                 edx, 6

        $sequence_5 = { 8b4104 83c104 898d9cfcffff 85c0 0f857bfbffff 8b858cfcffff 85c0 }
            // n = 7, score = 100
            //   8b4104               | mov                 eax, dword ptr [ecx + 4]
            //   83c104               | add                 ecx, 4
            //   898d9cfcffff         | mov                 dword ptr [ebp - 0x364], ecx
            //   85c0                 | test                eax, eax
            //   0f857bfbffff         | jne                 0xfffffb81
            //   8b858cfcffff         | mov                 eax, dword ptr [ebp - 0x374]
            //   85c0                 | test                eax, eax

        $sequence_6 = { 4f 75f6 8d442448 50 6802020000 }
            // n = 5, score = 100
            //   4f                   | dec                 edi
            //   75f6                 | jne                 0xfffffff8
            //   8d442448             | lea                 eax, [esp + 0x48]
            //   50                   | push                eax
            //   6802020000           | push                0x202

        $sequence_7 = { 83c40c 89b590fcffff 89b594fcffff eb3d 8b95b0fcffff 8d85d9feffff }
            // n = 6, score = 100
            //   83c40c               | add                 esp, 0xc
            //   89b590fcffff         | mov                 dword ptr [ebp - 0x370], esi
            //   89b594fcffff         | mov                 dword ptr [ebp - 0x36c], esi
            //   eb3d                 | jmp                 0x3f
            //   8b95b0fcffff         | mov                 edx, dword ptr [ebp - 0x350]
            //   8d85d9feffff         | lea                 eax, [ebp - 0x127]

        $sequence_8 = { 68???????? 41 51 8d95d8feffff 52 }
            // n = 5, score = 100
            //   68????????           |                     
            //   41                   | inc                 ecx
            //   51                   | push                ecx
            //   8d95d8feffff         | lea                 edx, [ebp - 0x128]
            //   52                   | push                edx

        $sequence_9 = { 8d71ff 23f0 3bf7 0f8d82000000 56 8d95e8fdffff 68???????? }
            // n = 7, score = 100
            //   8d71ff               | lea                 esi, [ecx - 1]
            //   23f0                 | and                 esi, eax
            //   3bf7                 | cmp                 esi, edi
            //   0f8d82000000         | jge                 0x88
            //   56                   | push                esi
            //   8d95e8fdffff         | lea                 edx, [ebp - 0x218]
            //   68????????           |                     

    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:
        description = "Detects malware from APT 15 report by NCC Group"
        author = "Florian Roth"
        reference = "https://goo.gl/HZ5XMN"
        date = "2018-03-10"
        hash1 = "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"
        sha256 = "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