Trustwave Unveils New Offerings to Maximize Value of Microsoft Security Investments. Learn More

Trustwave Unveils New Offerings to Maximize Value of Microsoft Security Investments. Learn More

Services
Capture
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

twi-managed-portal-color
Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

twi-briefcase-color-svg
Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

tw-laptop-data
Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

tw-officer
Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

tw-network
Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Offensive Security
Solutions to maximize your security ROI
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

The Complexity amidst Simplicity: Exploiting the MS Office DDE Feature

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 Simplicity

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:

  1. Press CRTL-F9 will enable you to create an Field Identifier
  2. Type the DDEAUTO [path of executable] [arguments]

 

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.

The Complexity

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.

9970_74b11ef5-eea2-462f-8bf1-9d046d0afde5

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"

10613_91e6d375-62d9-4df5-a120-6a2e46ba7bfdFigure 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.

8602_314d55b6-e0b6-4714-b1d5-a5f143e0b4efFigure 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.

11445_b97d5ba9-7d0d-4b60-83da-0efbcff5dadfFigure 4 – DDE Code Segmentation on RTF

This segmentation technique has also been seen applied to XML based formats.

9585_61838495-70c1-4f4e-a730-98f6f419c5a7Figure 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.

11994_d3ce4abe-69ca-4f57-ba2c-1994df56e3f6Figure 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.

8870_3e7931e5-597d-4960-a8d5-9001632f4a4110998_a39c473b-bf3f-447a-91ad-8237debb7f1cFigure 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.

11285_b19e9070-23db-4cef-9754-7fb0c42e87a4Figure 8 – Document.XML from the attached DOC file

Here is the extracted DDEAUTO that executes a PowerShell script.

11237_afd418eb-e0a3-44d6-a984-2fea6f0e3658Figure 9 – Complete DDE code execution string

Which downloads another PowerShell script that will eventually download a Locky ransomware file.

9464_5ade65ea-a330-4d06-849f-16ddc5c107faFigure 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!!

11127_aa0d2ca2-465b-47ab-bcdf-b588a9db5b4a
Figure 11 – First DDE Prompt

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.

8745_37bfa502-b16d-488c-bb62-7f7fe389b3e1

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.

Latest SpiderLabs Blogs

Clockwork Blue: Automating Security Defenses with SOAR and AI

It’s impractical to operate security operations alone, using manual human processes. Finding opportunities to automate SecOps is an underlying foundation of Zero Trust and an essential architecture...

Read More

Professional Services Sector Under Attack - Trustwave SpiderLabs Report 2024

Recent research by Trustwave SpiderLabs, detailed in their newly published report "2024 Professional Services Threat Landscape: Trustwave Threat Intelligence Briefing and Mitigation Strategies,"...

Read More

Atlas Oil: The Consequences of a Ransomware Attack

Overview Atlas Oil, a major player in the oil and fuel distribution industry, fell victim to a ransomware attack orchestrated by the Black Basta group. This attack not only compromised sensitive...

Read More