Spotlight on Shamoon
All of the initial analysis pointed to Shamoon emerging in the Middle East. There were a number of similarities that we highlighted in our earlier blogs (on McAfee.com). This however was not the end of the story since the campaign continues to target organizations in the Middle East from a variety of verticals. Indeed reports suggested that a further 15 ‘Shamoon incidents’ had been reported from public to private sector.
Remember the similarities to the original version comment? The code for the new revision was ‘almost’ identical to the original version, the changes included the addition of a victim’s credentials to be able to spread and execute the wiper in a large part of the environment. In the below screenshot, we can see that the ‘old’ encoded resource names ‘PKCS12’, ‘PKCS7’ and ‘X509’ are still present in the newer variants but not used.
A question that many of us in the industry asked ourselves of course is how were the attackers able to have the credentials from so many victims in the Middle-East region? Let’s approach this from the attacker’s site and follow the ‘Cyber Kill Chain’ steps.
As an attack group, you have prepared a plan and identified the victims you want to hit and create impact or make a statement. You have gathered email-addresses, gathered other OSINT that will help prepare the first step to gather the details you need for the rest of the campaign. Stage one starts, domains are being registered, backdoors coded and prepared for the reconnaissance phase. When all is tested, the initial attack starts: spear-phishing victims:
The victims receive emails, for example one of the above where business proposals are being sent. The email also contains an attachment that is tempted to be opened. When opening this attachment, one example a document was used:
When you have to activate ‘macros’ before seeing the content, it should raise some alarm-bells. Analyzing the document, we already received confirmation on our suspicion:
Decoding of the obfuscated macro-code results in a PowerShell script that then proceeded to download a file. The analyzed file is a Trojan that is capable of gathering system information and download other tools to the system.
In other cases, we found another backdoor that is using PowerShell script to gather information from the system and writes to a temporary file. Below a code-snippet:
Another interesting part was the script that is creating an instance of Mimikatz, a tool known to dump user/credentials from a computer:
CreateMimi1.Bat or CreateMimi2.Bat
When all data is gathered, the information is uploaded. To open up a command-channel, the attackers used for example a PowerShell script that is launching ‘Powercat’ a tcp/ip Swiss army knife (https://github.com/secabstraction/PowerCat), that works with netcat. Code example:
The attackers would invariably sort the credentials per victim and an indication of the IP-range and possible scale of the network. Depending on the goal of the mission, a selection of victims can be made to serve the cause defined. By having the original Shamoon code, let’s change it a bit and prepare them for the victims:
- Adding victim’s credentials Check
- Replacing picture from flag to boy Check
- Change resource language to Yemen Arabic Check
- Test samples Check
Delivery / Exploitation/Installation/C2/Action on Objectives
In these phases, the actor had already valid credentials and only needed one or two hosts in the victim’s network to use as a beach-head to upload the wipers and scripts to distribute. Since valid credentials were already in possession, no exploitation was needed.
The batchfile is copying the file ‘ntertmgr32.exe’ (one of the many filenames used for the Shamoon2 variant) and copy/starts it. Once the hard-coded date has been reached, systems were being wiped – action on objectives completed.
When we look at the way this actor is executing its attack, it tells a story about their capability and skills. Their attack precision is very good; they know who and what to attack to serve in this case the mission to disrupt and leave a statement. Their focus is on the Windows platform and they are using practices well known to gather information and credentials, with no 0-days. From a coding perspective, many colleagues in the industry already commented on the sloppy coding practices. From an OPSEC perspective aka how well are the actors able to hide details that could lead to them, we noticed that quite some details are available. Email-addresses, PDB paths and although the language identifier of almost all the samples were pointing to ‘Yemen Arabic’, we discovered a sample with a different language identifier. Was that on purpose of a slip of the actor since this was a large campaign?
// domain registered on 2016-11-25 by email@example.com
hash 146a112cb01cd4b8e06d36304f6bdf7b and bf4b07c7b4a4504c4192bd68476d63b5 were connecting to this site
File locations & File names:
Collection of system information:
“%localappdata%\Microsoft\Windows\Tmp765643.txt” //where Tmp[6digits].txt is the syntax//
Filenames and Locations:
Interesting Strings in Code-Samples:
F:\Projects\Bot Fresh\Release\Bot Fresh.pdb