How to check a PDF for malware without uploading it
A browser cannot run a virus scanner. It can tell you whether the file contains the parts a weaponised PDF needs, and most PDFs contain none of them.
Written · Updated
No browser can run a virus scanner, and anybody telling you otherwise is selling something. What a browser can do is read the PDF's own structure and tell you whether it contains the parts a weaponised PDF needs: JavaScript, an action that runs the moment the file opens, a launch action that starts another program, and files embedded inside it. Most ordinary PDFs contain none of those. X-RAY reports them and lists every web address the document points at, without opening the document and without uploading it; DISARM removes them and tells you what it took out. Neither is antivirus, and the sections below are as much about what this does not settle as what it does.
Three different things people mean by a dangerous PDF
Almost every answer to this question treats "is this PDF safe" as one question. It is three, they need three different checks, and only one of them is what a signature scanner is looking for.
| What it is | What it looks like in the file | What finds it |
|---|---|---|
| Active content | JavaScript, an OpenAction, a Launch action, an embedded file, a form that submits somewhere | Structure. Readable without opening the file. |
| A link to a phishing page | Nothing. A URL and some persuasive text | Reading the addresses, and your own judgement. |
| An exploit in the renderer | A malformed font, image or stream that breaks the program drawing it | Nothing here. Patching, and a sandbox. |
Knowing which of the three you are facing is most of the answer. A structural check settles the first completely, helps with the second, and says nothing at all about the third.
Why the standard advice is to upload it, and when that is wrong
Search this question and every result says the same thing: upload it to VirusTotal. That is good advice for a file that is not confidential, and this site does not replace it: a signature check against seventy engines answers a question no structural reader can, namely whether anybody has seen this exact file before and called it bad.
But it is worth knowing what an upload is. A standard VirusTotal submission is shared with the participating security vendors and with organisations paying for its threat-hunting service, who can search for and download it. VirusTotal maintains a documentation page about what to do if you uploaded something confidential by accident, which tells you how often that happens. They also sell a private scanning tier precisely because the ordinary one shares.
So the question to ask first is not "is this file suspicious" but "whose file is this". An invoice, a contract, a witness statement, a medical letter, a client's disclosure bundle: these are documents you cannot put into a sharing ecosystem to answer a question you can answer another way.
What to check, in order
- Is it even a PDF. The extension is a claim, not a fact. X-RAY reads the file's own first bytes, so a program renamed to
.pdf, or the double extensioninvoice.pdf.exethat Windows will happily hide half of, does not survive the first line of the report. - Does it contain active content. Four flags: JavaScript, an OpenAction that runs on open, a Launch action that starts a program, and embedded files. A document that is genuinely a document usually has none. A form might have JavaScript for validation, which is legitimate; the point is to know it is there.
- Where do its links go. X-RAY lists the addresses the document points at, which lets you read a link without clicking it and without hovering over it in a reader that might act on the hover. A "view your invoice" button pointing at a domain registered last week is the whole attack, and no scanner will flag the file.
- Take a hash first, if this might matter later. CHECKSUM takes a SHA-256 of the file as it arrived. If it turns out to be something worth reporting, the first question you will be asked is whether the copy you examined is the copy you received, and a hash taken before you touched it is the only convenient answer.
What a real finding looks like
A PDF built with a script, an action that runs on open, and a file hidden inside it produces this, and nothing about the file is opened to get it:
| Finding | Detail |
|---|---|
| Active content | JavaScript, OpenAction (runs on open), Embedded file |
| Phones home | Every http and file address the document points at, listed |
Run the same file through DISARM and it reports what it removed, item by item (open action, document JavaScript, embedded files), and writes yourfile.disarmed.pdf, which still shows every page. That is the version to open if you need the document at all.
What to do about each answer
- Active content, and you were not expecting the file. Do not open it. The finding is not proof of anything, but an unexpected attachment with a script in it is not a document you need.
- Active content, and you do need the document. Run it through DISARM and open the cleaned copy. Read what it says it removed: an invoice with an embedded file and a launch action in it is worth a phone call to the sender on a number you already had.
- Nothing active, and the links go where they claim. Open it in your browser rather than in a desktop reader. Chrome, Edge, Firefox and Safari draw PDFs in a sandboxed process with a far narrower scripting surface than a full reader, and none of them will run a launch action. It is a reduction in risk, not an absence of one.
- Nothing active, and the file is not sensitive. Then upload it to VirusTotal as well. The two checks answer different questions and there is no reason to pick one.
Why finding nothing settles less than it seems
This matters more than anything above, and it is the part that gets left out.
A structural check finds structure. It does not find a link to a page that looks exactly like your bank, because there is nothing wrong with the file: the attack is the text and the address, and both are ordinary. It does not find a malformed font or a broken image stream crafted to corrupt memory in whatever program renders it, because that PDF is, structurally, a perfectly normal PDF with a picture in it. Those are real attacks and they have nothing for this to report.
So "no active content" means the file does not contain scripts, open actions, launch actions or embedded files. It does not mean the file is safe, and it should never be written up as though somebody cleared it. Keep the renderer patched, prefer the sandboxed one, and treat an unexpected attachment as unexpected however clean it reads.
The same applies to Word and Excel, for different reasons
Office files carry a wider set of active parts: VBA macro projects, ActiveX controls, embedded OLE objects, DDE and INCLUDE field codes, and remote templates that fetch content from an address the moment the document opens. DISARM removes all of those too, writes a macro-enabled file back as the plain format, and lists each removal. A .docm that arrives claiming you must enable content to read it is the oldest attack still working, and there is no version of enabling it that is the right move.
The same two-step applies. MACROLENS reads the VBA out of a .docm, .xlsm, .doc or .xls without opening it in Office, so you can see what the macro would have done before deciding, and DISARM removes it. A macro that fetches a file from an address and runs it reads exactly like that, in plain sight, and takes a minute to find.
And one format that is not on anybody's list because it looks like a picture: SVG is a document, not an image. It can carry <script>, event handlers and references that fetch from a remote address the moment it is rendered. A browser will run all of it. SVGCLEAN strips those and leaves only what draws, which for an SVG somebody sent you is worth doing before it is opened anywhere that matters.
Alongside: STRATA recovers the earlier versions a PDF saved by appending still carries, which is a different question about the same file, and CHECKSUM records which file you actually looked at.
Questions people ask about How to check a PDF for malware without uploading it
Can a PDF really contain a virus?
A PDF can contain JavaScript, an action that runs the moment it opens, a launch action that starts another program, and whole files embedded inside it. Those are the parts attackers use. Whether any of them is present is a structural fact about the file, readable without opening it, and most ordinary PDFs have none of them.
Why not just upload it to VirusTotal?
Often you should, and this site cannot replace it. But a standard VirusTotal upload is shared with the security vendors and with businesses paying for its threat-hunting service, and VirusTotal keeps a page explaining what to do if you uploaded something confidential by accident, which tells you how often it happens. An invoice, a contract, a medical letter or a client file is not something to put into a sharing ecosystem to answer a question you can answer another way.
What does X-RAY actually check?
It reads the file's own structure and reports four things: document or page JavaScript, an OpenAction that runs on open, a Launch action that starts a program, and embedded files. It also lists the web addresses the document points at, so you can read a link without clicking it. Nothing is executed and nothing is uploaded.
If nothing is found, is the file safe?
No, and this is the sentence to hold on to. A structural check finds active content. It does not find a link to a convincing phishing page, and it does not find a malformed font or image meant to break the program that renders it. Those are real attacks that leave nothing for this to see.
What is the difference between X-RAY and DISARM?
X-RAY reads and reports. DISARM rewrites: it removes the scripts, open actions, launch and submit actions, embedded files and XFA forms, lists everything it took out, and gives you a PDF you can read. Use the first to decide, the second when you need the document anyway.
Is opening it in my browser safer than in Acrobat?
Generally yes, for an unknown file. Chrome, Edge, Firefox and Safari render PDFs in a sandboxed process with a far more limited scripting surface than a full desktop reader, and they will not run a launch action. It is a reduction in risk, not an absence of it; renderer bugs are found in browsers too.
What about a file that is not really a PDF?
X-RAY reads what the file declares in its own first bytes rather than trusting the extension, so a program renamed to .pdf, or a double extension like invoice.pdf.exe, does not get past the first line of the report.
Is anything uploaded?
No. The file is read in the tab and nothing leaves the device. That is the whole point here: the file you are worried about is usually one somebody sent you, and it is often not yours to hand to anybody.
Related tools
- X-RAYRead what a PDF declares — scripts, open actions, addresses — without opening it
- DISARMRemove the active parts and keep a document you can read
- STRATARecover the earlier versions a PDF saved by appending still carries
- CHECKSUMTake a hash, so you can say later which file you looked at
- How to tell if a USB drive was plugged into a PCWindows writes every device install into a plain text file, with the vendor, product and serial number.
- What a browser extension can do, before you install itEvery answer tells you to read the box Chrome shows when you click Add. The extension is a zip you can download and read first, and it names the SDKs and the addresses the dialogue never mentions.
- How to see what a device on your network connects toEvery answer tells you how to list the devices on your network; none tells you what they talk to.
- What a Windows prefetch file shows, and what it does notA .pf proves a program ran: the last eight run times, a run count, the files it loaded and the volumes it read.
- How to spot malware beaconing in a connection logSearching for a fixed interval finds nothing, because every implant since about 2013 adds jitter for exactly that reason.
All 10 guides under “A suspicious file, a device or a network”. Part of the reading for IT and security teams.
A letter, now and then
An occasional letter when there is something worth reading: the new guides and what changed in the tools. Never more than once a month and nothing else, and you can leave at any time on the unsubscribe page.