Protect your organization from malicious macros - ITSAP.00.200

Macros are small scripts in files that help applications automate data flows, tasks and processes. Organizations often use them to improve productivity and support business operations. Because macros can run code in an application, they can also present security risks.

Threat actors can use macros to deliver harmful code. Malicious macros can be embedded in documents or other files that are sent through phishing emails or other scams. If users enable these macros, the code can run with the same permissions as the application. This can compromise systems, spread malware or expose sensitive information.

This publication outlines the threats associated with malicious macros and provides practical measures to help your organization manage macro use safely and securely.

Reminder: We recommend that you deactivate macros from external sources. Even when you use trusted macros and protect your systems from malicious macros, there are still risks. Macros from external sources can expose your organization to security risks.

On this page

Potential threats associated with using macros

Files that appear safe can contain malicious macros. Threat actors may hide these macros in applications, documents or email attachments to trick users into enabling them. Organizations that use macros from internal or external sources may face some of the following threats.

Macro-enabled malware

When someone opens a file and enables a macro, malicious code can run automatically. The malicious code can compromise your organization's systems and can also:

  • infect documents and spread through shared drives or email attachments
  • steal passwords, financial data or other sensitive information
  • download additional malware, such as ransomware
  • execute system commands that can weaken protections or change system settings
  • hide or scramble malicious code to avoid detection

Unauthorized access and social engineering

Threat actors often rely on human error to activate malicious macros. By convincing users to trust a document, attackers can access your organization's system and move deeper into the network. Common threat actor tactics include:

  • sending documents disguised as invoices, resumes, human resources files, or other familiar business documents
  • prompting users to enable content, which allows malicious code to run
  • using macros to bypass controls, like allow-lists, and access to systems and networks
  • using advanced phishing techniques, including email thread hijacking, to appear legitimate and bypass security controls

Internal exposure to malicious macros

Risks can also come from inside your organization. Employees and contractors can unintentionally introduce unsafe macros or create documents that expose sensitive information. Internal risks include:

  • creating macros that contain sensitive information, such as passwords, proprietary code or code copied from unverified external sources
  • sharing macro-enabled documents that have not been reviewed or approved under your organization's policies, which can allow malicious code to spread
  • forwarding documents from external sources that have not been verified under your organization's policies
  • using AI-generated or externally sourced macro code that has not been validated, which can unintentionally introduce malicious macros

Secure macro use in your organization

Malicious macros can cause security incidents if they are not properly controlled. Strengthening macro security helps reduce the risk of unauthorized code execution, data exposure and malware infections. You can take the following measures to reduce these risks.

Restrict macro use

  • Deactivate macros unless they are needed for approved business operations
  • Allow only authorized users to enable or modify macro settings
  • Use the principle of least privilege when assigning administrative privileges and account access
  • Use only macros that have been developed, approved or digitally signed by trusted sources like your organization, a trusted vendor or authorized IT personnel
  • Update and patch applications and systems often
  • Scan devices regularly with an antivirus software from a reputable vendor

Monitor and manage macro use

  • Train your organization's users and provide guidance on macro security and phishing
  • Ensure macros do not contain any sensitive information, such as personal credentials
  • Log and review changes to macros, macro permissions and related administrative settings

Manage macro use safely

Effective macro management improves productivity, balances risk and provides clarity about what is allowed. The following measures can help your organization use macros safely.

Identify trustworthy macros

Treat macros as trustworthy only when strong governance and technical controls are in place. The following conditions can help you determine when macros are controlled and reliable for your organizational environment. Your organization should:

  • develop, own and maintain macros
  • allow only signed and verified macros, such as those developed in-house
  • verify that documents come from known internal senders and have not been forwarded outside the organization
  • assess macros independently before approval to confirm a valid business need and to ensure they are not malicious

Practical tips for using macros safely

You can reduce risk by applying macro policies in daily processes and oversight. The following practices can help you use macros safely.

  • Store approved macro files online in controlled, trusted locations
  • Require an independent review before approval and after any changes, so assessors confirm a valid organizational need and check for unsafe functions before signing
  • Maintain a current list of approved macros and remove macros that are no longer needed
  • Allow users to get macros only from internal repositories or managed network shares
  • Treat unexpected or external documents as high risk, and do not run macros from unsolicited files

Alternatives to macros

There are safer and more modern ways to automate tasks without using macros. Consider these alternatives:

  • commercial off-the-shelf (COTS) applications from office productivity suites
  • software-as-a-service (SaaS) tools to automate data flow
  • custom-built applications that support business processes

Learn more

Date modified: