<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lab07-03.dll &#8211; @Forensicxs</title>
	<atom:link href="https://www.forensicxs.com/tag/lab07-03-dll/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.forensicxs.com</link>
	<description>Ethical Hacking &#124; Cybersecurity</description>
	<lastBuildDate>Fri, 14 May 2021 08:35:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>Introduction to Malware Analysis</title>
		<link>https://www.forensicxs.com/introduction-to-malware-analysis/</link>
					<comments>https://www.forensicxs.com/introduction-to-malware-analysis/#respond</comments>
		
		<dc:creator><![CDATA[Forensicxs]]></dc:creator>
		<pubDate>Sun, 28 Feb 2021 22:25:48 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Backdoor]]></category>
		<category><![CDATA[Dynamic Analysis]]></category>
		<category><![CDATA[IDA Pro]]></category>
		<category><![CDATA[kerne132.dll]]></category>
		<category><![CDATA[kernel32.dll]]></category>
		<category><![CDATA[Lab 7-3]]></category>
		<category><![CDATA[Lab07-03.dll]]></category>
		<category><![CDATA[Lab07-03.exe]]></category>
		<category><![CDATA[Malware]]></category>
		<category><![CDATA[Mutex]]></category>
		<category><![CDATA[Practical Malware Analysis]]></category>
		<category><![CDATA[Static Analysis]]></category>
		<category><![CDATA[System32]]></category>
		<category><![CDATA[Trojan]]></category>
		<category><![CDATA[ws2_32.dll]]></category>
		<guid isPermaLink="false">https://www.forensicxs.com/?p=1486</guid>

					<description><![CDATA[In this article, I&#8217;m going to go through a detailed review of a typical malware, as an introduction to malware analysis . I will cover techniques such as static and dynamic analysis, reverse engineering &#38; disassembly, and more. For this purpose, I&#8217;m going to take a sample provided in the excellent book &#8220;Practical Malware Analysis&#8220;. &#8230; <p class="link-more"><a href="https://www.forensicxs.com/introduction-to-malware-analysis/" class="more-link">Continue reading<span class="screen-reader-text"> "Introduction to Malware Analysis"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<p>In this article, I&#8217;m going to go through a detailed review of a typical malware, as an introduction to malware analysis . I will cover techniques such as static and dynamic analysis, reverse engineering &amp; disassembly, and more. For this purpose, I&#8217;m going to take a sample provided in the excellent book &#8220;<strong><span class="has-inline-color has-vivid-cyan-blue-color">Practical Malware Analysis</span></strong>&#8220;. I highly recommend to buy a copy of this book as it&#8217;s really a must have for any malware analyst. It will really take your hacking skills to the next level</p>



<figure class="wp-block-image size-large is-resized"><img fetchpriority="high" decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image.png" alt="" class="wp-image-1488" width="391" height="519" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image.png 519w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-226x300.png 226w" sizes="(max-width: 391px) 100vw, 391px" /></figure>



<p>The book proposes a malware library, for learning purposes, that can be downloaded here : <a href="https://practicalmalwareanalysis.com/labs/" target="_blank" rel="noreferrer noopener">https://practicalmalwareanalysis.com/labs/</a></p>



<p>I have selected the <strong><span class="has-inline-color has-vivid-cyan-blue-color">Lab 7-3</span></strong> for this article, as it&#8217;s asking for basic malware analysis techniques, but still provides an already complex piece of malware and a very good learning opportunity</p>



<p>To analyse this malware, you shall install a Virtual Machine (I have installed a copy of Windows 10 Enterprise in Virtual Box) and run it from within your VM. <strong><span class="has-inline-color has-vivid-cyan-blue-color">Don&#8217;t run it on your normal PC !</span></strong></p>



<p>Please note that this book has been written with Windows XP in mind&#8230;so running the malwares on Windows 10 may not provide all the expected results. But still, it provides an opportunity to learn as is the case with the example below</p>



<p>There are two files available for analysis</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-1.png" alt="" class="wp-image-1491" width="478" height="48" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-1.png 544w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-1-300x30.png 300w" sizes="(max-width: 478px) 100vw, 478px" /></figure>



<p><strong><span class="has-inline-color has-vivid-red-color">Malware Static Analysis</span></strong></p>



<p>This is the process of analyzing the code or structure of a program to determine its function. The program is not yet run at this point. Let&#8217;s go through, using some basic tools</p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">VirusTotal.com</span></strong></p>



<p>This site, owned by Google, is almost a mandatory first step for any malware analyst. It will run a scan of the file and detect known virus signatures, with some details. Let&#8217;s upload our files</p>



<p><strong><span class="has-inline-color has-vivid-cyan-blue-color">Lab07-03.exe</span></strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="935" height="754" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-2.png" alt="" class="wp-image-1494" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-2.png 935w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-2-300x242.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-2-768x619.png 768w" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /></figure>



<p>One issue that is immediately visible here, is the absence of standardization, naming the virus ! In fact, each anti virus editor provides a unique name</p>



<p>Let&#8217;s pick a few of them and learn a few things from Google</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-3.png" alt="" class="wp-image-1496" width="425" height="30" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-3.png 549w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-3-300x21.png 300w" sizes="(max-width: 425px) 100vw, 425px" /></figure>



<p>This virus is usually a <span class="has-inline-color has-luminous-vivid-orange-color"><strong>Trojan</strong></span>, that is capable of performing several tasks such as downloading, installing or running malware on the targeted computer</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-4.png" alt="" class="wp-image-1497" width="426" height="29" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-4.png 576w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-4-300x20.png 300w" sizes="(max-width: 426px) 100vw, 426px" /></figure>



<p>This malware is known to be a <strong><span class="has-inline-color has-luminous-vivid-orange-color">Backdoor</span></strong>, that is capable of installing all manner of malware on your computer</p>



<p>Let&#8217;s look into the details section and learn a few more things</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-5.png" alt="" class="wp-image-1498" width="484" height="61" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-5.png 641w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-5-300x37.png 300w" sizes="(max-width: 484px) 100vw, 484px" /></figure>



<p>We see that our executable is in the Portable Executable (PE), as all Windows executables and DLLs will be. It&#8217;s a data structure that contains the information necessary for the Windows OS loader to manage the wrapped executable code. In our case, it&#8217;s mainly written in C++</p>



<p><strong><span class="has-inline-color has-vivid-cyan-blue-color">Lab07-03.dll</span></strong></p>



<figure class="wp-block-image size-large"><img decoding="async" width="1025" height="768" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-6.png" alt="" class="wp-image-1499" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-6.png 1025w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-6-300x225.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-6-768x575.png 768w" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /></figure>



<p>Let&#8217;s search the Web again to learn more from these signatures</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-7.png" alt="" class="wp-image-1500" width="409" height="35" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-7.png 527w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-7-300x26.png 300w" sizes="(max-width: 409px) 100vw, 409px" /></figure>



<p>This Trojan acts as a malicious threat into your Windows computer system, that is capable of sending informations to a remote hacker</p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">Timestamp</span></strong></p>



<p>Let&#8217;s compare the timestamps of the .exe and the .dll, as found in VirusTotal</p>



<p>Here is the first one :</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-8.png" alt="" class="wp-image-1501" width="401" height="94" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-8.png 620w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-8-300x70.png 300w" sizes="(max-width: 401px) 100vw, 401px" /><figcaption>timestamp of Lab07-03.exe</figcaption></figure>



<p>to be compared with the second one :</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-9.png" alt="" class="wp-image-1502" width="396" height="95" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-9.png 626w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-9-300x72.png 300w" sizes="(max-width: 396px) 100vw, 396px" /><figcaption>timestamp of Lab07-03.dll</figcaption></figure>



<p>We see a very close match between the two files. This points to a creation by the same malware author</p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">Detecting Packers with PEiD</span></strong></p>



<p>Malwares are often obfuscated or packed to make their analysis more difficult. Obfuscation means that the execution code has been hidden in some way. Packing is a subset of Obfuscation, in which the code has been compressed and cannot be analyzed easily. These two techniques will make static analysis difficult</p>



<p>Here below is what PEiD does : in the red marked area, it will prompt the packing method, if any. In our case, the file is identified as a C++ file, hence it&#8217;s not packed</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-11.png" alt="" class="wp-image-1504" width="381" height="213" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-11.png 421w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-11-300x167.png 300w" sizes="(max-width: 381px) 100vw, 381px" /></figure>



<p>We get the same result with the .dll file</p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">Strings</span></strong></p>



<p>A normal program can be easily looked into for strings. This will usually allow to find interesting text that helps understand the purpose of the program. But, in the case of obfuscated or packed programs, there will be only a few strings readable, or none</p>



<p>We have seen above that our files are not packed, so we should be able to gather informations. To find the strings, we can use the strings command in Linux </p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-15.png" alt="" class="wp-image-1510" width="318" height="408" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-15.png 452w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-15-234x300.png 234w" sizes="(max-width: 318px) 100vw, 318px" /><figcaption>strings command applied to Lab07-03.exe</figcaption></figure>



<p>In section<strong><span class="has-inline-color has-vivid-red-color"> 1</span></strong>, we see that the malware is manipulating some system files, which looks consistent with a Trojan trying to access our files</p>



<p>In section <strong><span class="has-inline-color has-vivid-red-color">2</span></strong>, we see the call to some Libraries : KERNEL32.dll is a common dll that contains core functionality, such as access and manipulation of memory, files, and hardware. The MSCVRT.dll contains program code that enables applications written in Microsoft Visual C++ to run properly, this is the case with our malware, as seen previously</p>



<p>In section <strong><span class="has-inline-color has-vivid-red-color">3</span></strong>, we see two lines which look identical at first glance, but can see that the Kernel32.dll library is also written as Kerne132.dll (the &#8220;l&#8221; is replaced by a &#8220;1&#8221;). This looks like a basic obfuscation and a potential attempt to replace the legit library by a malicious one</p>



<p>In section <strong><span class="has-inline-color has-vivid-red-color">4</span></strong>, we see the implementation of the malicious library in the system files system32</p>



<p>In section <strong><span class="has-inline-color has-vivid-red-color">5</span></strong>, we see the call to the Lab07-03.dll, which is another indication that the two files are strongly linked together</p>



<p>In section <strong><span class="has-inline-color has-vivid-red-color">6</span></strong>, we see the reference to the legit library in the system files system32</p>



<p>In section <strong><span class="has-inline-color has-vivid-red-color">7</span></strong>, we see a threatening message</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-16.png" alt="" class="wp-image-1511" width="208" height="210" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-16.png 286w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-16-150x150.png 150w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-16-100x100.png 100w" sizes="(max-width: 208px) 100vw, 208px" /><figcaption><em>strings command applied to Lab07-03.</em>dll</figcaption></figure>



<p>In section <strong><span class="has-inline-color has-vivid-red-color">1</span></strong>, we see the creation of a Mutex. It&#8217;s an object that coordinates multiple processes and threads. Usually, a Mutex is called to ensure that only one process is running at a given time, thus ensuring that only one version of a malware is up and running</p>



<p>In section <strong><span class="has-inline-color has-vivid-red-color">2</span></strong>, we see the inclusion of the library WS2_32.dll, which is a networking dll. A malware that accesses this library is likely to connect and perform network related tasks</p>



<p>In section <strong><span class="has-inline-color has-vivid-red-color">3</span></strong>, we can identify an IP address 127.26.152.13, this could be the IP used by a Command and Control server, but in this case we identify that this is a loopback address</p>



<p>What is this ? Here is a definition</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-27.png" alt="" class="wp-image-1528" width="510" height="134" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-27.png 915w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-27-300x79.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-27-768x202.png 768w" sizes="(max-width: 510px) 100vw, 510px" /></figure>



<p>Let&#8217;s ping this IP adress. We receive an acknowledgement, although this is a virtual address within our internal network. Nothing is sent over the Internet !</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-26.png" alt="" class="wp-image-1527" width="435" height="219" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-26.png 585w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-26-300x151.png 300w" sizes="(max-width: 435px) 100vw, 435px" /><figcaption>Ping to the loopback IP 127.26.152.13</figcaption></figure>



<p>We also see a strange text &#8220;SADFHUHF&#8221; . This may be useful later on in our analysis, let&#8217;s remember</p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">pestudio</span></strong></p>



<p>This software will greatly complement what we have seen above. We can confirm the libraries imported in the .exe and the .dll, with the corresponding strings</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-18-1024x495.png" alt="" class="wp-image-1514" width="578" height="279" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-18-1024x495.png 1024w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-18-300x145.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-18-768x371.png 768w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-18.png 1044w" sizes="(max-width: 578px) 100vw, 578px" /><figcaption>Lab07-03.exe</figcaption></figure>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-19-1024x400.png" alt="" class="wp-image-1515" width="579" height="226" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-19-1024x400.png 1024w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-19-300x117.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-19-768x300.png 768w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-19.png 1045w" sizes="(max-width: 579px) 100vw, 579px" /><figcaption>Lab07-03.dll</figcaption></figure>



<p><strong><span class="has-inline-color has-vivid-red-color">Malware Dynamic Analysis</span></strong></p>



<p>This is the examination of the malware, either during its execution, or examining the system after the malware has been run. It is usually an efficient way to identify malware functionality. We are going to install, and run the tools below, before and after executing the malware</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="667" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-21-1024x667.png" alt="" class="wp-image-1518" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-21-1024x667.png 1024w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-21-300x195.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-21-768x500.png 768w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-21.png 1425w" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /><figcaption>Screenshot of the dynamic analysis tools</figcaption></figure>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">Procmon</span></strong></p>



<p>Process Monitor, or procmon, provides a way to monitor registry, file system, network, process and thread activity. It monitors all system calls as soon as it runs</p>



<p>We can follow our malware when we launch it</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-22-1024x267.png" alt="" class="wp-image-1519" width="785" height="204" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-22-1024x267.png 1024w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-22-300x78.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-22-768x200.png 768w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-22-1536x401.png 1536w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-22.png 1901w" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /><figcaption>Lab07-03.exe is run and highlighted in blue</figcaption></figure>



<p>If we click on kernel32.dll, we can see a bit more details</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-23-1024x388.png" alt="" class="wp-image-1520" width="786" height="298" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-23-1024x388.png 1024w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-23-300x114.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-23-768x291.png 768w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-23.png 1508w" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /></figure>



<p>We can&#8217;t find the kerne132.dll. If it runs somewhere, it is hidden to our eyes</p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">Process Explorer</span></strong></p>



<p>You can use PE to list active processes, DLLs loaded by a process, various process properties, and overall system informations</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-29-1024x860.png" alt="" class="wp-image-1530" width="573" height="481" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-29-1024x860.png 1024w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-29-300x252.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-29-768x645.png 768w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-29.png 1073w" sizes="(max-width: 573px) 100vw, 573px" /></figure>



<p>When launching the malware, we see the process quickly appearing, and then disappearing after less than a second</p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">Regshot</span></strong></p>



<p>It is a registry comparison tool that allows to take and compare two registry snapshots. You shall take a registry shot before running the malware, as the tool will analyze any differences found after running the malware. In our case, here is an extract with a focus on Kernel32.dll</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="277" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-25-1024x277.png" alt="" class="wp-image-1526" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-25-1024x277.png 1024w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-25-300x81.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-25-768x208.png 768w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-25.png 1276w" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /></figure>



<p>Please note we can&#8217;t find the kerne123.dll. If the malware calls this DLL, then it stays hidden obviously</p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">Wireshark</span></strong></p>



<p>It is a packet capture tool that intercepts and logs network traffic. It provides visualization, packet stream analysis, in-depth analysis of individual packets. Here is a snapshot</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="791" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-28-1024x791.png" alt="" class="wp-image-1529" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-28-1024x791.png 1024w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-28-300x232.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-28-768x594.png 768w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-28.png 1180w" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /></figure>



<p>As said before, the IP address 127.26.152.13 being a loopback address, our malware will not communicate over the Internet. Therefore we can&#8217;t find any traces in Wireshark</p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">Apate DNS</span></strong></p>



<p>This tool provides a quick way to see DNS requests made by a malware. It spoofs DNS responses to a user specified IP address. It responds to the DNS requests made by the malware with this IP. It can therefore record and analyze the DNS requests, providing insightfull informations to the analyst</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-24.png" alt="" class="wp-image-1522" width="513" height="374" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-24.png 666w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-24-300x219.png 300w" sizes="(max-width: 513px) 100vw, 513px" /></figure>



<p>Again, we can&#8217;t find any outside calls as our malware calls a local loopback</p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">Summary after Static &amp; Dynamic Analysis</span></strong></p>



<p>The above analysis has shown us that the malware is made of an .exe and .dll files. In real life, it would call for an external IP and would try to interact with a C&amp;C server, to manipulate some of our system files. But, in this exercise, the IP is a local loopback and there is no interaction possible with a C&amp;C. So, the dynamic analysis does not reveal important informations due to a lack of Internet interaction</p>



<p>The malware seems to rely on the kerne132.dll, trying to replace the kernel32.dll &#8220;behind the scene&#8221;, but the running process is still kernel32.dll. So far, this is only an hypothesis, nothing can really prove that in the above analysis</p>



<p>So, to really uncover the secrets of this malware, we really need to go deeper and try to Reverse Engineer the code. In fact, the methodes used so far only scratched the surface of the malware. These techniques are like trying to analyze a black box from outside. With Reverse Engineering, we can have a look inside !</p>



<p><strong><span class="has-inline-color has-vivid-red-color">Reverse Engineering</span></strong></p>



<p>We are going to use two different well known softwares :</p>



<p>IDA Pro : <a href="https://www.hex-rays.com/products/ida/" target="_blank" rel="noreferrer noopener">https://www.hex-rays.com/products/ida/</a> (I will use it as the main analyzer)</p>



<p>Ghidra : <a href="https://www.nsa.gov/resources/everyone/ghidra/" target="_blank" rel="noreferrer noopener">https://www.nsa.gov/resources/everyone/ghidra/</a> (I will use it to show some C code constructs recovered by Ghidra)</p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">Lab07-03.dll</span></strong></p>



<p>After opening IDA Pro, let&#8217;s start listing the call instructions to get a quick overview</p>



<figure class="wp-block-image size-large"><img decoding="async" width="929" height="301" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-31.png" alt="" class="wp-image-1535" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-31.png 929w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-31-300x97.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-31-768x249.png 768w" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /><figcaption>call instructions (with my additional comments)</figcaption></figure>



<p>Please note it corresponds to the Import functions section found in IDA Pro (as expected)</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-38.png" alt="" class="wp-image-1546" width="328" height="271" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-38.png 448w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-38-300x248.png 300w" sizes="(max-width: 328px) 100vw, 328px" /></figure>



<p>The best explanation for such a DLL, sending and receiving data, creating processes, is that it is designed to receive commands from a remote machine (a potential C&amp;C server). At this point, we have a first overall understanding of what the Lab07-03.dll does. But we can analyze deeper. Before doing so, we notice that this DLL has no Export function, but it has an Entry Point</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-39.png" alt="" class="wp-image-1547" width="368" height="44" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-39.png 533w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-39-300x36.png 300w" sizes="(max-width: 368px) 100vw, 368px" /></figure>



<p>An Export function is usually necessary to provide a function to be Imported by the EXE. So the absence of this Export function is questionable. We don&#8217;t seem to have an answer to this question at this point</p>



<p><strong><span class="has-inline-color has-vivid-cyan-blue-color">Destination address</span></strong></p>



<p>Here is what we see just before the connect call</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-32.png" alt="" class="wp-image-1539" width="473" height="154" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-32.png 654w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-32-300x97.png 300w" sizes="(max-width: 473px) 100vw, 473px" /></figure>



<p>We see that the destination IP is 127.26.152.13. We had already found this IP during the strings analysis. We also see that the port is 50h or port 80, the port normally used for web traffic</p>



<p>In the C code below, we see the creation of the Mutex called SADFHUHF (seen earlier in the strings analysis). We also see the initialization of the loopback IP 127.26.152.13</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-40.png" alt="" class="wp-image-1549" width="355" height="299" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-40.png 496w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-40-300x253.png 300w" sizes="(max-width: 355px) 100vw, 355px" /><figcaption>C Code in Ghidra</figcaption></figure>



<p><strong><span class="has-inline-color has-vivid-cyan-blue-color">Communication with the C&amp;C server</span></strong></p>



<p>Our machine is going to send a &#8220;hello&#8221; to the C&amp;C</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-34.png" alt="" class="wp-image-1541" width="478" height="166" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-34.png 653w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-34-300x104.png 300w" sizes="(max-width: 478px) 100vw, 478px" /></figure>



<p>This is probably the message sent by our machine to the C&amp;C, to confirm that we are ready to receive instructions</p>



<p><strong><span class="has-inline-color has-vivid-cyan-blue-color">Receiving data from the C&amp;C server</span></strong></p>



<p>The data received will be pushed to the buffer &#8220;buf&#8221; and the call to recv will store the incoming network traffic on the stack</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-35.png" alt="" class="wp-image-1542" width="496" height="74" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-35.png 707w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-35-300x45.png 300w" sizes="(max-width: 496px) 100vw, 496px" /></figure>



<p>In addition, we also see the following instructions</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-36.png" alt="" class="wp-image-1543" width="541" height="119" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-36.png 765w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-36-300x66.png 300w" sizes="(max-width: 541px) 100vw, 541px" /></figure>



<p>What happens here is the following : if the C&amp;C sends a sleep message, the loop will detect it and let our machine sleep for 60000h or about 394 seconds</p>



<p>Here is the corresponding C code</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-41.png" alt="" class="wp-image-1550" width="419" height="422" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-41.png 640w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-41-298x300.png 298w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-41-150x150.png 150w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-41-100x100.png 100w" sizes="(max-width: 419px) 100vw, 419px" /><figcaption>C code in Ghidra</figcaption></figure>



<p>Then, the C&amp;C is sending an execution instruction to our machine using a backdoor. At first, the code is checking if the stack buffer has the &#8220;exec&#8221; instruction, using a string compare call. In such case, it will jump and call the CreateProcessA instruction. The CommandLine instruction will take any argument provided by the C&amp;C (such as the path to an executable)</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-37.png" alt="" class="wp-image-1544" width="537" height="281" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-37.png 780w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-37-300x157.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-37-768x403.png 768w" sizes="(max-width: 537px) 100vw, 537px" /></figure>



<p>So, as a short wrap-up : the C&amp;C is waiting to receive a &#8220;hello&#8221; instruction, then allows the attacker to implement a backdoor and launch an executable on our machine, going through port 80</p>



<p><strong><span class="has-inline-color has-luminous-vivid-orange-color">Lab07-03.exe</span></strong></p>



<p>Let&#8217;s continue using IDA Pro. We are going to learn many new things about our malware</p>



<p><strong><span class="has-inline-color has-vivid-cyan-blue-color">Parameters to run the malware</span></strong></p>



<p>When looking into the follow code, we realize that the program will stop immediately if the correct parameters are not implemented</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-44.png" alt="" class="wp-image-1554" width="508" height="276" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-44.png 939w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-44-300x163.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-44-768x418.png 768w" sizes="(max-width: 508px) 100vw, 508px" /></figure>



<p>The parameter &#8220;WARNING_THIS_WILL_DESTROY_YOUR_MACHINE&#8221; shall be used to run the program, otherwise the program will stop abruptly. Now we understand why the program was apparently stopping when we launched it in the dynamic analysis. We will try later on in this article, once we have understood this malware better !</p>



<p><strong><span class="has-inline-color has-vivid-cyan-blue-color">Creation of kerne132.dll</span></strong></p>



<p>In the following code, we notice that two files are opened : kernel32.dll and Lab07-03.dll</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-46.png" alt="" class="wp-image-1556" width="271" height="377" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-46.png 458w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-46-216x300.png 216w" sizes="(max-width: 271px) 100vw, 271px" /></figure>



<p>Then, the content of Lab07-03.dll is copied into the new file kerne132.dll, at the location C:\\windows\\system32\\kerne132.dll</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-45.png" alt="" class="wp-image-1555" width="435" height="236" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-45.png 760w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-45-300x163.png 300w" sizes="(max-width: 435px) 100vw, 435px" /></figure>



<p>We now understand that the file kerne132.dll is meant to imitate the legit kernel32.dll</p>



<p>We notice that the argument C:\\ * is passed to the sub process 4011E0</p>



<p><strong><span class="has-inline-color has-vivid-cyan-blue-color">Searching the .exe files in our machine</span></strong></p>



<p>In the sub process 4011E0, we see that the code is looking into a first file</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-47.png" alt="" class="wp-image-1558" width="274" height="88" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-47.png 446w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-47-300x97.png 300w" sizes="(max-width: 274px) 100vw, 274px" /></figure>



<p>then it continues with a loop mapping the file system</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-48-1024x347.png" alt="" class="wp-image-1559" width="632" height="214" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-48-1024x347.png 1024w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-48-300x102.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-48-768x260.png 768w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-48.png 1232w" sizes="(max-width: 632px) 100vw, 632px" /></figure>



<p>We notice that during these loops, the code looks for the files having a .exe extension</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-49.png" alt="" class="wp-image-1561" width="334" height="252" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-49.png 520w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-49-300x227.png 300w" sizes="(max-width: 334px) 100vw, 334px" /></figure>



<p>At this point, we can conclude that the malware searches the C: drive for EXE programs and will perform some actions with these files</p>



<p><strong><span class="has-inline-color has-vivid-cyan-blue-color">What the malware does with .exe files</span></strong></p>



<p>We shall analyze the sub process 4010A0 which is called each time a .exe file is found</p>



<p>At first, we notice that the sub process is mapping the file into memory with &#8220;CreateFileMappingA&#8221; and &#8220;MapViewofFile&#8221;</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-50.png" alt="" class="wp-image-1562" width="290" height="426" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-50.png 423w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-50-204x300.png 204w" sizes="(max-width: 290px) 100vw, 290px" /></figure>



<p></p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-51.png" alt="" class="wp-image-1563" width="293" height="294" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-51.png 467w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-51-300x300.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-51-150x150.png 150w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-51-100x100.png 100w" sizes="(max-width: 293px) 100vw, 293px" /></figure>



<p>The rep movsd and the repmovsb are copying strings byte to byte in memory (similar to memcpy). We see that the dword_403010 is going to be copied and replace kernel32.dll. So, what is the content of dword_403010 ?</p>



<p>To find out, let&#8217;s click on dword_403010, we move to the data section</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-52.png" alt="" class="wp-image-1564" width="440" height="110" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-52.png 656w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-52-300x75.png 300w" sizes="(max-width: 440px) 100vw, 440px" /></figure>



<p>Then let&#8217;s convert the data into the corresponding string, by pressing the letter A on your keyboard (yes, it&#8217;s good to know !)</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-53.png" alt="" class="wp-image-1565" width="399" height="105" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-53.png 607w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-53-300x79.png 300w" sizes="(max-width: 399px) 100vw, 399px" /></figure>



<p>We find the following change. So, the kernel32.dll is being replaced by kerne132.dll</p>



<figure class="wp-block-image size-large is-resized"><img decoding="async" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-54.png" alt="" class="wp-image-1566" width="417" height="52" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-54.png 605w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-54-300x37.png 300w" sizes="(max-width: 417px) 100vw, 417px" /></figure>



<p>So finally, we have understood. Within the .exe files, the malware will look for the legit string kernel32.dll and replace it with the kerne132.dll. At the same time, Lab07-03.dll is copied into kerne132.dll and placed into C:\Windows\System32</p>



<p>In summary, Executables are modified to execute kerne132.dll instead of kernel32.dll</p>



<p><strong><span class="has-inline-color has-vivid-cyan-blue-color">Now let&#8217;s run the malware with the correct parameter</span></strong></p>



<p>I launch the Lab07-03.exe as follows</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="37" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-55-1024x37.png" alt="" class="wp-image-1569" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-55-1024x37.png 1024w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-55-300x11.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-55-768x28.png 768w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-55.png 1204w" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /></figure>



<p>We now see that the Lab07-03.dll has a lot of Exports (duplicated). That means that Lab07-03.dll exports are in fact forwarded exports from kernel32.dll</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="631" src="https://www.forensicxs.com/wp-content/uploads/2021/02/image-57-1024x631.png" alt="" class="wp-image-1571" srcset="https://www.forensicxs.com/wp-content/uploads/2021/02/image-57-1024x631.png 1024w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-57-300x185.png 300w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-57-768x473.png 768w, https://www.forensicxs.com/wp-content/uploads/2021/02/image-57.png 1027w" sizes="(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px" /></figure>



<p>In case the malware is executed, the code will execute as if the program were still calling the original kernel32.dll</p>



<p><strong><span class="has-inline-color has-vivid-red-color">Conclusion</span></strong></p>



<p>With the use of several techniques (static, dynamic, reverse engineering), we have been able to understand the key concepts of this malware :</p>



<ul class="wp-block-list"><li>parse any .exe file installed into the C: drive, and forwards the kernel32.dll exports to the kerne132.dll</li><li>mimics the kerne132.dll to run the Lab07-03.dll content instead. This will launch a backdoor and execute commands from a distant C&amp;C</li></ul>



<p>So overall, this can be a pretty nasty malware, as its operations will be covert. Each time a .exe will be executed, it can launch the backdoor and perform tricky operations on your machine !</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.forensicxs.com/introduction-to-malware-analysis/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Database Caching 12/47 queries in 0.044 seconds using Disk

Served from: www.forensicxs.com @ 2026-01-08 01:09:57 by W3 Total Cache
-->