Resources » Other Topics (Non-PDF) » Can PDFs Contain Viruses? Understanding Malware

Can Opening a PDF Be Dangerous? How to Check PDFs for Malware

illustration of a locked file on a laptop with a virus

Although it’s rare that you’ll get a PDF that contains a virus, it happens. Viruses and malware can be attached to any type of file and delivered through many means — text message, email attachment, website download, link etc. How do you know if a file is infected with malware?

Yes, PDFs can actually contain viruses. A virus is a malicious program that threatens your computer, phone or other electronic device’s security. Viruses take many different forms and damage your computer in different ways. 

  • Malware – Malicious program that, once downloaded, steals your information or sends you unwanted/inappropriate ads.
  • Ransomware is a form of malware that encrypts your computer and demands payment for unlocking your system. 
  • Virus – A type of malware that replicates itself and spreads once downloaded on your computer, destroying and corrupting files that you have on your system.  
  • Trojan – A program that may appear unassuming but is stealing your data or distributing malware to your computer in the background. 

Fortunately, these forms of malicious computer programs usually require you to install a program, download something, or open a document on the web. It is unlikely that you will ever receive a virus if you aren’t downloading data from untrustworthy sources. 

Unfortunately, this does mean that PDFs can potentially host viruses, though it is rare. Even if the PDF doesn’t have a particularly large file size, it could result in a virus infecting your system. Again, this is rare, but it’s worth understanding, so your data is protected. This will usually occur upon opening an infected PDF. It then may, for example, result in a piece of code being executed on your computer that installs a malicious program from a 3rd party source. 

So how can you prevent this?

Do Not Download PDFs from Untrustworthy Sources

Untrustworthy sources may take many forms. Strange websites with popups, ads, and strange URLs may prompt you to download “something” now. If you don’t know what you’re downloading, or the website doesn’t seem trustworthy, don’t take the risk! Even if it’s just a PDF – it can still be a virus. 

If you receive an email from someone you don’t know or the email address is a jumble of different letters and symbols, it may be a scammer or phisher trying to access your system. Phishing is when scammers try to trick you into downloading something or giving away personal information. Phishers may pretend to be a store, bank, or person that you know. Even if the phisher is just prompting you to download a simple PDF – don’t! 

ZIP files are a great way to package up several different PDFs and send them to someone else as a single file. However, they can also host malicious programs and malware that are installed on your system once you open the file. Be just as cautious with ZIP files as you are with PDFs. 

Scan PDFs and Files for Viruses

Although you shouldn’t download files from untrustworthy sources, most viruses require you to open the program or file before they begin infecting your system. If you have a PDF file on your computer that you’re concerned about containing a virus, consider using a virus scanning tool to check the file for a malicious program. 

A tool like VirusTotal will analyze for free any files and website URLs for malware or security breaches. You can simply upload a PDF you’re worried about being infected to the website and it will check whether or not it is infected. You can even paste a website URL into the tool and it will scan the web page to see whether or not malware is detected. 

Consider using antivirus software as well. Windows has Windows Security built-in and MacOS has Security. Some antivirus software can scan specific files you’re concerned about or even check your entire computer for potential issues. Other antivirus software may scan files that you plan to download for viruses before they’re downloaded to protect you from malicious files. 

Use a Trusted PDF Reader 

A PDF Reader is a program that allows you to open and view a PDF on your device. While a web browser can allow you to open and view PDFs, it won’t have many additional features like bookmarking, commenting, and editing a PDF. Some PDF readers will even have built-in defenses against PDF viruses. 

When deciding on what PDF reader to use, consider checking how frequently the reader is updated. Hackers are constantly changing the ways they sneak into your system to circumvent common security programs. If your PDF reader has frequent security updates, it’s probably an excellent choice to use for safely viewing a PDF. PDF readers may also come equipped with the option for disabling JavaScript code from being executed on your system. Viruses may commonly be hidden in PDFs in the form of JavaScript that is run on your system once the PDF is opened.  

Remember that a PDF reader may help avoid a virus from being installed on your system but won’t prevent it entirely. Never download and open PDFs from untrustworthy sources!