Saturday, September 30, 2017

Get a FREE Pass to SecTor – Canada's Premier IT Security Conference!

Register for my upcoming SANS SEC504 in Toronto during the week of Mon Nov 13 - Sat Nov 18, 2017 and get a FREE Pass (Code) to SecTor – Canada's Premier IT Security Conference! 

Looking only to register for the expo? Then use code "SANS2017expo" when you register for the class and  gain FREE access. A saving of $50!!

Looking to attend the full conference? Then register for the class with code "SANS2017" and get a 10% discount or a saving of $139!!


Don't meet any of the criteria above but are a full-time student? Then there is an opportunity for you to get a student discount rate to attend the conference. Just  bring your student ID and timetable showing your enrollment and you may quality for the student discount. Tickets are limited.

Looking forward to seeing you at both my upcoming class and SecTor.

Monday, September 25, 2017

How about expanding your knowledge on Intrusion Detection or Incident Handling, Hacker Techniques and Exploits? Then come hangout at one of my upcoming classes to learn more!

Upcoming Courses Taught By Nik Alleyne
TypeCourse / LocationDateRegister

Community SANS
Community SANS Toronto SEC504 Toronto, ON
Nov 13, 2017 - 
Nov 18, 2017

Community SANS
Community SANS Annapolis Junction SEC504 Annapolis Junction, MD
Jan 29, 2018 - 
Feb 3, 2018

Community SANS
Community SANS Pensacola SEC503 Pensacola, FL
Feb 19, 2018 - 
Feb 24, 2018

Community SANS
Community SANS Baltimore SEC503 Baltimore, MD
Mar 12, 2018 - 
Mar 17, 2018

Community SANS
Community SANS Columbia SEC503 Columbia, MD
Aug 13, 2018 - 
Aug 18, 2018
*Course contents may vary depending upon location, see specific event description for details.

Learning about malware persistence through the lens of “Parite” Malware

In this series of posts, I’m continuing the Open Security Training materials, with this set of post being more focused on the Malware Analysis class.

You may find reviewing the material from Open Security more beneficial. However, if you do choose to stick with this I hope you find it helpful.

In this the final post in the series, we are looking at persistence through the lens of the Parite malware.

While in the previous blog posts we were able to see that the malware deleted itself and create new processes or became a process that gets loaded by “svchost.exe” in the case of Parite, the malware deletes itself like the others. However, unlike the others it does not create a new process.

While reviewing this in Process Hacker, it was noticed that “malware.exe” gets loaded and is immediately deleted. The image below shows the process being deleted.


Since we are unable to track the process creation above, we need to verify through other methods what is the malware doing. Fortunately we also have Autoruns.exe which allows us to compare autoruns along with the snapshot of our registry via RegShot.

Conducting the first set of analysis via Autoruns, we see a startup registry value “fmsiocps c:\windows\fmsiocps.exe” has been added to “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run”. Additionally, we see that the Registry key “HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\Appinit_Dlls     ” now has the value “fmsiocps.dll c:\windows\system32\fmsiocps.dll”

Looking at Regshot output, we see key “HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\tqat.exe” was added. This corresponds to:

From above we see the “tqat.exe” executable will be launched under the debugger.

We also see additional keys from Regshot as shown below:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\fmsiocps: "C:\WINDOWS\fmsiocps.exe"
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\tqat.exe\Debugger: "ntsd -d"
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs: "fmsiocps.dll"

The final line shows the value "fmsiocps.dll" now associated with the “HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\AppInit_DLLs”

The AppInit_DLLs registry entry will be used to load the  "fmsiocps.dll" into every user mode process. Now isn’t that some serious power to have?

Running a search in Process Hacker for the "fmsiocps.dll" shows that this DLL has been loaded into 6 applications, which include “FireFox.exe”, “explorer.exe” and even “ProcessHacker.exe” along with 3 others.

















At this point, there is no need to go further as the objective was to demonstrate persistence. By Leveraging the “AppInit_DLLs” malicious software has the opportunity to be truly persistent.
  

Microsoft - Working with the AppInit_DLLs registry value

Wednesday, September 20, 2017

Learning about malware persistence through the lens of IMWorm leveraging “Autoruns”

In this series of posts, I’m continuing the Open Security Training materials, with this set of post being more focused on the Malware Analysis class.

You may find reviewing the material from Open Security more beneficial. However, if you do choose to stick with this I hope you find it helpful.

In this post, we will be learning about the persistence mechanism used by IMWorm. We will leverage Sysinterals Autoruns to expand our understanding of IMWorm’s persistence.

To make this analysis a bit easier, I first executed Autoruns and saved the output via the “File” -> “Save” menu to a file called “Before_IMWorm.arn”.

