Information Technology | Softwares - Graphics - Programming - Hacking - Security

Laladee

We Provide Knowledge About Information Technology.

Laladee

About Programs And Software Computer.

Laladee

Hacking And Security.

Laladee

And Computer Graphic Design.

Laladee

World is Open Source. Type cat vmlinuz > /dev/audio to hear the Voice of God !!

Showing posts with label Malware. Show all posts
Showing posts with label Malware. Show all posts

Apr 12, 2020

Malware Analysis and Reverse Engineering | GandCrabv5.2 Ransomware Report


Overview of GandCrab ransomware

1: History and development of GandCrab:
The first generation of GandCrab was first discovered in the world in January 2018. Since then, this malware has been continuously improved by hackers and upgraded over 4 generations with increasing levels of sophistication and complexity.
This is a malicious code that will encrypt all the data in your computer and require a ransom to get the decryption key.

2: Spreading Mechanism:
GandCrab spreads by sending the victim a fake email, which urges the victim to open the text file attached to the email. In fact, this attachment contains a virus, if the victim opens the file, the computer will be infected.


3: How to identify the version:

Overview of GandCrab version 5.2


1: Introduce:
The GandCrab Version 5.2 ransomware targets all versions of Windows including Windows 7, Windows 8.1 and Windows 10. This infection is notable due to how it encrypts the user’s files – namely, it uses Salsa20 encryption method – in order to ensure that the affected user has no choice but to purchase the private key.
Ransom required: 1200$ by Bitcoin or DASH.
Probably the biggest change in GANDCRAB so far is that the ransomware virus does not add a random file extension, but renames the whole encrypted file to A-Z, a-z, 0-9 randomly generated name. And what is even worse is that each file is renamed differently with different file name length.

Once the GANDCRAB 5.2 ransomware virus causes an infection on the computers, compromised by it, the virus immediately spaws the randomly named executable file


2: Computer infected:

The ransom note file has the following message to victims, asking them to visit a TOR-based web page

The sample containing the malware used
Name: GandCrab52.exe
Type: PE32 executable (GUI) Intel 80386, for MS Windows
Size: 101376 KB
MD5: 78efe80384fa759964c9ea8bada3ac8d.


Behavioral analysis using tool Cuckoo Sandbox


1: Prepare Tools:
-         Cuckoo Sandbox version 2.0.7 (Time out 3 minutes)
-         Virtual Box run Windows 10 (Turn off Windows Defender).
2: Target after analysis:
-         Understand the activities on the system

-         Retrieve activity logs
-         Make predictions about malware functions
3: Analysis process:
3.1: First analysis:


Result: Malware not alive and has terminated after being launched in the sandbox.
Guess: GandCrab 5.2 has the ability to detect the virtual machine environment to not run the next functions.

3.2: Second Analysis: 
(Screenshots are reported from Cuckoo)



(Image of encrypted files and GandCrab sent a txt file to notify ransom)


Result from from the collected images:
-         Encrypted files cannot be opened with the file extension is “.hifboohk”
-         Each folder has a txt file with information how to retrieve the data
-         Within 3 minutes, all files containing data were encrypted, except files on the Desktop.
-         Within 3 minutes, wallpaper has not been changed.


3.3: Result of classifying malware from Cuckoo:

          Score: 0  Cuckoo could not detect that GandCrab was malicious.


4: Results after analysis:
After analyzing the image reports and activity logs, the results are as follows:
Result:
-         GandCrab undetected by Cuckoo sandbox
-         GandCrab need to use the internet to connect to the server before performing encryption behavior
-         GandCarb will encrypt data files in the victim's computer.
-         GandCrab will leave notice of how to transfer money to retrieve data in all folders which encrypted data.
Guess:
GandCrab can detect virtual machine environment to avoid being analyzed
GandCrab have time delay before change wallpaper and encrypt data in Desktop.



Network

Prepare Tools
FakeNet (windows network simulation)
Netcat (writing to network connections using TCP or UDP)
ApateDNS (controlling DNS responses)
Wireshark (read file .pcap)
Process Monior + Process Explorer (display process malware )


