Office 365 Advanced Threat Protection defense for corporate networks against recent Office exploit attacks
Discription

The Office 365 Threat Research team has seen an uptick in the use of Office exploits in attacks across various industry sectors in recent months. In this blog, we will review several of these exploits, including a group of Office moniker exploits that attackers have used in targeted as well as crimeware attacks. We will also describe the payloads associated with these exploits andhighlight our research into a particularly sophisticated piece of malware. Finally, we will demonstrate how [Office 365 Advanced Threat Protection](), [Windows Defender Advanced Threat Protection](), and [Windows Defender Exploit Guard ]()protect customers from these exploits.

## Exploit attacks in Fall 2017

The discovery and public availability of a few Office exploits in the last six months led to these exploits gaining popularity among crimeware and targeted attackers alike. While crimeware attackers stick to payloads like [ransomware]() and [info stealers]() to attain financial gain or information theft, more sophisticated attackers clearly distinguish themselves by using advanced and multi-stage implants.

The Office 365 Threat Research team has been closely monitoring these attacks. The Microsoft Threat Intelligence Center (MSTIC) backs up our threat research with premium threat intelligence services that we use to correlate and track attacks and the threat actors behind them.

### CVE-2017-0199

[CVE-2017-0199]() is a remote code execution (RCE) vulnerability in Microsoft Office allows a remote attacker to take control of a vulnerable machine if the user chooses to ignore protected view warning message. The vulnerability, which is a logic bug in the URL moniker that executes the HTA content using the _htafile_ OLE object, was fixed in [April 2017 security updates]().

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig1-CVE-2017-1099-exploit-code-23.png)

_Figure 1. CVE-2017-0199 exploit code_

Ever since [FireEye blogged]() about the vulnerability, we have identified numerous attacks using this exploit. The original exploit was used in limited targeted attacks, but soon after, commodity crimeware started picking them up from the publicly available exploit generator toolkits. As shown in Figure 2, the creator and _lastModifiedBy_ attributes help identify the use of such toolkits in generating exploit documents.

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig2-Exploit-kit-identifier.png)

_Figure 2. Exploit kit identifier_

A slight variation of this exploit, this time in script moniker, was also released. When activated, this exploit can launch [scriptlets]() (which consist of HTML code and script) hosted on a remote server. A proof-of-concept (PoC) made publicly available used a Microsoft PowerPoint Slideshow (PPSX) file to activate the script moniker and execute a remote code, as shown in Figure 3.

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig3-PPSX-activation-for-script-moniker.png)

_Figure 3. PPSX activation for script moniker_

### CVE-2017-8570

The [July 2017 security update]() from Microsoft included a fix for another variation of the CVE-2017-0199 exploit, [CVE-2017-8570](), which was discovered in URL moniker that, similar to HTA files, can launch scriptlets hosted on a remote server. Even though the vulnerability was not exploited as zero-day, the [public availability]() of exploit toolkit created a wave of malicious PPSX attachments.

### CVE-2017-8759

In September 2017, [FireEye discovered]() another zero-day exploit used in targeted attacks. The [CVE-2017-8759 exploit]() takes advantage of a code injection vulnerability in .Net Framework while parsing WSDL definition using SOAP moniker. The vulnerability was fixed in the [September 2017 security update](). The original exploit used an HTA file similar to CVE-2017-0199 to execute the attacker code in vulnerable machines. This exploit piqued our interest because it delivered one of the most complex and multiple VM-layered malware, FinFisher, whose techniques we discuss in the succeeding section.

The CVE-2017-8759 exploit soon got ported to PPSX file. Figure 4 below shows an example of the exploit.

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig4-CVE-2017-8759-exploit.png)

_Figure 4. CVE-2017-8759 exploit_

### CVE-2017-11826

Finally, onSeptember 28,2017, [Qihoo 360]() identified an RTF file in targeted attacks that exploited a memory corruption vulnerability in Microsoft Office. The vulnerability exists in the way Office parses objects within nested Office tags and was fixed in the [October 2017 security update](). The forced address space layout randomization (ASLR) prevented the exploit from running in Office 2013 and above. Figure 5 shows the nested tags from the original exploit that led to the bug.

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig5-0-CVE-2017-11826-exploit.png)