Once I had the saved file, I then executed the IMWorm executable and compared the new Autoruns output to this saved file. To achieve this, I first hit “Refresh”/”F5” within Autoruns. Then from the “File” -> “Compare” menu item, I selected the file “Before_IMWorm.arn” which was previously created. Once opened, this produced the output shown below:

As shown above, the registry entry ‘"HKLM\Software\Microsoft\Windows NT\CurrentVersion\WinLogon" /V UserInit’ has the value of “C:\WINDOWS\system\lsass.exe”. Additionally we see the file “msconfig.exe” has been created in the "c:\Documents and Settings\All Users\Start Menu\Programs\Startup".


Let’s try to hunt these down:
First when I tried to open “regedit” to verify the key, I was unable to do so and I believe this has something to do with “IMWorm”. The error I got was “Registry editing has been disabled by your administrator” as shown below:



As a result of this error, I instead leverage the “reg query” command line tool. This produced the result as follows


The example above demonstrates why it is extremely important to know and use more than one tools to solve your problems.

Next up I attempted to leverage Autoruns to “Jump to Image”. However, Autoruns exited and I was unable to open it. Looking for the file directly under Windows Explorer, I was also unable to find it. Trying to enable the option to show hidden files and file extension, I noticed those options were not available. I assumed once again, this is IMWorm doing its thing.

As a result, I had to go back into the command line with some more command line Kung Fu. At this point I did a “dir” on the folder in question as shown below:


Ooooops!! Loos like nothing is there. Let’s take another shot at this looking for hidden files. This time we execute the same command except we append “/A H” to the output above as shown below:
 
At this point we recognize the file was “hidden” from the default “dir” output.

From above, we see that IMWorm is leveraging both the registry “Run” key and the “Startup” folders for persistence purposes.






Wednesday, September 13, 2017

I Smell A RAT – Learning about Poison Ivy – Live Forensic Analysis

In this series of posts, I’m continuing the Open Security Training materials with this set of post being more focused on the Malware Analysis class.

You may find reviewing the material from Open Security more beneficial. However, if you do choose to stick with this I hope you find it helpful.

In this post we will take a quick pass at some live forensic analysis. See the reference section for some other analysis you may undertake.

First up, I’ll start off with the network through leveraging “netstat” on the “compromised” host. The network information below shows that the host “Securitynik-xp” on source port 1025 has an established connection to host 10.10.10.1 on port 3460.

Now that we have an established connection, let’s see what is the PID and owning process of this connection. Leveraging the “neststat –ob” as shown below.

 
Above we see the owning process is “system32:secnik_piv.exe” and it has a PID of 1688.

By looking at the “:” in “system32:secnik_piv.exe” we can conclude that this is more than likely an Alternate Data Stream (ADS).

Doing a “dir c:\windows\system32\secnik*.exe” we see … basically the file was not found. In Windows XP there is no immediate way to detect ADS without third party tools.

Therefore let’s leverage Sysinternals “Streams.exe” to identify the ADS in “system32”. The image below shows that “secnik_priv.exe” is embedded in “c:\windows\system32”
Taking a look at the registry for persistence, we see the key "HKLM\software\Microsoft\windows\CurrentVersion\Run" has a value “SecurityNik_PIvy_Agent      REG_SZ  C:\WINDOWS\system32:secnik_piv.exe”
 

Taking a look at ProcessHacker to learn more about the process “system32:secnik_piv.exe”, we see that it was started by “explorer.exe”. We also see that this process has spawned a “cmd.exe” process. If we remember from this post, we were interacting with the “compromised host” via the command shell.
At this point, we can continue to leverage ProcessHacker or even identify additional tools which can assist with our live analysis.

However, we were able to identify it’s persistence mechanism which allows it to survive reboot. At this point we can take the next step which is to begin the clean-up process.

Let’s start with deleting the persistence mechanism via the registry using “reg delete "HKLM\software\Microsoft\windows\CurrentVersion\Run" /v "SecurityNik_PIvy_Agent"”
We see from the final entry above that "SecurityNik_PIvy_Agent” has been deleted.

Let’s now look at suspending the process “system32:secnik_piv.exe” before we attempt to delete it from the ADS.

Leveraging ProcessHacker once again we first suspend the process … 

… once suspended we then leverage GMER to delete the file as shown below …
If we take a look at “c:\windows\system32:secnik_priv.exe” with Sysinternals “streams.exe” we see the file no longer exists as show below.

Now let’s close this off by terminating the process tree for “system:secnik_priv.exe


At this point, consideration should be given to the fact that the process may be recreated, therefore close attention should be paid to monitoring. Additionally, you may want to monitor the network for traffic known to be associated with Poison Ivy. Restarting the “infected” system is a good way to verify that all is well.


Monday, September 4, 2017

