What We Do
How We Do
Get Started

Using a Machine Learning Threat Detection Model to Extract and Classify Malicious Macros

BY eSentire

August 31, 2021 | 2 MINS READ

Cybersecurity Strategy


Want to learn more on how to achieve Cyber Resilience?


Threat actors have long relied on the use of macros to create malicious documents that are emailed to unknowing victims as part of an overall phishing campaign. Once the document is opened, the malicious macros are executed, providing an initial access point for threat actors to leverage.

In Verizon’s 2020 Data Breach report, researchers state that 94% of malware is delivered through email and in 45% of the cases, the malware is hidden in Microsoft Office documents. If organizations have a strong security awareness training program in place, they can train their employees to spot common signs (e.g., spelling errors and complicated instructions for the attached Microsoft Office documents) that an email may be malicious.

Additionally, if the organization has engaged a security provider with a security operations center (SOC), the SOC analysts may leverage machine learning (ML) to detect malicious files proactively.

However, adversaries have begun to use sophisticated anti-detection techniques such as Macro stomping, wherein the original Visual Basic application (VBA) code is removed but the compiled payload is left untouched.

To curb this rising threat, eSentire partnered with the University of Guelph’s Cyber Science Lab for a research project on the “Detection of malicious documents by extracting and interpreting macros in Microsoft Office files”.

This partnership brings together large volumes of unlabeled customer data and compute resources, along with mentorship from University of Guelph faculty to provide students with the opportunity to perform security research and develop world-class machine learning algorithms to provide solutions to reduce business risk.

“Collaboration between companies and universities play a significant role in transferring knowledge and creating jobs for Canadians. Cyber Science Lab at the University of Guelph and eSenitre enjoy a long-lasting collaboration resulting in many interesting projects in cyber threat intelligence and threat hunting,” Ali Dehghantanha, Director of the Cyber Science Lab, says.

Edward Crowder, a student enrolled in the Master of Cyber Security and Threat Intelligence program, has been working with eSentire’s Threat Response Unit (TRU) team to use artificial intelligence (AI) as a solution to extract and analyze macros and determine their indent and potential for malicious code execution.

“Edward's project stands out as one of the best examples of using accurate machine learning models to hunt for macro-based malware - a technique that is commonly used during delivery of attack payloads by advanced adversaries,” Deghantanha explains.

The objectives of the project are twofold:

Overall, the project was a resounding success. Edward, along with eSentire’s security researchers, were able to achieve high 90% average accuracy on the deep learning models, showing high confidence and correlation like human-level static analysis.

“Edward's technical achievement is impressive. He has created a highly accurate machine learning model to detect malicious office macros used in real-world attacks,” Rob McLeod, Vice President, Threat Response Unit (TRU), says. “This model provides differentiated threat detection capabilities to provide additional protection and detection capabilities to eSentire's customers.”

To learn more about the partnership between University of Guelph and eSentire, click here.


eSentire, Inc., the Authority in Managed Detection and Response (MDR), protects the critical data and applications of 2000+ organizations in 80+ countries, across 35 industries from known and unknown cyber threats by providing Exposure Management, Managed Detection and Response and Incident Response services designed to build an organization’s cyber resilience & prevent business disruption. Founded in 2001, eSentire protects the world’s most targeted organizations with 65% of its global base recognized as critical infrastructure, vital to economic health and stability. By combining open XDR platform technology, 24/7 threat hunting, and proven security operations leadership, eSentire's award-winning MDR services and team of experts help organizations anticipate, withstand and recover from cyberattacks. For more information, visit: www.esentire.com and follow @eSentire.

Read the Latest from eSentire