_Figure 5. CVE-2017-11826 exploit_

## Payloads

Except for the memory, corruption exploit CVE-2017-11826, the exploits discussed in this blog pull the malware payload from remote locations, which could make it difficult for antivirus and sandboxes to reliably detect these exploits. Additionally, the public availability of scripts that generate exploit templates could make it challenging for incident responders.

As cited above, these exploits were used in both commodity and targeted attacks. Attackers attempt to bypass AV engine defenses using different obfuscation techniques. Here are some of the obfuscation techniques used in attacks that we recently analyzed:

* Attackers used HLFL as element type in the malicious RTF attachment. This element is not supported in RTF official specification but serves as an effective obfuscation for static detections.

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig5-5-HLFL.png)

* Similarly, we have seen attackers using ATNREF and MEQARR elements in malicious RTF attachments.

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig5-5-ATNREF.png)![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig5-5-MEQARR.png)

In most of the attacks we analyzed, the exploits used PowerShell to download and execute malware payloads, which are usually crimeware samples like ransomware or info stealers.

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig6-0-PowerShell-payload-from-the-HTA-file.png)

_Figure 6. PowerShell payload from the HTA file_

However, every now and then, we stumble upon an interesting piece of malware that particularly catches our attention. One such malware is Wingbird, also known as FinFisher, which was used in one of the targeted attacks using the CVE-2017-8759 exploit.

### WingBird (also known as FinFisher)

[Wingbird]() is an advanced piece of malware that shares characteristics with a government-grade commercial surveillance software, FinFisher. The activity group [NEODYMIUM]() is known to use this malware in their attack campaigns.

The group behind WingBird has proven to be highly capable of using zero-day exploits in their attacks, as mentioned in our [previous blog post on CVE-2017-8759](). So far, we have seen the group use the exploits below in campaigns. These are mostly in line with the findings of Kaspersky Labs, which they documented in a [blog]():

* CVE-2015-5119 (Adobe Flash)
* CVE-2016-4117 (Adobe Flash)
* CVE-2017-8759 (Microsoft Office)
* CVE-2017-11292 (Adobe Flash)

The interesting part of this malware is the use of spaghetti code, multiple virtual machines, and lots of anti-debug and anti-analysis techniques. Due to the complexity of the threat, it could take analysts some time to completely unravel its functionality. Heres a summary of interesting tidbits, which we will expand in an upcoming detailed report on Wingbird.

The Wingbird malware goes through many stages of execution and has at least four VMs protecting the malware code. The first few stages are loaders that can probe if it is being run in virtualized or debugged environments. We found at least 12 different checks to evade the malwares execution in these environments. The most effective ones are:

* Sandbox environment checks
* Checks if the malware is executed under the root folder of a drive
* Checks if the malware file is readable from an external source and if execution path contains the MD5 of its own contents

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig6-5-Checks-if-execution-path-contains-the-MD5.png)

* Fingerprinting check
* Checks if the machine GUID, Windows product ID, and system Bios are from well-known sources
* VM detection
* Checks if the machine hardware IDs are _VmBus_ in case of HyperV, or _VEN_15AD_ in case of VMware, etc.
* Debugger detection
* Detects debugger and tries to kill it using undocumented APIs and information classes (specifically _ThreadHideFromDebugger_, _ProcessDebugPort_, _ProcessDebugObjectHandle_)

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig6-5-Debugger-detection.png)

The latter stages act as an installation program that drops the following files on the disk and installs the malware based on the startup command received from the previous stage:

