Can a pdf have a virus? Here’s the answer

What if I told you one of the most secure file types on your computer is still susceptible to malware? Wait, can a pdf have a virus? Yes, it’s true. A PDF is supposed to be a more secure file type for documents as opposed to Word or Pages files. It locks down the document so others can’t edit it. And it’s commonly used in business, education, and personal fields. But that’s exactly what makes PDFs a prime target for hackers and bad actors.

In this article, we’ll explain how you can get a virus from a PDF and tell you what to do if your Mac is already infected.

How can a PDF file contain a virus?

As you read earlier, PDFs are prime targets for viruses. They are the most common file type shared over email. And even though PDFs are locked down, so they can’t be edited, a lot of them usually have dynamic fields for forms or embedded signatures. It’s these dynamic and multimedia features that can be exploited with malware and other vulnerabilities.

How to check PDF for viruses

The best way to protect your Mac against PDF viruses is to download and open PDFs from trusted sources. But that’s not always a reality. So, if you have to view a PDF sent from someone you don’t know, you should absolutely scan the file for malware.

Many email providers — like Gmail — will scan every email attachment and alert you if anything malicious is found in your inbox. And if your email provider doesn’t have something like that, many antivirus apps can help with this instead.

How safe is it to download free PDF files from the internet?

When it comes to downloading a free PDF from the internet, it’s really no different than any other file type. If you’re not sure who is hosting the file, then it’s best to avoid it if you can. Otherwise, you should be prepared to scan the file for infections like you just read.

How can an infected PDF affect your Mac

There are actually quite a few ways an exploited PDF can impact your Mac.

Javascript

PDFs, by design, are able to execute Javascript commands. This is typically used for adding the date and time when you sign a document. But this same feature can be used to host an exploitative script that’s executed when you open the doc.

Command line

Scripts used in PDFs can also launch Terminal or the command line. Once a document can do that, it’s pretty much able to control your computer. And what’s worse is that it will be using command prompts, so unless you’re familiar with those, then you’ll have no idea what’s going on.

Fake clickbait

A common way PDFs can end up on your Mac is through wrong links on the internet. You could be clicking on a link thinking it will download something else, but instead, it downloads an infected PDF.

Media controls

There have historically been a lot of security vulnerabilities in music and media players on Macs. And since PDFs can also be embedded with audio and video files, this is another common way these documents can exploit your Mac.

Tips to protect Mac from PDF virus

You already read about being more cautious with the files you download and open from the internet. But here are a few more tips to help keep your Mac safe from infected PDFs.

Scan with CleanMyMac X

CleanMyMac X is an app that’s been notarized by Apple and designed to optimize the performance of your computer. It also has an Anti-malware module that will scan all the files on your hard drive and help you quickly eliminate any infections it finds.

You can download CleanMyMac X for free to try it out and see how easy it is to use. Once you have it installed on your Mac, just follow these simples steps:

  1. Open CleanMyMac X.
  2. In the sidebar, click Malware Removal.
  3. Then, click Scan.

And that’s all you need to do. CleanMyMac X will do the rest. It will let you know if it finds anything it thinks you should delete, or it will let you know you’re in the clear otherwise.

Disable Javascript in your PDF reader

Disabling JavaScript prevents anything malicious hiding in the document from running the second you open the file.

So, there’s a little bit of good news here. If you’re using Preview primarily to view PDFs, then you’re in luck. It doesn’t support Javascript. To run Javascript in a PDF, you’ll have to open that file in a browser.

But if you’re using Adobe Reader or Acrobat, there is something for you to do here. But don’t worry, it’s really easy if you follow these few steps.

  1. Open Adobe Reader/Acrobat.
  2. In the toolbar at the top, click Adobe Reader/Acrobat > Preferences.
  3. Then, in the sidebar, select JavaScript.
  4. Uncheck Enable Acrobat JavaScript.

Open documents in your browser before you download them

If you can preview documents in your browser, you can save yourself from the trouble of downloading and saving them on your Mac. So, if it is an infected file, it won’t be able to spread to other files on your hard drive. The browser keeps everything contained. Plus, this way means there’s less clutter stored on your Mac.

Another small bit of good news, even if you download an infected PDF, that doesn’t mean it will instantly spread across your entire computer. A lot of malware is designed to exploit vulnerabilities in various software. And if you keep all software updated, then you’re only helping yourself in case you accidentally download a PDF virus.

So, can PDFs have viruses? Yes, but hopefully, after reading this article, you’re feeling better equipped with what to do when that happens. And, more importantly, how to safeguard yourself and your Mac to prevent that from happening at the start.

Laptop with CleanMyMac
CleanMyMac X

Your Mac. As good as new.