Trustwave's 2024 Retail Report Series Highlights Alarming E-Commerce Threats and Growing Fraud Against Retailers. Learn More
Get access to immediate incident response assistance.
Get access to immediate incident response assistance.
Trustwave's 2024 Retail Report Series Highlights Alarming E-Commerce Threats and Growing Fraud Against Retailers. Learn More
Albert Einstein once said, "Out of Complexity, Find Simplicity" but it also seems that simplicity is always related to a puzzle of complexity. This statement also applies to the Microsoft's Dynamic Data Exchange (DDE) protocol vulnerability exploit which was recently disclosed by Sensepost. The exploit itself is so simple that novice users will have no problems creating and replicating it. The complexity comes when you try to protect unsuspecting users from such threats.
The Dynamic Data Exchange (DDE) Protocol is a feature in Windows that allows sharing of data from one application to another. Using DDEAUTO allows for automatic code execution that is prone to abuse for those who have malicious intent.
Here is the simple two-step process to create a possible malicious sample:
Simple enough? Then let's elaborate on how this simple trick becomes complex from a defender's point of view when it only takes a few keyboard strokes to generate a working sample.
After doing the quick two-step process, the user can choose whether to save the resulting file as Open XML Format (*.DOCX) or Compound File Binary Format – Word 97-2003 format (*.DOC) or save it as Rich Text Format (*.RTF). This is where it becomes tricky since, as defenders, we need to create multiple signatures to handle each file formats without creating False Positives.
In the Office Open XML format, the exploit code can always be found after the <w:fldChar w:fldCharType="begin"/> followed by DDEAUTO.
Figure 1 – DDE Code Execution on XML based Formats running a PowerShell script
In the RTF format, the code will start with the "{\field{\*\fldinst"
Figure 2 – DDE Code Execution running a PowerShell script on RTF File.
While within the old Compound File Binary Format (CFBF), it will always start with the double bang "!!" or 0x13 and followed by DDEAUTO.
Figure 3 – DDE Code Execution running a PowerShell script on CFBF
One significant angle to look at is that some samples in the wild uses "DDE" instead of "DDEAUTO". Another major concern is obfuscation using string segmentation, which was used by threat actors in CVE-2017-8759 RTF exploits.
Figure 4 – DDE Code Segmentation on RTF
This segmentation technique has also been seen applied to XML based formats.
Figure 5 – DDE Code Segmentation on XML
To add to the complexity, it is not just MS Word that is affected but also MS Outlook. Using a Rich Text format to create an email message or a meeting invite, one can copy-paste the DDEAUTO exploit code from MSWord to the email body and basically send it or save it as a *.MSG file.
Figure 6 – Creating a Calendar/Meeting Invites as Rich Text Format
But wait, there's more! Major threat actors have started to play around with this exploit and recently we observed that Necurs botnet has spearheaded massive attacks on email gateways everywhere.
Figure 7 – Email Templates used by Necurs Spambot
The Necurs-driven email campaign has an attached Open Office Word document with the malicious DDE exploit code.
Figure 8 – Document.XML from the attached DOC file
Here is the extracted DDEAUTO that executes a PowerShell script.
Figure 9 – Complete DDE code execution string
Which downloads another PowerShell script that will eventually download a Locky ransomware file.
Figure 10 – PowerShell script that downloads a binary file from the listed URLs
How Can We Protect Ourselves?
Obviously, we are focusing on a range of protections in our products. However, sometimes the simplest solutions come from our daily life choices and that is everyone should learn to say "NO". The neat thing about DDE is that it provides the user with a prompt. Simple enough! Click NO!!
But people have this tendency to say "YES" and after that may not have the luxury to go back. Luckily, with DDE, you have a second chance to say "NO", so use that chance very well.
Figure 12 – Second DDE Prompt
Conclusion
The ease of this attack combined with the complexity of handling the variety of file formats, the number of applications affected, and the possible obfuscations that can be incorporated, means that exploiting DDE will become a favorite pastime of attackers for some time to come. The fact that the Necurs botnet has jumped on the bandwagon with mass spam campaigns bears witness to this. Expect to see much more of this in the near future.
Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.
Copyright © 2024 Trustwave Holdings, Inc. All rights reserved.