* _ [randomName].cab_ -Encrypted configuration file
* _ setup.cab_ – The last PE code section of the setup module; content still unknown
* _ d3d9.dll_ -Malware loader used on system with restricted privileges; the module is protected by a VM
* _ aepic.dll_ (or other name) – Malware loader used on admin privileged systems; executed from (and injected into) a faked service; protected by a VM
* _ msvcr90.dll_ – Malware loader DLL injected into explorer.exe or winlogon.exe process; protected by a VM
* _ [randomName].7z_ – Encrypted network plugin, used to spy the victim network communications
* _ wsecedit.rar_ – Main malware dropped executable, protected by a VM

In the sample we analyzed, the command was 3, which led the malware to create a global event, _0x0A7F1FFAB12BB2_, and drop malware components under a folder located in [_%ProgramData%_](), or in the _[%APPDATA%]()_ folder. If the malware is running with restricted privileges, the persistence is achieved by setting the RUN key with the value below. The name of the key is taken from the encrypted configuration file.

_HKCUSOFTWAREMicrosoftWindowsCurrentVersionRun_
_ Value: “{Random value taken from config file}”_
_ With data: “C:WINDOWSSYSTEM32RUNDLL32.EXE C:PROGRAMDATAAUDITAPPD3D9.DLL, CONTROL_RUN”_

If the startup command is 2, the malware copies explorer.exe in the local installation directory, renames _d3d9.dll_ to _uxtheme.dll_, and creates a new _explorer.exe_ process that loads the malware DLL in memory using the DLL sideloading technique.

All of Wingbirds plugins are stored in its resource section and provide the malware various capabilities, including stealing sensitive information, spying on internet connection, or even diverting SSL connections.

Given the complex nature of the threat, we will provide more detailed analysis of the Wingbird protection mechanism and capabilities in an upcoming blog post.

## Detecting Office exploit attacks with Office 365 ATP and Windows Defender Suite

Microsoft [Office 365 Advanced Threat Protection]() blocks attacks that use these exploits based on the detection of malicious behaviors. Office 365 ATP helps secure mailboxes against email attack by blocking emails with unsafe attachments, malicious links, and linked-to files leveraging time-of-click protection. SecOps personnel can see ATP behavioral detections like below in Office 365s Threat Explorer page:

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig7-1-Office-365-alert.png)

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig7-2-Office-365-alert.png)

_Figure 7. Office 365 ATP detection_

Customers using [Windows Defender Advanced Threat Protection]() can also see multiple alerts raised based on the activities performed by the exploit on compromised machines. Windows Defender Advanced ATP is a post-breach solution that alerts SecOps personnel about hostile activity. Windows Defender ATP uses rich security data, advanced behavioral analytics, and machine learning to detect attacks.

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig8-Windows-Defender-ATP-alert.png)

_Figure 8. Windows Defender ATP alert_

In addition, enterprises can block malicious documents using [Windows Defender Exploit Guard](), which is part of the defense-in-depth protection in [Windows 10 Fall Creators Update](). The Attack Surface Reduction (ASR) feature in Windows Defender Exploit Guard uses a set of built-in intelligence that can block malicious behaviors observed in malicious documents. ASR rules can also be turned on to block malicious attachments from being run or launched from Microsoft Outlook or webmail (such as Gmail, Hotmail, or Yahoo!).

![](https://cloudblogs.microsoft.com/microsoftsecure/wp-content/uploads/sites/13/2017/11/2Fig9-Windows-Defender-Exploit-Guard-detection.png)

_Figure 9. Windows Defender Exploit Guard detection_

Crimeware and targeted activity groups are always on the lookout for attack vectors to infiltrate systems and networks and deploy different kinds of payloads, from commodity to advanced implants. These attack vectors include Office exploits, which we observed in multiple attack campaigns. The availability of open-source and off-the-shelf exploit builders helps drive this trend.

AtMicrosoft, we dont stop working to protect our customers mailboxes. Our global network of expert research teams continuously monitors the threat landscape for new malware campaigns, exploits, and attack methods. Our end-to-end defense suite includes Office 365 ATP, Windows Defender ATP, and Windows Defender Exploit Guard, among others, which work together to provide a holistic protection for individuals and enterprises.Read More

Back to Main

Subscribe for the latest news: