Security experts at Palo Alto Networks analyzed the method used by Iran-linked OilRig APT Group to test weaponized docs before use in attacks.

Security researchers Palo Alto Networks have analyzed the techniques adopted by Iran-linked APT group OilRig (aka APT34) to test the weaponized documents before use in attacks.

The OilRig hacker group is an Iran-linked APT that has been around since at least 2015, since then it targeted mainly organizations in the financial, government, energy, telecoms and chemical sectors in the United States and Middle Eastern countries.

The testing activity analyzed by Palo Alto Network preceded the August 2018 attacks on a Middle-Eastern government.

The APT group targeted members of an undisclosed government in the Middle East with an evolved variant of the BondUpdater trojan. In mid-August, the state-sponsored hackers launched a highly targeted spear-phishing email to a high-ranking office in a Middle Eastern nation.

“In August 2018, Unit 42 observed OilRig targeting a government organization using spear-phishing emails to deliver an updated version of a Trojan known as BONDUPDATER. BONDUPDATER is a PowerShell-based Trojan first discovered by FireEye in mid-November 2017, when OilRig targeted a different Middle Eastern governmental organization.” reads the analysis published by Palo Alto Networks.

“The spear-phishing email had an attached Microsoft Word document that contained a macro responsible for installing a new variant of BONDUPDATER.”

The hackers used spear-phishing emails to deliver an updated version of the PowerShell-based BondUpdater Trojan. The BONDUPDATER Trojan implements common backdoor features such as uploading and downloading files, as well as executing commands on the infected system.

The spear-phishing messages use a weaponized document with a macro responsible for downloading and executing a new variant of BondUpdater.

The macro runs the VBScript “AppPool.vbs” that creates a scheduled task that is executed every minute to ensure persistence to the BONDUPDATER Trojan.

The attacks were launched on August 26, the hackers created numerous bait documents a few days before to test the evasion ability of the malicious code.

The hackers tested weaponized documents and the TwoFace webshell, they measured the evasion abilities of the malicious code using anti-virus scanning tools.

Six days before the attack, hackers submitted the malicious documents to anti-virus engines, Palo Alto researchers observed three distinct waves of testing and the last bait document was submitted less than 8 hours before the delivery document was created.

The final document was then delivered to the target within 20 minutes after its creation.

“The timeline in Figure 1 shows a gap in testing activity between August 21st and August 26th, when the tester stopped their activities. However, they later continued by making modifications to the Excel document just prior to the attack on August 26th. The last iteration of testing occurring less than 8 hours before the creation time of the Word delivery document used in the targeted attack.” reads the analysis published by Palo Alto Networks.

OilRig hackers submitted a total of 11 samples across several public anti-virus testing sites. Experts noticed that the threat actors tested Microsoft Excel spreadsheets, but the final delivery document was a Microsoft Word file. OilRig hackers used the macro from the malicious Excel document as the basis for the malicious Word document.

Hackers obfuscated the “powershell” and “cmd.exe” strings within the embedded VBScript using the same string obfuscation technique

“the detection rate of the file fell or rose as the tester modified the spreadsheet during each iteration of testing. These changes in detection rates allow the tester to determine if the modified portion of the file was causing detection.” continues the analysis.

Some of the modification to the documents caused in an increase in detection rates, this information helped the attackers determine what specific portions in the bait file would trigger anti-virus detections.

Below some of the activities performed during tests:

We learned that OilRig:

Made changes to documents and quickly uploaded the file for testing, with an average of 33 seconds between the file creation times and the testing time.

Was not concerned about maintaining the macro’s functionality during testing efforts, as the changes made by the tester in many iterations made the macro no longer work as intended.

Will change the functions to run dropped VBScripts, specifically in this case from the Shell object to the built-in Shell function.

Will add sleep functionality in an attempt to evade sandboxes, specifically in this case using the Wait function.

Has a preferred string obfuscation technique, which involves replacing a string with each character in hexadecimal form that are concatenated together.

“Attackers and groups routinely use file and URL scanning services to help develop and modify their malware to evade detections.” “Gaining this developmental insight sheds light on OilRig’s advanced capabilities, giving us a more complete threat actor profile.” the researchers conclude.

“Comparison between what malware is eventually used in active campaigns versus in-development malware allows us to understand what adaptations and modifications were made to each iteration of malware. Additionally, witnessing specific functionality changes within the malware itself, we attempt to make correlations between the new and old functionality,”

Further details on the testing technique and changes applied to the documents are included in the analysis published by Palo Alto Networks.

Pierluigi Paganini

( Security Affairs – OilRig APT, cyberespionage)

Share this...

Linkedin Reddit Pinterest

Share On