Settings

1. The file

A .docm, .xlsm, .pptm, .doc, .xls, .ppt or vbaProject.bin. A .docx, .xlsx or .pptx works too.

Drop the file here, or choose it It is opened, unzipped, decompressed and read in this tab. Nothing is uploaded, and nothing in it is ever executed.

How it works

The only safe place to read a macro is somewhere that cannot run it

The question people actually have about a macro-enabled document is not whether a scanner flags it. It is what the macro does. Scanners disagree, a clean result is not an assurance, and plenty of legitimate businesses still send spreadsheets with real VBA in them.

Answering that means reading the source, and the obvious ways to read it are the unsafe ones. Opening the file in Office puts the macro one mis-click from running. Handing it to a library built to work with VBA means handing an unknown macro to code that knows how to execute it. A browser tab with no eval in it has no mechanism for running VBA at all, which is why the extraction here is written by hand from the specification rather than borrowed.

How the source is actually found

The chain runs container, storage, stream, decompression, source.

  • A modern .docm, .xlsm or .pptm is a zip, with vbaProject.bin inside it.
  • An older .doc, .xls or .ppt is already an OLE compound file: a whole filesystem in a file.
  • vbaProject.bin is itself an OLE compound file. Inside it, a storage called VBA holds one stream per module and a stream called dir.
  • dir is compressed with the scheme in MS-OVBA 2.4.1. It lists the modules, their stream names, and for each one the byte offset in its stream where the compiled p-code stops and the compressed source begins.

All of which is implemented here, by hand. It matters because that offset is the whole trick: a module stream begins with compiled p-code, and the readable source is behind it. A tool that does not walk dir properly either misses the source or shows you the p-code.

What to look for once you can see it

Malicious VBA is rarely subtle once it is in front of you, because it has to do concrete things. Look for AutoOpen, Document_Open, Workbook_Open or Auto_Exec, which run without being asked. Look for Shell, WScript.Shell, CreateObject, powershell, and anything that writes to disk or fetches from a URL.

Then look for the opposite of clarity: long strings of hexadecimal or base64, string concatenation assembling a word one character at a time, Chr() arithmetic, enormous blocks of dead code, and comments written to be read by somebody who is not you. Obfuscation is not itself proof of anything, and an ordinary business macro almost never needs it.

Reading the source tells you what a file intends. If you have decided you do not want any of it, DISARM removes the macro project and everything else that runs, and writes the document back as the plain format. X-RAY reads what a file is when its extension is not telling the truth, and DECODE unwraps the encoded blobs a macro was going to unwrap for itself.

The guide: How to check a PDF for malware without uploading it

Questions people ask about MACROLENS

Does opening a file here run its macro?

No. Running a macro needs a VBA interpreter, and there is not one in a browser. The bytes are parsed as data, the text is decompressed and printed, and that is the end of it. The page contains no eval, no Function constructor and no code path that turns anything read out of the file into something the browser executes.

My .docx has a vbaProject.bin in it. Is that bad?

It is worth knowing about. The x forms of the Office formats are defined as the ones without macros, and Word will not run VBA from a .docx. But the project travels inside the file, so renaming it to .docm, or saving it from Word as macro-enabled, brings the code back to life. It is also a sign the file was made by something other than Word.

What does the compiled-against-source line mean?

Every module keeps two copies of itself: compiled p-code, which is what Office actually runs, and compressed source, which is what the editor shows you. They are supposed to agree. When the compiled half is much larger than the source, or holds strings the source does not, somebody may have edited one without the other. It is a reason to be careful, not a conclusion.

Why does it show line numbers against the flags?

So you can go and read the line. A flag on its own is an accusation; a flag with the line it came from and a sentence about why it was flagged is something you can check and disagree with. Every module is shown in full, with the flagged lines marked, for exactly that reason.

Can I get the source out?

Yes. One text file with every module and the flag list, or a zip with one file per module named .bas, .cls or .frm as the project has them. Both are written in this tab from what is already on screen.

Which files can I drop in?

A .docm, .xlsm, .pptm, .doc, .xls or .ppt, or a vbaProject.bin on its own. Drop a .docx, .xlsx or .pptx too: those are the forms that are meant to have no macros, and it is worth knowing when one does.

Why read the macro here rather than in Office?

Somebody sent you a spreadsheet that wants you to enable content. The only honest way to decide is to read what the macro says, and the only safe place to read it is somewhere that cannot run it. MACROLENS unzips the file, walks the OLE compound file inside, decompresses each module and prints the source, with a note against every line that deserves one. It is a reader. There is no interpreter here.

Doing this often? The OBSCURA Sovereign Suite checks every file in a batch before it is opened: its real type, its macros and scripts, and what it calls out to. On its own, US$2 a month; with everything else, US$5 a month or US$48 a year.