Analysis process:
4.1: First analysis:
Result:
-         Malware connected to domain www.kakaocorp.link
-         Analysis domain www.kakaocorp.link
o   IP Address: 185.52.2.154
o   Location: Netherlands
o   Reputation Status: has blacklisted url

4.2: Second Analysis:

Malware connected to domain www.kakaocorp.link too


Estimate runtime from virus started until all file in Desktop is encrypted:
4 minutes

Process of GandCrap:
GandCrab5.2.exe
  • - Command Execute: “C:\Users\Nguyen Ngoc\Desktop\GandCrab5.2.exe”
  • - Monitor Duration: 4 minutes
wmic.exe
  • Command Execute :“C:\Windows\system32\wbem\wmic.exe” shadowcopy delete
  • Monitor Duration: 3 seconds

File paths encrypted:


Private stored in: 
  • Path: Computer\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE\WOW6432Node\keys_data\data
  • Binary type
(keys stored in regedit) 
  • Ascii text:
(Keys  encrypted)

Registry detect virtual machine:
Path : “HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0\Identifier”
(Registry records when GandCrab running)


Compare file before GandCrab and after GandCrab:

Text file


Zip file


Under the hood

Code behavior analysis:
Exif information


IAT address at 013000 with size 0001d8, time-stamp: Feb 16, 2019

Sections:
Library:

ADVAPI32 - The Windows API, informally WinAPI, is Microsoft’s core set of application programming interfaces (APIs) available in the Microsoft Windows operating systems.

We can see functions called to related to Windows registry, services, applications and user accounts.


Functions called in Kernel.dll:
This is a very common DLL and has an important core function, allowing access to manipulate memory, files, and hardware systems. There are many important functions that Gandcrab called.

We can see that Ntdll is imported, Executing tasks usually do not directly add this file at run time, but it is always indirectly added via Kernel32.dll file. If an executable process adds this file, it means that the author intends to use the hidden function for Windows programs. Some tasks, such as hiding functions or operating processes, will use this interactive interface.


The user-mode hooking technique commonly targets the Native APIs provided by ntdll.dll. It is because most malware uses resources related to process, memory, or file input. In doing so, most APIs must call the system call via ntdll.dll.

Gandcrab use technique to detect sandbox.


The Rpcrt4.dll file is a file associated with the Remote Procedure Call program, and is used by a number of Windows applications for network and Internet connections, which allow computers and devices to communicate between one another in order to keep your computer in perfect working order. Because this file is a dynamic link library file, this means that it has a specific function that it must carry out in order to keep your system working.
WSock32.dll and Ws2_32.dll
These are network DLLs. Gandcrab can be accessed by using the most common connection types to the network or performing network-related tasks.
Wininet.dll containing more advanced network functions such as implementing protocols such as FTP, HTTP, and NTP.




The function InternetOpenW is called in 407EE2 to open proxy, fake dns localhost and connect with server.
In 40E3F8, GandCrab uses GlobalAlloc to allocate memory. And Call the Writefile function to overwrite files, it encrypts all collected information with XOR and sends it to the Command-and-Control server.


Gandcrab uses named pipes to communicate but also it uses this unique id that was referenced above.  The following screenshot shows the routine in which it is created.


So we can see here that it uses the CreateNamedPipeA in 410CF8 command to setup the named pipe that it subsequently reads/writes from.

End of the function, Call 40D9B4 to call VirtualFree function with dwFreeType parameter is MEM_RELEASE (zero). The function frees the entire region that is reserved in the initial allocation call to VirtualAlloc.