I Smell A RAT – Learning about Poison Ivy – The Capabilities

In this series of posts, I’m continuing the Open Security Training materials with this set of post being more focused on the Malware Analysis class.

You may find reviewing the material from Open Security more beneficial. However, if you do choose to stick with this I hope you find it helpful.

In the previous post we looked at the setup of Poison Ivy. In this post we will look at some of its usages.First up, let’s look at the “Information” menu on the left. This produces 

 

Next up, leveraging the “Files” menu, a list of files which are on the “compromised” system.


The “Registry” menu item shows the “compromised” host’s registry. This can also be interacted with.
 

The “Process” menu allows for viewing and interaction of the processes currently running on the host.
 


Similarly, the “compromised” client’s “Services”, “Devices”, “Installed Applications”, “NT/NTLM Hashes”, can be seen.

Below the “Active Ports” shows current “netstat” information.
 

The “Remote shell” option allows interaction with the “compromised” host’s shell. You first need to right click and choose “activate”. The image below shows interaction with the host’s shell.

 
Below screen shows the “NT/NTLM hashes” retrieved from the host.


As can be seen in the “Administration” section, there are options to “Edit”, “Share”, “Update”, “Restart” and even “Uninstall” the malicious binary.




Tuesday, August 29, 2017

I Smell A RAT – Learning about Poison Ivy – The Setup

In this series of posts, I’m continuing the Open Security Training materials, with this set of post being more focused on the Malware Analysis class.

You may find reviewing the material from Open Security more beneficial. However, if you do choose to stick with this I hope you find it helpful.

In this post, we will be learning more about setup and configuring Poison Ivy. In the next post we will look at learning about its capabilities while in the final post, we will try to analyze and learn more about detecting it.

My lab consists of 2 virtual machines. A Linux virtual machine which will be my command and control (C2) server/Poison Ivy client and a WindowsXP machine which will be the Poison Ivy Sever.On loading up the Poison Ivy executable in Linux we get the EULA screen:














Once we acknowledge the EULA, the next screen is the home screen:


From here we next select the “File” menu and select “New Server”. This is the executable which will be “sent” to the client and when it is executed, it will connect back to our C2 server or from Poison Ivy perspective, our “Client”.


Next up is to focus on the connection information:

From above, I’ve added multiple C2 Servers IPs as well as some domain information. The list consists of:
10.10.10.1:3460:0,
10.0.0.103:3460:0,
192.168.0.1:3460:0,
172.16.23.5:3460:0,
securitynik.web:3460:0,
ivy.securitynik.web:3460:0,
malware.securitynik.wejb:3460:0,


Once the C2 servers have been added, click “Next” at the bottom right which now produces the “Install” screen. In my example below I’ve set the persistence mechanism through HKLM/Run Name” as “SecurityNik_PIvy_Agent”. I’ve also enabled the “Copy File” and provided it with filename “secnik_piv.exe”. This will copy the file to the “system” folder and will also leverage Alternate Date Streams  through “Copy file to Alternate Data Streams”.


Once the above is completed, click “Next” at the bottom right of the above screen. This then brings up the “Advanced” window. I did not modify anything in this window so click “Next” which then brings up the “Build” screen.

In the “Build” screen, I choose generate to generate the new binary which brings up the window to save the file as shown below:

Once the above file is saved, click “OK”.

Now that the file has been generated, I’ve leverage Python’s Simple HTTP Server to serve the file to the client.

From below, we see Python’s Simple HTTP Server serving up the file

securitynik@siftworkstation:~/MalwareClass/PoisonIvy-2$ python -m SimpleHTTPServer 8000
Serving HTTP on 0.0.0.0 port 8000 ...
10.0.0.101 - - [03/Aug/2017 17:56:01] "GET / HTTP/1.1" 200 -
10.0.0.101 - - [03/Aug/2017 17:56:07] "GET /SecurityNik_PoisonIvy.exe HTTP/1.1" 200 -
Now that the setup for the Poison Ivy server is complete and the file has been “delivered” to the client, it’s now time to setup the Poison Ivy Client.

From Poison Ivy’s “File” menu, select “New Client”. This brings up the screen below.

In the above example, I left everything at their defaults, then choose “start”. This now brings up the screen below which shows Poison Ivy waiting for connections.


At this point the setup is completed.

Let’s do one more thing before we go to the next post and that is to execute “SecurityNik_PoisonIvy.exe” on the Poison Ivy Server. Once executed successfully, this then produces the following.















As shown above, our client at “10.0.0.101” has successfully registered.

See you in the next post where we look at learning more about Poison Ivy’s capabilities.


Python Simple HTTP Server


Other posts in this series:

I smell a RAT – Learning about Poison Ivy – Live Forensics Analysis