{"id":13094,"date":"2018-08-13T11:10:05","date_gmt":"2018-08-13T19:10:05","guid":{"rendered":"https:\/\/www.palada.net\/index.php\/2018\/08\/13\/news-6861\/"},"modified":"2018-08-13T11:10:05","modified_gmt":"2018-08-13T19:10:05","slug":"news-6861","status":"publish","type":"post","link":"http:\/\/www.palada.net\/index.php\/2018\/08\/13\/news-6861\/","title":{"rendered":"Process Doppelg\u00e4nging meets Process Hollowing in Osiris dropper"},"content":{"rendered":"<p><strong>Credit to Author: hasherezade| Date: Mon, 13 Aug 2018 18:29:57 +0000<\/strong><\/p>\n<p>One of the Holly Grails for malware authors is a perfect way to impersonate a legitimate process. That would allow them to run their malicious module under the cover, being unnoticed by antivirus products. Over the years, various techniques have emerged in helping them to get closer to this goal. This topic is also interesting for researchers and reverse engineers, as it shows creative ways of using Windows APIs.<\/p>\n<p><a href=\"https:\/\/hshrzd.wordpress.com\/2017\/12\/18\/process-doppelganging-a-new-way-to-impersonate-a-process\/\" target=\"_blank\" rel=\"noopener\">Process Doppelg\u00e4nging<\/a>, a new technique of impersonating a process, was published last year at the\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=Cch8dvp836w\" data-rel=\"lightbox-video-0\" target=\"_blank\" rel=\"noopener\">Black Hat conference<\/a>. After some time, a ransomware named\u00a0<a href=\"https:\/\/securelist.com\/synack-targeted-ransomware-uses-the-doppelganging-technique\/85431\/\">SynAck was found adopting that technique<\/a> for malicious purposes. Even though\u00a0Process Doppelg\u00e4nging still remains rare in the wild, we recently discovered some of its traits in the dropper for the Osiris banking Trojan (<a href=\"https:\/\/www.proofpoint.com\/us\/threat-insight\/post\/kronos-reborn\">a new version of the infamous Kronos<\/a>). After closer examination, we found out that the original technique was further customized.<\/p>\n<p>Indeed, the malware authors have merged elements from both Process Doppelg\u00e4nging and Process Hollowing, picking the best parts of both techniques to create a more powerful combo. In this post, we take a closer look at how Osiris is deployed on victim machines, thanks to this interesting loader.<\/p>\n<h3>Overview<\/h3>\n<p>Osiris is loaded in three steps as pictured in the diagram below:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/diagram_.png\" data-rel=\"lightbox-0\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25095\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/diagram_-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/diagram_.png\" data-orig-size=\"580,101\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"diagram_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/diagram_-300x52.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/diagram_.png\" class=\"size-full wp-image-25095 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/diagram_.png\" alt=\"\" width=\"580\" height=\"101\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/diagram_.png 580w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/diagram_-300x52.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><\/a><\/p>\n<p>The first stage loader is the one that was inspired by the Process Doppelg\u00e4nging technique but with an innovative twist. Finally, Osiris proper is delivered thanks to a second stage loader.<\/p>\n<h3>Loading additional NTDLL<\/h3>\n<p>When ran, the initial dropper creates a new suspended process, wermgr.exe.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25115\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/dropper_run-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dropper_run-1.png\" data-orig-size=\"484,35\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"dropper_run\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dropper_run-1-300x22.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dropper_run-1.png\" class=\"size-full wp-image-25115 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dropper_run-1.png\" alt=\"\" width=\"484\" height=\"35\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dropper_run-1.png 484w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dropper_run-1-300x22.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dropper_run-1-470x35.png 470w\" sizes=\"auto, (max-width: 484px) 100vw, 484px\" \/><\/p>\n<p>Looking into the modules loaded within the injector&#8217;s process space, we can indeed see this additional copy of NTDLL:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/added_ntdll-1_.png\" data-rel=\"lightbox-1\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25097\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/added_ntdll-1_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/added_ntdll-1_.png\" data-orig-size=\"612,207\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"added_ntdll-1_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/added_ntdll-1_-300x101.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/added_ntdll-1_-600x203.png\" class=\"size-full wp-image-25097 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/added_ntdll-1_.png\" alt=\"\" width=\"612\" height=\"207\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/added_ntdll-1_.png 612w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/added_ntdll-1_-300x101.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/added_ntdll-1_-600x203.png 600w\" sizes=\"auto, (max-width: 612px) 100vw, 612px\" \/><\/a><\/p>\n<p>This is a well-known technique that some malware authors use in order to evade monitoring applications and hide the API calls that they use. When we closely examine what functions are called from that additional NTDLL, we find more interesting details. It calls several APIs related to NTFS transactions. It was easy to guess that the technique of Process Doppelg\u00e4nging, which relies on this mechanism, was applied here.<\/p>\n<p>NTDLL is a special, low-level DLL. Basically, it is just a wrapper around <a href=\"https:\/\/en.wikipedia.org\/wiki\/System_call\" target=\"_blank\" rel=\"noopener\">syscalls<\/a>. It does not have any dependencies from other DLLs in the system. Thanks to this, it can be loaded conveniently, without the need to fill its import table.<\/p>\n<p>Other system DLLs, such as Kernel32, rely heavily on functions exported from NTDLL. This is why many user-land monitoring tools hook and intercept the functions exported by NTDLL: to watch what functions are being called and check if the process does not display any suspicious activity.<\/p>\n<p>Of course malware authors know about this, so sometimes, in order to fool this mechanism, they load their own, fresh and unhooked copy of NTDLL from disk. There are several ways to implement this. Let&#8217;s have a look how the authors of the Osiris dropper did it.<\/p>\n<p>Looking at the memory mapping, we see that the additional NTDLL is loaded as an image, just like other DLLs. This type of mapping is typical for DLLs loaded by <code>LoadLibrary<\/code> function or its low-level version from NTDLL, <code>LdrLoadDll<\/code>. But NTDLL is loaded by default in every executable, and loading the same DLL twice is impossible by the official API.<\/p>\n<p>Usually, malware authors decide to map the second copy manually, but that gives a different mapping type and stands out from the normally-loaded DLLs. Here, the authors made a workaround: they loaded the file as a section, using the following functions:<\/p>\n<ul>\n<li><code>ntdll.NtCreateFile<\/code> &#8211; to open the ntdll.dll file<\/li>\n<li><code>ntdll.<a href=\"https:\/\/docs.microsoft.com\/en-us\/windows-hardware\/drivers\/ddi\/content\/wdm\/nf-wdm-zwcreatesection\" target=\"_blank\" rel=\"noopener\">NtCreateSection<\/a><\/code> &#8211; to create a section out of this file<\/li>\n<li><code>ntdll.ZwMapViewOfSection<\/code> &#8211; to map this section into the process address space<\/li>\n<\/ul>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_and_map_.png\" data-rel=\"lightbox-2\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25098\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/create_and_map_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_and_map_.png\" data-orig-size=\"480,196\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"create_and_map_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_and_map_-300x123.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_and_map_.png\" class=\"size-full wp-image-25098 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_and_map_.png\" alt=\"\" width=\"480\" height=\"196\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_and_map_.png 480w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_and_map_-300x123.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/a><\/p>\n<p>This was a smart move because the DLL is mapped as an image, so it looks like it was loaded in a typical way.<\/p>\n<p>This DLL was further used to make the payload injection more stealthy. Having their fresh copy of NTDLL, they were sure that the functions used from there are not hooked by security products.<\/p>\n<h3>Process Doppelg\u00e4nging and Process Hollowing<\/h3>\n<p>The way in which the loader injects the payload into a new process displays some significant similarities with Process Doppleg\u00e4nging. However, if we analyze it very carefully, we can see also differences from the classic implementation proposed last year at Black Hat. The differing elements are closer to Process Hollowing.<\/p>\n<p>Classic Process Doppelg\u00e4nging:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dopel1_.png\" data-rel=\"lightbox-3\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25140\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/dopel1_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dopel1_.png\" data-orig-size=\"471,301\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"dopel1_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dopel1_-300x192.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dopel1_.png\" class=\"size-full wp-image-25140 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dopel1_.png\" alt=\"\" width=\"471\" height=\"301\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dopel1_.png 471w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/dopel1_-300x192.png 300w\" sizes=\"auto, (max-width: 471px) 100vw, 471px\" \/><\/a><\/p>\n<p>Process Hollowing:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/hollowing1-1_.png\" data-rel=\"lightbox-4\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25141\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/hollowing1-1_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/hollowing1-1_.png\" data-orig-size=\"551,412\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"hollowing1-1_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/hollowing1-1_-300x224.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/hollowing1-1_.png\" class=\"size-full wp-image-25141 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/hollowing1-1_.png\" alt=\"\" width=\"551\" height=\"412\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/hollowing1-1_.png 551w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/hollowing1-1_-300x224.png 300w\" sizes=\"auto, (max-width: 551px) 100vw, 551px\" \/><\/a><\/p>\n<p>Osiris Loader:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osildr1-2_.png\" data-rel=\"lightbox-5\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25142\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/osildr1-2_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osildr1-2_.png\" data-orig-size=\"556,492\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"osildr1-2_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osildr1-2_-300x265.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osildr1-2_.png\" class=\"size-full wp-image-25142 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osildr1-2_.png\" alt=\"\" width=\"556\" height=\"492\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osildr1-2_.png 556w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osildr1-2_-300x265.png 300w\" sizes=\"auto, (max-width: 556px) 100vw, 556px\" \/><\/a><\/p>\n<h3>Creating a new process<\/h3>\n<p>The Osiris loader starts by creating the process into which it is going to inject. The process is created by a function from Kernel32: CreateProcessInternalW:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_internal_.png\" data-rel=\"lightbox-6\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25099\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/create_process_internal_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_internal_.png\" data-orig-size=\"547,206\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"create_process_internal_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_internal_-300x113.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_internal_.png\" class=\"size-full wp-image-25099 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_internal_.png\" alt=\"\" width=\"547\" height=\"206\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_internal_.png 547w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_internal_-300x113.png 300w\" sizes=\"auto, (max-width: 547px) 100vw, 547px\" \/><\/a><\/p>\n<p>The new process (wermgr.exe) is created in a suspended state from the original file. So far, it reminds us of Process Hollowing, a much older technique of process impersonation.<\/p>\n<p>In the Process Doppleg\u00e4nging algorithm, the step of creating the new process is taken much later and uses a different, undocumented API: NtCreateProcessEx:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_.png\" data-rel=\"lightbox-7\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25100\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/create_process_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_.png\" data-orig-size=\"403,185\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"create_process_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_-300x138.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_.png\" class=\"size-full wp-image-25100 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_.png\" alt=\"\" width=\"403\" height=\"185\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_.png 403w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_-300x138.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_process_-400x185.png 400w\" sizes=\"auto, (max-width: 403px) 100vw, 403px\" \/><\/a><\/p>\n<p>This difference is significant, because in Process Doppelg\u00e4nging, the new process is created not from the original file, but from a special buffer (section). This section was supposed to be created earlier, using an &#8220;invisible&#8221; file created within the NTFS transaction. In the Osiris loader, this part also occurs, but the order is turned upside down, making us question if we can call it the same algorithm.<\/p>\n<p>After the process is created, the same image\u00a0(wermgr.exe) is mapped into the context of the loader, just like it was previously done with NTDLL.<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/mapped_wermgr_.png\" data-rel=\"lightbox-8\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25143\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/mapped_wermgr_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/mapped_wermgr_.png\" data-orig-size=\"613,193\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"mapped_wermgr_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/mapped_wermgr_-300x94.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/mapped_wermgr_-600x189.png\" class=\"size-full wp-image-25143 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/mapped_wermgr_.png\" alt=\"\" width=\"613\" height=\"193\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/mapped_wermgr_.png 613w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/mapped_wermgr_-300x94.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/mapped_wermgr_-600x189.png 600w\" sizes=\"auto, (max-width: 613px) 100vw, 613px\" \/><\/a><\/p>\n<p>As it later turns out, the loader will patch the remote process. The local copy of the wermgr.exe will be used to gather information about where the patches should be applied.<\/p>\n<h3>Usage of NTFS transactions<\/h3>\n<p>Let&#8217;s start from having a brief look at what are the NTFS transactions. This mechanism is commonly used while operating on databases\u2014in a similar way, they exist in the NTFS file system. The NTFS transactions encapsulate a series of operations into a single unit. When the file is created inside the transaction, nothing from outside can have access to it until the transaction is committed. Process Doppelg\u00e4nging uses them in order to create invisible files where the payload is dropped.<\/p>\n<p>In the analyzed case, the usage of NTFS transactions is exactly the same. We can spot only small differences in the APIs used. The loader creates a new transaction, within which a new file is created. The original implementation used <span class=\"pl-c1\"><code>CreateTransaction<\/code> and <code>CreateFileTransacted<\/code> from Kernel32. Here, they were substituted by low-level equivalents.<br \/> <\/span><\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_current_transaction_.png\" data-rel=\"lightbox-9\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25101\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/set_current_transaction_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_current_transaction_.png\" data-orig-size=\"692,97\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"set_current_transaction_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_current_transaction_-300x42.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_current_transaction_-600x84.png\" class=\"size-full wp-image-25101 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_current_transaction_.png\" alt=\"\" width=\"692\" height=\"97\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_current_transaction_.png 692w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_current_transaction_-300x42.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_current_transaction_-600x84.png 600w\" sizes=\"auto, (max-width: 692px) 100vw, 692px\" \/><\/a><\/p>\n<p><span class=\"pl-c1\">First, a function <code>ZwCreateTransaction<\/code> from a NTDLL is called.<\/span> Then, instead of <code>CreateFileTransacted<\/code>, the authors <a href=\"http:\/\/microsoft.public.win32.programmer.kernel.narkive.com\/MH2k9XfA\/ntfs-transaction-using-native-functions-in-user-mode\" target=\"_blank\" rel=\"noopener\">open the transacted file<\/a> by <code>RtlSetCurrentTransaction<\/code> along with <code>ZwCreateFile<\/code> (the created file is %TEMP%\\Liebert.bmp). Then, the dropper writes a buffer into to the file. Analogically, <code>RtlSetCurrentTransaction<\/code> with <code>ZwWriteFile<\/code> is used.<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/write_file-1_.png\" data-rel=\"lightbox-10\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25102\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/write_file-1_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/write_file-1_.png\" data-orig-size=\"495,296\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"write_file-1_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/write_file-1_-300x179.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/write_file-1_.png\" class=\"size-full wp-image-25102 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/write_file-1_.png\" alt=\"\" width=\"495\" height=\"296\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/write_file-1_.png 495w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/write_file-1_-300x179.png 300w\" sizes=\"auto, (max-width: 495px) 100vw, 495px\" \/><\/a><\/p>\n<p>We can see that the buffer that is being written contains the new PE file: the second stage payload. Typically for this technique, the file is visible only within the transaction and cannot be opened by other processes, such as AV scanners.<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_section_.png\" data-rel=\"lightbox-11\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25103\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/create_section_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_section_.png\" data-orig-size=\"637,114\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"create_section_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_section_-300x54.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_section_-600x107.png\" class=\"size-full wp-image-25103 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_section_.png\" alt=\"\" width=\"637\" height=\"114\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_section_.png 637w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_section_-300x54.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_section_-600x107.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/create_section_-630x114.png 630w\" sizes=\"auto, (max-width: 637px) 100vw, 637px\" \/><\/a><\/p>\n<p>This transacted file is then used to create a section. The function that can do it is available only via low-level API: ZwCreateSection\/NtCreateSection.<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/rollback_transaction_.png\" data-rel=\"lightbox-12\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25104\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/rollback_transaction_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/rollback_transaction_.png\" data-orig-size=\"606,121\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"rollback_transaction_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/rollback_transaction_-300x60.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/rollback_transaction_-600x120.png\" class=\"size-full wp-image-25104 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/rollback_transaction_.png\" alt=\"\" width=\"606\" height=\"121\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/rollback_transaction_.png 606w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/rollback_transaction_-300x60.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/rollback_transaction_-600x120.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/rollback_transaction_-604x121.png 604w\" sizes=\"auto, (max-width: 606px) 100vw, 606px\" \/><\/a><\/p>\n<p>After the section is created, that file is no longer needed. The transaction gets rolled back (by <code>ZwRollbackTransaction<\/code>), and the changes to the file are never saved on the disk.<\/p>\n<p>So, the part described above is identical to the analogical part of Process Doppelg\u00e4nging. Authors of the dropper made it even more stealthy by using low-level equivalents of the functions, called from a custom copy of NTDLL.<\/p>\n<h3>From a section to a process<\/h3>\n<p>At this point, the Osiris dropper creates two completely unrelated elements:<\/p>\n<ul>\n<li>A process (at this moment containing a mapped, legitimate executable wermgr.exe)<\/li>\n<li>A section (created from the transacted file) and containing the malicious payload<\/li>\n<\/ul>\n<p>If this were typical Process Doppelg\u00e4nging, this situation would never occur, and we would have the process created directly based on the section with the mapped payload. So, the question arises, how did the author of the dropper decide to merge the elements together at this point?<\/p>\n<p>If we trace the execution, we can see following function being called, just after the transaction is rolled back (format: RVA;function):<\/p>\n<pre>4b1e6;ntdll_1.ZwQuerySection  4b22b;ntdll.NtClose  4b239;ntdll.NtClose  4aab8;ntdll_1.ZwMapViewOfSection  4af27;ntdll_1.ZwProtectVirtualMemory  4af5b;ntdll_1.ZwWriteVirtualMemory  4af8a;ntdll_1.ZwProtectVirtualMemory  4b01c;ntdll_1.ZwWriteVirtualMemory  4b03a;ntdll_1.ZwResumeThread  <\/pre>\n<p>So, it looks like the newly created section is just mapped into the new process as an additional module. After writing the payload into memory and setting the necessary patches, such as Entry Point redirection, the process is resumed:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/resume_proc_.png\" data-rel=\"lightbox-13\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25105\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/resume_proc_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/resume_proc_.png\" data-orig-size=\"606,129\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"resume_proc_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/resume_proc_-300x64.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/resume_proc_-600x128.png\" class=\"size-full wp-image-25105 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/resume_proc_.png\" alt=\"\" width=\"606\" height=\"129\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/resume_proc_.png 606w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/resume_proc_-300x64.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/resume_proc_-600x128.png 600w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/resume_proc_-604x129.png 604w\" sizes=\"auto, (max-width: 606px) 100vw, 606px\" \/><\/a><\/p>\n<p>The way in which the execution was redirected looks similar to variants of Process Hollowing. <a href=\"https:\/\/github.com\/hasherezade\/demos\/blob\/master\/run_pe\/src\/runpe.h#L127\" target=\"_blank\" rel=\"noopener\">The PEB of the remote process is patched<\/a>, and the new module base is set to the added section. (Thanks to this, imports will get loaded automatically when the process resumes.)<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patching_peb_.png\" data-rel=\"lightbox-14\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25144\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/patching_peb_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patching_peb_.png\" data-orig-size=\"753,202\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"patching_peb_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patching_peb_-300x80.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patching_peb_-600x161.png\" class=\"size-full wp-image-25144 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patching_peb_.png\" alt=\"\" width=\"753\" height=\"202\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patching_peb_.png 753w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patching_peb_-300x80.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patching_peb_-600x161.png 600w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\" \/><\/a><\/p>\n<p>The Entry Point redirection is, however, done just by a patch at the Entry Point address of the original module. A single jump redirects to the Entry Point of the injected module:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25118\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/patched_ep-4\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patched_ep-1.png\" data-orig-size=\"451,94\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"patched_ep\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patched_ep-1-300x63.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patched_ep-1.png\" class=\"size-full wp-image-25118 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patched_ep-1.png\" alt=\"\" width=\"451\" height=\"94\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patched_ep-1.png 451w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/patched_ep-1-300x63.png 300w\" sizes=\"auto, (max-width: 451px) 100vw, 451px\" \/><\/p>\n<p>In case patching the Entry Point has failed, the loader contains a second variant of Entry Point redirection, by setting the new address in the thread context (ZwGetThreadContext -&gt; ZwSetThreadContext), which is <a href=\"https:\/\/github.com\/hasherezade\/demos\/blob\/master\/run_pe\/src\/runpe.h#L139\" target=\"_blank\" rel=\"noopener\">a classic technique used in Process Hollowing<\/a>:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_context_-1.png\" data-rel=\"lightbox-15\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25145\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/set_context_-2\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_context_-1.png\" data-orig-size=\"497,278\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"set_context_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_context_-1-300x168.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_context_-1.png\" class=\"size-full wp-image-25145 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_context_-1.png\" alt=\"\" width=\"497\" height=\"278\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_context_-1.png 497w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_context_-1-300x168.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/set_context_-1-400x225.png 400w\" sizes=\"auto, (max-width: 497px) 100vw, 497px\" \/><\/a><\/p>\n<h3>Best of both worlds<\/h3>\n<p>As we can see, the author merged some elements of Process Doppelg\u00e4nging with some elements of Process Hollowing. This choice was not accidental. Both of those techniques have strong and weak points, but by merging them together, we get a power combo.<\/p>\n<p>The weakest point of Process Hollowing is about the protection rights set on the memory space where the payload is injected (more info <a href=\"https:\/\/youtu.be\/Cch8dvp836w?t=569\" data-rel=\"lightbox-video-1\" target=\"_blank\" rel=\"noopener\">here<\/a>). Process Hollowing allocates memory pages in the remote process by VirtualAllocEx, then writes the payload there. It gives one undesirable effect: the access rights (MEM_PRIVATE) were different than in the executable that is normally loaded (MEM_IMAGE).<\/p>\n<p>Example of a payload loaded using Process Hollowing:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25149\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/hollowing_example-3\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/hollowing_example-2.png\" data-orig-size=\"354,105\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"hollowing_example\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/hollowing_example-2-300x89.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/hollowing_example-2.png\" class=\"size-full wp-image-25149 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/hollowing_example-2.png\" alt=\"\" width=\"354\" height=\"105\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/hollowing_example-2.png 354w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/hollowing_example-2-300x89.png 300w\" sizes=\"auto, (max-width: 354px) 100vw, 354px\" \/><\/p>\n<p>The major obstacle in loading the payload as an image is that, to do so, it has to be first dropped on the disk. Of course we cannot do this, because once dropped, it would easily be picked by an antivirus.<\/p>\n<p>Process Doppelg\u00e4nging on the other hand provides a solution: invisible transacted files, where the payload can be safely dropped without being noticed. This technique assumes that the transacted file will be used to create a section (MEM_IMAGE), and then this section will become a base of the new process (<a href=\"https:\/\/github.com\/hasherezade\/process_doppelganging\/blob\/master\/main.cpp#L196\" target=\"_blank\" rel=\"noopener\">using NtCreateProcessEx<\/a>).<\/p>\n<p>Example of a payload loaded using Process Doppelg\u00e4nging:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25147\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/doppel_example\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/doppel_example.png\" data-orig-size=\"356,107\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"doppel_example\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/doppel_example-300x90.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/doppel_example.png\" class=\"size-full wp-image-25147 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/doppel_example.png\" alt=\"\" width=\"356\" height=\"107\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/doppel_example.png 356w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/doppel_example-300x90.png 300w\" sizes=\"auto, (max-width: 356px) 100vw, 356px\" \/><\/p>\n<p>This solution works well, but requires that all the process parameters have to be also loaded manually: first creating them by\u00a0<a href=\"https:\/\/github.com\/hasherezade\/process_doppelganging\/blob\/master\/main.cpp#L76\" target=\"_blank\" rel=\"noopener\"><span class=\"pl-c1\">RtlCreateProcessParametersEx<\/span> and then setting them into the remote PEB<\/a>. It was making it difficult to run a 32-bit process on 64-bit system, because in case of WoW64 processes, there are 2 PEBs to be filled.<\/p>\n<p>Those problems of Process Doppelg\u00e4nging can be solved easily if we create the process just like Process Hollowing does it. Rather than using low-level API, which was the only way to create a new process out of a section, the authors created a process out of the legitimate file, using a documented API from Kernel32. Yet, the section carrying the payload, loaded with proper access rights (MEM_IMAGE), can be added later, and the execution can get redirected to it.<\/p>\n<h3>Second stage loader<\/h3>\n<p>The next layer (<a href=\"https:\/\/www.virustotal.com\/#\/file\/40288538ec1b749734cb58f95649bd37509281270225a87597925f606c013f3a\/details\" target=\"_blank\" rel=\"noopener\">8d58c731f61afe74e9f450cc1c7987be<\/a>) is not the core yet, but the next stage of the loader. It imports only one DLL, Kernel32.<\/p>\n<p>Its only role is to load the final payload. At this stage, we can hardly find something innovative. The Osiris core is unpacked piece by piece and manually loaded along with its dependencies into a newly-allocated memory area within the loader process.<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/final_payload_.png\" data-rel=\"lightbox-16\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25106\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/final_payload_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/final_payload_.png\" data-orig-size=\"693,215\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"final_payload_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/final_payload_-300x93.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/final_payload_-600x186.png\" class=\"size-full wp-image-25106 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/final_payload_.png\" alt=\"\" width=\"693\" height=\"215\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/final_payload_.png 693w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/final_payload_-300x93.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/final_payload_-600x186.png 600w\" sizes=\"auto, (max-width: 693px) 100vw, 693px\" \/><\/a><\/p>\n<p>After this self-injection, the loader jumps into the payload&#8217;s entry point:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/payload_entry_point_.png\" data-rel=\"lightbox-17\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25107\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/payload_entry_point_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/payload_entry_point_.png\" data-orig-size=\"570,225\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"payload_entry_point_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/payload_entry_point_-300x118.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/payload_entry_point_.png\" class=\"size-full wp-image-25107 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/payload_entry_point_.png\" alt=\"\" width=\"570\" height=\"225\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/payload_entry_point_.png 570w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/payload_entry_point_-300x118.png 300w\" sizes=\"auto, (max-width: 570px) 100vw, 570px\" \/><\/a><\/p>\n<p>The interesting thing is that the application&#8217;s entry point is different than the entry point saved in the header. So, if we dump the payload and try to run it interdependently, we will not get the same code executed. This is an interesting technique used to misguide researchers.<\/p>\n<p>This is the entry point that was set in the headers is at RVA 0x26840:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/original_ep_.png\" data-rel=\"lightbox-18\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25108\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/original_ep_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/original_ep_.png\" data-orig-size=\"467,97\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"original_ep_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/original_ep_-300x62.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/original_ep_.png\" class=\"size-full wp-image-25108 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/original_ep_.png\" alt=\"\" width=\"467\" height=\"97\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/original_ep_.png 467w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/original_ep_-300x62.png 300w\" sizes=\"auto, (max-width: 467px) 100vw, 467px\" \/><\/a><\/p>\n<p>The call leads to a function that makes the application go in an infinite sleep loop:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/fake_ep_.png\" data-rel=\"lightbox-19\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25109\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/fake_ep_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/fake_ep_.png\" data-orig-size=\"658,473\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"fake_ep_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/fake_ep_-300x216.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/fake_ep_-600x431.png\" class=\"size-full wp-image-25109 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/fake_ep_.png\" alt=\"\" width=\"658\" height=\"473\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/fake_ep_.png 658w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/fake_ep_-300x216.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/fake_ep_-600x431.png 600w\" sizes=\"auto, (max-width: 658px) 100vw, 658px\" \/><\/a><\/p>\n<p>The real entry point, from which the execution of the malware should start, is at 0x25386, and it is known only to the loader.<\/p>\n<h4><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osiris_ep_code_.png\" data-rel=\"lightbox-20\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25110\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/osiris_ep_code_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osiris_ep_code_.png\" data-orig-size=\"754,171\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"osiris_ep_code_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osiris_ep_code_-300x68.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osiris_ep_code_-600x136.png\" class=\"size-full wp-image-25110 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osiris_ep_code_.png\" alt=\"\" width=\"754\" height=\"171\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osiris_ep_code_.png 754w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osiris_ep_code_-300x68.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/osiris_ep_code_-600x136.png 600w\" sizes=\"auto, (max-width: 754px) 100vw, 754px\" \/><\/a><\/h4>\n<h3>The second stage versus Kronos loader<\/h3>\n<p>A similar trick using a hidden entry point was used by the original Kronos (<a href=\"https:\/\/www.hybrid-analysis.com\/sample\/8389dd850c991127f3b3402dce4201cb693ec0fb7b1e7663fcfa24ef30039851?environmentId=100\" target=\"_blank\" rel=\"noopener\">2a550956263a22991c34f076f3160b49<\/a>). In Kronos&#8217; case, the final payload is injected into svchost. The execution is redirected to the core by patching the entry point in svchost:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/svchost_patch_.png\" data-rel=\"lightbox-21\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25111\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/svchost_patch_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/svchost_patch_.png\" data-orig-size=\"478,62\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"svchost_patch_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/svchost_patch_-300x39.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/svchost_patch_.png\" class=\"size-full wp-image-25111 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/svchost_patch_.png\" alt=\"\" width=\"478\" height=\"62\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/svchost_patch_.png 478w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/svchost_patch_-300x39.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/svchost_patch_-470x62.png 470w\" sizes=\"auto, (max-width: 478px) 100vw, 478px\" \/><\/a><\/p>\n<p>In this case, the entry point within the payload is at RVA 0x13B90, while the entry point saved in the payload&#8217;s\u00a0header (<a href=\"https:\/\/www.virustotal.com\/#\/file\/258d67283afa5195436b1eaa8d02953785974d3709109ebff3b9b638332df514\/details\" target=\"_blank\" rel=\"noopener\">d8425578fc2d84513f1f22d3d518e3c3<\/a>) is at 0x15002.<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_.png\" data-rel=\"lightbox-22\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25112\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/kronos_ep_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_.png\" data-orig-size=\"431,152\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"kronos_ep_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_-300x106.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_.png\" class=\"size-full wp-image-25112 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_.png\" alt=\"\" width=\"431\" height=\"152\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_.png 431w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_-300x106.png 300w\" sizes=\"auto, (max-width: 431px) 100vw, 431px\" \/><\/a><\/p>\n<p>The code at the real Kronos entry point displays similarities with the analogical point in Osiris. Yet, we can see they are not identical:<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_code_.png\" data-rel=\"lightbox-23\" title=\"\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"25113\" data-permalink=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/attachment\/kronos_ep_code_\/\" data-orig-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_code_.png\" data-orig-size=\"750,150\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"kronos_ep_code_\" data-image-description=\"\" data-medium-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_code_-300x60.png\" data-large-file=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_code_-600x120.png\" class=\"size-full wp-image-25113 aligncenter\" src=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_code_.png\" alt=\"\" width=\"750\" height=\"150\" srcset=\"https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_code_.png 750w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_code_-300x60.png 300w, https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/kronos_ep_code_-600x120.png 600w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/a><\/p>\n<h3>A precision implementation<\/h3>\n<p>The first stage loader is strongly inspired by Process Doppleg\u00e4nging and is implemented in a clean and professional way. The author adopted elements from a relatively new technique and made the best out of it by composing it with other known tricks. The precision used here reminds us of the code used in the original Kronos. However, we can&#8217;t be sure if the first layer is written by the same author as the core bot. Malware distributors often use <a href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2015\/12\/malware-crypters-the-deceptive-first-layer\/\" target=\"_blank\" rel=\"noopener\">third-party crypters<\/a> to pack their malware. The second stage is more tightly coupled with the payload, and here we can say with more confidence that this layer was prepared along with the core.<\/p>\n<p><a href=\"https:\/\/www.malwarebytes.com\/\" target=\"_blank\" rel=\"noopener\">Malwarebytes<\/a> can protect against this threat early on by breaking its distribution chains that includes malicious documents sent in spam campaigns and drive-by downloads, thanks to our anti-exploit module. Additionally, our anti-malware engine detects both the dropper and Osiris core.<\/p>\n<h3>Indicators of Compromise (IOCs)<\/h3>\n<p>Stage 1 (original sample)<\/p>\n<pre>e7d3181ef643d77bb33fe328d1ea58f512b4f27c8e6ed71935a2e7548f2facc0<\/pre>\n<p>Stage 2 (second stage loader)<\/p>\n<pre>40288538ec1b749734cb58f95649bd37509281270225a87597925f606c013f3a<\/pre>\n<p>Osiris (core bot)<\/p>\n<pre>d98a9c5b4b655c6d888ab4cf82db276d9132b09934a58491c642edf1662e831e<\/pre>\n<p>The post <a rel=\"nofollow\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/\">Process Doppelg\u00e4nging meets Process Hollowing in Osiris dropper<\/a> appeared first on <a rel=\"nofollow\" href=\"https:\/\/blog.malwarebytes.com\">Malwarebytes Labs<\/a>.<\/p>\n<p><a href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/\" target=\"bwo\" >https:\/\/blog.malwarebytes.com\/feed\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p><strong>Credit to Author: hasherezade| Date: Mon, 13 Aug 2018 18:29:57 +0000<\/strong><\/p>\n<table cellpadding='10'>\n<tr>\n<td valign='top' align='center'><a href='https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/' title='Process Doppelg\u00e4nging meets Process Hollowing in Osiris dropper'><img src='https:\/\/blog.malwarebytes.com\/wp-content\/uploads\/2018\/08\/shutterstock_1929537.jpg' border='0'  width='300px'  \/><\/a><\/td>\n<\/tr>\n<tr>\n<td valign='top' align='left'>Process doppleganging, a rare technique of impersonating a process, was discovered last year, but hasn&#8217;t been seen much in the wild since. It was an interesting surprise, then, to discover its use mixed in with Process Hollowing, yet another technique, in a dropper for the Osiris banking Trojan.<\/p>\n<p>Categories: <\/p>\n<ul class=\"post-categories\">\n<li><a href=\"https:\/\/blog.malwarebytes.com\/category\/threat-analysis\/malware-threat-analysis\/\" rel=\"category tag\">Malware<\/a><\/li>\n<li><a href=\"https:\/\/blog.malwarebytes.com\/category\/threat-analysis\/\" rel=\"category tag\">Threat analysis<\/a><\/li>\n<\/ul>\n<p>Tags: <a href=\"https:\/\/blog.malwarebytes.com\/tag\/dropper\/\" rel=\"tag\">dropper<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/kronos\/\" rel=\"tag\">kronos<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/osiris\/\" rel=\"tag\">osiris<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/osiris-dropper\/\" rel=\"tag\">Osiris dropper<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/process-doppleganging\/\" rel=\"tag\">process doppleganging<\/a><a href=\"https:\/\/blog.malwarebytes.com\/tag\/trojan\/\" rel=\"tag\">trojan<\/a><\/p>\n<table width='100%'>\n<tr>\n<td align=right>\n<p><b>(<a href='https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/' title='Process Doppelg\u00e4nging meets Process Hollowing in Osiris dropper'>Read more&#8230;<\/a>)<\/b><\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/td>\n<\/tr>\n<\/table>\n<p>The post <a rel=\"nofollow\" href=\"https:\/\/blog.malwarebytes.com\/threat-analysis\/2018\/08\/osiris-using-process-doppelganging\/\">Process Doppelg\u00e4nging meets Process Hollowing in Osiris dropper<\/a> appeared first on <a rel=\"nofollow\" href=\"https:\/\/blog.malwarebytes.com\">Malwarebytes Labs<\/a>.<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[10488,10378],"tags":[19189,13840,3764,19190,19191,19192,10494,10833],"class_list":["post-13094","post","type-post","status-publish","format-standard","hentry","category-malwarebytes","category-security","tag-dropper","tag-kronos","tag-malware","tag-osiris","tag-osiris-dropper","tag-process-doppleganging","tag-threat-analysis","tag-trojan"],"_links":{"self":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/13094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/comments?post=13094"}],"version-history":[{"count":0,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/posts\/13094\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/media?parent=13094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/categories?post=13094"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.palada.net\/index.php\/wp-json\/wp\/v2\/tags?post=13094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}