AhnLab, a leader in cyber threat analysis, fought against GandCrab ransomware to mitigate attacks and effectively respond to the constantly changing attack methods. GandCrab ransomware shares an extraordinary history with AhnLab. Just like any other ransomware, GandCrab searches for any running or pre-installed anti-malware program before interfering with its normal execution and shutting it down. However, GandGrab was found making an extra effort. GandCrab directly targeted ‘AhnLab’ and its anti-malware program, ‘V3 Lite,’ by mentioning it in its code. GandCrab even revealed the vulnerability of AhnLab V3 and made attempts to delete the program
GandCrab’s creator continued to insult AhnLab by adding an insulting text towards AhnLab in GandCrab v5.2. GandCrab v5.2 incorporated a time-delay technique to disturb the dynamic analysis. GandCrab v5.2 included “AnaLab_sucks” text string within the Window procedure class name that enables the SetTimer function. ‘AnaLab’ can be assumed as a typo for AhnLab. Nonetheless, the creator of GandCrab consistently mentioned ‘V3 Lite’ and ‘AhnLab’ directly within their distributed strings.

The ransomware generates private and public keys using Microsoft Cryptographic Provider and the following APIs:
When the encryption is over, GandCrab opens a <randomType>-DECRYPT.txt file that is the ransom note. These are just some functions that we analyzed, part 2 may coming soon.

The encryption of GANDCRAB 5.2 ransomware is done via Salsa20 encryption algorithm. This cipher aims to replace data from the files on the infected computer with blocks of encrypted data. The virus does not encrypt the whole file, but rather only portions of it, enough to make it seem corrupt and unstable. And what is worse, GANDCRAB 5.2 ransomware uses CBC mode for its file encryption procedures. This mode looks like the image we posted below and it basically breaks your files if you try to change their extension or tamper with them:

Restore Files – Decrypt Salsa20

This repository contains Python3 scripts that can decrypt files encrypted with the Gandcrab 5.2 ransomware: https://github.com/aguinet/crappy

Decryption happens in two steps. The first one recover the "user" private RSA key that has been encrypted thanks to the so-called master key (originally only owned by the ransomware authors). The second one uses this recovered RSA private key to decrypt the files.
It uses the RSA private master key released by FBI/Europol on 2019/07/15 


Thanks, NgocNB, DuongDT and DatDQ
Share:

Apr 11, 2020

Basic Memory Forensics | Volatility

Basic Memory Forensics


There are plenty of traces of someone's activity on a computer, but perhaps some of the most valuble information can be found within memory dumps, that is images taken of RAM.
In the case of digital forensic, data present in the digital assets serves as strong evidence. The systems’ memory may have critical data of attacks, like account credentials, encryption keys, messages, emails, non-cacheable internet history, network connections, endpoint connected devices, etc.
There are many ways to capture a memory file, we can you a tool called DumpIt, used to generate a physical memory dump of Windows machines.

Raw memory dump is the most commonly used memory dump format by modern analysis tools. These dumps of data are often very large, but can be analyzed using a tool called Volatility
Volatility is the most popular memory forensics platform, available in Kali, Parrot,... It also can use on Windows by install manually. It allows you to extract evidence and intelligence from a memory image. It has an active user and developer community who build new modules to support new analysis techniques and data types. Volatility is a powerful tool that allows advanced users to find evidence that cannot be found with other tools. This post will help you start with Volatility.

Let go
In order to properly use Volatility you must supply a profile with --profile=<PROFILE>. So in the first step, we need to determine the profile using imageinfo        
$ volatility -f <Memory file> imageinfo
Then we got profile e.g: Win7SP0x64, Win7SP1x64, Win2008R2SP0x64


In order to view processes, the pslist or pstree or psscan command can be used.
E.g: $ volatility -f <Memory file> --profile=Win7SP1x64 psslist
To extract a DLL from a process's memory space and dump it to disk for analysis, use the dlldump command, dlllist to display a process's loaded DLLs. -D is output directory (dllfiles for sample).
E.g: $ volatility -f <Memory file> --profile=Win7SP1x64 dlldump -D dllfiles/


To view network connections and view commands that were run in cmd prompt, E.g:
$ volatility -f <Memory file> --profile=Win7SP1x64 connections
$ volatility -f <Memory file> --profile=Win7SP1x64 cmdscan

