Blog de Zscaler

Reciba en su bandeja de entrada las últimas actualizaciones del blog de Zscaler

Suscribirse
Security Research

Microsoft DDE protocol based malware attacks

image
MOHD SADIQUE
November 15, 2017 - 6 Min de lectura

Introduction

Over the past few weeks, there have been several reports about the Microsoft Dynamic Data Exchange (DDE) vulnerability. To no one's surprise, hackers have been quick to exploit this vulnerability to spread malware through rigged Microsoft Word documents.

In this same timeframe, the Zscaler ThreatLabz team has seen a number of these malicious documents using the DDE vulnerability to download and execute malware. Most of the payloads we saw were Remote Access Trojans (RATs), ransomware, and backdoors.

In this blog, we will share a detailed technical analysis of a few of these exploitations and their payloads.

 

Background

The Microsoft Dynamic Data Exchange (DDE) protocol allows data to be transferred between applications. These applications can use DDE for one-time data transfers or for continuous exchanges; for example, a Microsoft Word document that uses data from an Excel spreadsheet is updated automatically through DDE as the spreadsheet data is updated. The DDE protocol sends messages between applications that share data and uses shared memory to exchange data between the applications. 

Microsoft Word documents have been used before to spread malware, but in those cases the victim would have to manually enable macros for the payload to be downloaded onto the victim’s system. With the DDE vulnerability (feature) in Microsoft Word, attackers can embed a malicious script that can download and execute malware without the use of macros.

 

Case I: DDE protocol abuse leads to post-exploitation using PowerShell

One Word file we analyzed exploited the DDE vulnerability to download and execute a PowerShell script using a post-exploitation framework.

Filename - Communications_Suggestions_by_Press_Office_Director.doc

Generally, fake documents like this are spread via an email campaign targeting small and large groups of businesses in numerous industry sectors.

In this document, the attacker uses the DDE protocol to launch a Windows command line tool (cmd.exe), which uses PowerShell to download and execute the malware from a given URL.

It downloads and executes a file using cmd.exe and PowerShell, which is present at the following URL: hxxp://citycarpark[.]my/components/com_admintools/mscorier.

The downloaded data (mscorier) is an obfuscated batch script that creates a PowerShell script and executes it.

This script downloads another payload (wsdprintproxy) from hxxp://185.128.42[.]194/wsdprintproxy and stores it in the following registry to make itself persistent:

HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\ThemeVersion

For persistence, payload 1 also creates two scheduled tasks, which execute the obfuscated script.

One scheduled task is created with name FlashUpdateServiceInit, which runs daily at 11:00 a.m., and another task with name FlashUpdateService, which runs daily at 3:00 p.m.

After these tasks run, the script bypasses the PowerShell ScriptBlock logging, which means that the first execution of the malicious script will turn off all further logging.

To download its next payload, the malware initiates a GET request with the cookie “session=j4ppw/hpWdU/l5V3v9eymlAYxmE=” and downloads payload 3 from hxxps://185.128.42[.]194:8080/news.php.

The downloaded data is encrypted with RC4.

Data[0:4] = IV

Data[4:length(Data)] = Encrypted data

Key is hardcoded in the script which is:

Key = “a231fe7690a85f02eb147f53229c8e02”

The script will decrypt the downloaded data. It is, again, a PowerShell script, which is executed after decryption.

The decrypted PowerShell script sends the encrypted RSA key with “IV” to the server at: hxxps://185.128.42[.]194:8080/news.php. In response, the server sends the encrypted AES key to victim.

The script fetches information from the victim’s machine, encrypts it with the AES key, and sends it to the server at: hxxps://185.128.42[.]194:8080/process.php.

Nonce|Server_URL|UserDomainName|UserName|Machine|IPAddress|OperatingSystem|True(if UserName=”system”)Otherwise False|CurrentProcessName|ProcessID|powershell|PowershellVersion

The server responds with the final payload PowerShell script which appears to be a part of the PowerShell empire framework post-exploitation.

The PowerShell empire is a post-exploitation framework that provides a Metasploit-like framework in PowerShell and Python. It includes different types of backdoors with multiple modules. It deals strictly with Windows machines and is extremely useful in ethical hacking tests. In some cases, however, attackers use this framework to hijack a user’s system and perform malicious activities.

Case II: DDE protocol abuse leads to Locky ransomware

In another recent case, a campaign of spam emails was delivering a Word document attachment that used the DDE technique, and the final payload of that campaign is Locky ransomware.
 

In this case, attackers are writing obfuscated malicious field code in Word documents to evade detection; this code can be found in word-document.xml after extraction.

The exploit downloads the encoded PowerShell script from:  hxxp://lestrangeresearch[.]com/kdjsw23FGS. It then decodes and executes it through cmd.

The decoded script look like this:

The decoded PowerShell script has six hardcoded malicious URLs.

The script will try to download the content from a URL and store it in %temp% with the name hti4.exe. Upon successful download, the script executes the downloaded file.

Payload 2 is the intermediate payload. Its function is to check the system for specified parameters. If it satisfies specific criteria, it then downloads encrypted data from:  hxxp://spooner-motorsport[.]com.

This encrypted data is decrypted and launched by the intermediate payload (payload 2).

After decryption, the final payload is Locky ransomware, which encrypts the files, appends the .asasin extension after encryption, and demands ransom in Bitcoin for decryption.

Case III: Attack in New York

Recently, researchers at McAfee found a new phishing campaign from Russia's hacking group APT28 known as “Fancy Bear.”

APT28 capitalized on the recent terror attack in New York City by spreading email with an attached malicious Word document named IsisAttackInNewYork.docx, and the document appears to leverage the DDE technique.

In this case, the first-stage payload was a PowerShell script that downloads another base64 encoded PowerShell script. After that, the second-stage payload script downloads a new variant of Seduploader, which is spyware capable of taking screenshots, gathering sensitive data, and other intrusive activities.

Preventions:

If a document contains embedded malicious DDE code, it shows the following warning to users as they open it. 

The best way to prevent this DDE attack vector is to click “No” when this dialog box appears; this will stop further execution of the malware.

Another way to prevent this attack is to disable it by modifying the registry.

Microsoft has also published security advisory for securely opening Microsoft documents that contain a DDE field.
 

Conclusion:

Attackers are abusing the Microsoft DDE protocol to download and execute malware using PowerShell. In an earlier case, PowerShell led to an entire post-exploitation framework used for ethical hacking. But attackers are using the framework for malicious purposes, such as stealing a user’s sensitive information, uploading and executing malware on a user’s machine, altering the user’s data, and so on. In recent cases, the DDE protocol led to ransomware, including Locky, which encrypts the victim’s data and demands ransom for the decryption.

The malware analyzed in this blog is detected as COM.Downloader.DDE

form submtited
Gracias por leer

¿Este post ha sido útil?

Reciba las últimas actualizaciones del blog de Zscaler en su bandeja de entrada

Al enviar el formulario, acepta nuestra política de privacidad.