Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
A macro virus lives in the automation language built into office documents, which is why a file that looks like an invoice can execute code the moment someone enables editing.

What Is a Macro Virus?
A macro virus is malicious code written in the scripting language embedded in office applications, most often Visual Basic for Applications. It travels inside an apparently ordinary document and runs when the file is opened, or when the reader clicks the button that turns protections off. Unlike a compiled executable, it needs no installer and no exploit: the capability it abuses is a documented product feature intended for automating spreadsheets and reports.
Concept arrived in 1995 as the first macro virus to spread widely, infecting Word’s global template so that every document saved afterwards carried it. Laroux did the same for Excel a year later. Melissa, released in March 1999, attached itself to outgoing mail through Outlook and spread quickly enough to force several large organisations to shut down their mail systems; its author, David L. Smith, was later convicted.
The technique then lay relatively quiet while macro security tightened, and returned around 2014 as the preferred delivery method for banking trojans and ransomware. Dridex and Emotet campaigns sent millions of documents with a yellow banner and a line of text asking the reader to enable content because the file was supposedly created in a newer version of Office. It worked for years because the instruction looked like a formatting problem rather than an attack.
The macro itself is rarely the malware. It is a launcher, and a short one:
That second stage is where the capability lives, which is why a macro detection should be treated as the start of the chain rather than the whole of it. The patterns are the same ones described under loaders and droppers.
Attackers also hide the code from static examination. VBA stomping removes the readable source while leaving the compiled p-code that actually executes, so a tool that reads only the source sees an empty project. Excel 4.0 macro sheets, a legacy format predating VBA, were revived heavily in 2020 and 2021 because many security products did not parse them.
Microsoft began blocking VBA macros by default in files carrying the mark of the web in July 2022, after a brief rollback. The effect was immediate and measurable: campaigns moved to ISO images, shortcut files, HTML smuggling, and one-time password-protected archives, all chosen because they strip or avoid that tag. Macro attacks did not disappear, they became selective, and they still succeed where the mark of the web is not applied, such as files arriving through internal file shares, synchronised cloud folders, or archive tools that do not propagate it.
Verify the behaviour rather than assuming it. Save a test document from email to a share, then open it from there, and check whether the block still applies.
Blocking everything is usually unrealistic, because finance and operations teams often depend on automation someone wrote years ago. A workable position has four parts:
Detection should focus on what follows the document rather than the document itself. An Office application spawning a shell, a script host, or a signed binary that reaches the internet is a high-fidelity signal; it survives every change of obfuscation and every new file format. Reinforce it with user guidance that is specific: no legitimate sender needs you to enable content to read an invoice.
At Privia Security, our email security solutions filter weaponised documents and containers before they reach the mailbox, which remains the cheapest place to stop them. Pair that with phishing awareness, since the document is only ever as convincing as the message that carried it.
Less than they were, but not gone. Default blocking of internet-sourced macros pushed most campaigns towards other delivery formats, yet macros still execute freely in files that reach a user without the mark of the web, including documents from internal shares, synchronised cloud storage, and some archive tools. Organisations with trusted locations or broad macro exceptions remain fully exposed.
Treat the request itself as the warning sign. Compromised mailboxes send to their own contact lists, so familiarity proves little, and a legitimate document almost never needs macros enabled simply to be read. If automation is genuinely required, it should be signed and distributed through a trusted location, not requested by a banner the user is asked to dismiss.
It is a technique that deletes the readable VBA source code from a document while leaving the compiled p-code that Office actually runs. Tools which extract and inspect source see nothing suspicious, yet the macro still executes on open. Analysis has to target the p-code stream directly, and detection is better placed on the behaviour after execution than on the document contents.
Both support macro languages, so the risk is not exclusive to Microsoft Office, although attack volume is far lower because the installed base is smaller. Google Workspace runs Apps Script in the cloud rather than on the endpoint, which changes the exposure rather than removing it. Macro settings and add-on controls deserve the same review in any office suite you deploy.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.