To locate the virtual addresses of registry hives in memory, and the full paths to the corresponding hive on disk, use the hivelist command., E.g:
$ volatility -f <Memory file> --profile=Win7SP1x64 hivelist

To display a process's environment variables, use the envars plugin. Typically this will show the number of CPUs installed and the hardware architecture, the process's current directory, temporary directory, session name, computer name, user name, and various other interesting artifacts E.g:
$ volatility -f <Memory file> --profile=Win7SP1x64 envars


To find file objects in physical memory using pool tag scanning, use the filescan command. This will find open files even if a rootkit is hiding the files on disk and if the rootkit hooks some API functions to hide the open handles on a live system, E.g:
$ volatility -f <Memory file> --profile=Win7SP1x64 filescan


Dump a file: -Q <file offset> -D <output directory>:
$ volatility -f <Memory file> --profile=Win7SP1x64 dumpfiles -Q 0x000000005fcfc4b0 -D .

Besides, there more command and module/plugins very useful like:
chromehistory, iehistory, notepad, sqlite_help, apihooksdeep, screenshot, userassists, …



Thanks for reading


Share:

Aug 12, 2019

Malware Analysis - Setting Up Environment


FLARE VM is the first of its kind reverse engineering and malware analysis distribution on Windows platform. It covering everything you need to know to get started in Malware Analysis professionally. Since its introduction in July 2017, FLARE VM has been continuously trusted and used by many reverse engineers, malware analysts, and security researchers as their go-to environment for analyzing malware. Just like the ever-evolving security industry, FLARE VM has gone through many major changes to better support our users’ needs. FLARE VM now has a new installation, upgrade, and uninstallation process, which is a long anticipated feature requested by our users. FLARE VM also includes many new tools such as IDA 7.0, radare and YARA. Therefore, we would like to share these updates, especially the new installation process.

Let set it up
FLARE VM is designed to be installed on Windows 7 Service Pack 1 or newer; therefore, you can select a version of windows that best suits your needs. From this point forward, all installation steps should be performed within your VM. You can download from: https://developer.microsoft.com/en-us/microsoft-edge/tools/vms
When you have a Windows VM, download the compressed FLARE VM repository onto your VM: https://github.com/fireeye/flare-vm

Now, start Windows PowerShell as admin permissions "Run as administrator"

Then, go to Flare-vm path, e.g: cd C:\Users\IEUser\Downloads\flare-vm-master
Enable unrestricted execution policy for PowerShell by executing the following command: Set-ExecutionPolicy unrestricted
Start installing: .\install.ps1

The rest of the installation process is fully automated. Depending upon your internet speed the entire installation may take up to one hour to finish. The VM also reboots multiple times due to the numerous software installations’ requirements. Once the installation completes, the PowerShell prompt remains open waiting for you to hit any key before exiting. After completing the installation, you will be presented with the following desktop environment:

Congratulations! You have successfully installed FLARE VM.

Here is an incomplete list of some major tools available on FLARE VM:
Disassemblers:
IDA Free 5.0 and IDA Free 7.0
Binary Ninja
Radare2 and Cutter
Debuggers:
OllyDbg and OllyDbg2
x64dbg
Windbg
File Format parser:
CFF Explorer, PEView, PEStudio
PdfStreamdumper, pdf-parser, pdfid
ffdec
offvis and officemalscanner
PE-bear
Decompilers:
RetDec
Jd-gui and bytecode-viewer
dnSpy
IDR
VBDecompiler
Py2ExeDecompiler
Monitoring tools:
SysInternal suite
RegShot
Utilities:
Hex Editors (010 editor, HxD and File Insight)
FLOSS (FireEye Labs Obfuscated String Solver)
Fakenet-NG
Yara
Malware Analyst Pack

We strongly recommend you use FLARE VM within a virtualized environment for malware analysis to protect and isolate your physical device and network from malicious activities. We assume you already have experience setting up and configuring your own virtualized environment. Happy Reversing!



Thanks Fireeye
Share:

About Us