How can you get a computer virus or malware?

How can your computer get a virus, trojan, work or spyware? What are the ways malware can infect your Windows computer? What types of files carry virus and malware? We will touch upon these questions in brief and take a look at some files and see if they can infect your computer or phone.

How can you get a computer virus

How can you get a computer virus

The common ways your Windows computer can get infected with a virus or malware are:

  1. You download pirated software
  2. You download and install software from malicious websites
  3. You download and install already compromised apps from official app stores
  4. You install Bundleware without reading the EULA or unchecking the third-party software offers, so as to avoid installing PUPs
  5. You click on links which take you to malicious or compromised websites, which in turn download a malicious code to your PC automatically
  6. You blindly click on social media links from friends, which you tend to trust, that initiate download of malware to your computer or mobile device
  7. You click on malicious email attachments without checking who the sender is
  8. You open infected Office files which have come from another system
  9. You click on malicious advertisements – Malvertising – which have hidden code embedded
  10. You connect an infected USB to your computer and using it without scanning it for malware.

Most used file type as carrier for malware

Executables or .exe files can be dangerous, and so even your email client won’t download such files from emails. EXE, COM, MSI, etc. are three types that you need to be very careful about – whether present in email or downloading from any website. Always scan all attachments and downloads with antimalware before opening them.

Do PDF carry virus? Can you get virus from PDF?

Not just carry malware, but a PDF can also perform the function of Phishing. Portable Document Format (PDF) files contain active elements that can infect your computer. Dynamic elements and Javascript presence make them dangerous. But it largely depends on your PDF reader that parses the file.

If it takes care of all aspects of opening, reading, editing and closing of the files, the chances of getting infected are less. The PDF reader you use should be able to detect stack overflow and scan links inside the PDF file.

Talking of links, it is common for phishers to include one or more redirect URL in PDF files. Innocent readers believe the link and click on it thereby losing their data. One way to get around this is to copy paste links directly into browser address bar so that the URL scanners built into the browser can see if the link is malicious. Not all browsers may have such functions but the mainstreams one’s like Internet Explorer, Edge, Chrome, Firefox do have them. You may also use URL scanners as add-ons for your browser.

So in conclusion, sure you can get a virus from a PDF, and you can also be misled into sharing your information with malicious sites/people using redirect links or shortened links in the file.

Can you get virus from image files?

What can a simple BMP image file do? Well, it can contain few bits of binary code that may execute when you open it and infect your computer. Seemingly innocent looking image files are a foolproof way to strike and spread the virus. How many of us really run malware scanner after downloading images from the Internet?

Users think it is just an image… and that images cannot harm. So they open downloaded images without taking any precaution or view it in the email client with a previewer. In both cases, a portion of the computers RAM keeps data to be shown on screen. As you are viewing the image, the executable binary code spreads to your computer, thereby infecting it.

You can get a virus from image files as you would from any other file types originating from the Internet (email included). An image file like JPG, BMP, PNG, etc can be infected. It could be a Payload or an Exploit. But the virus will not be executed as long as the image is not opened, executed or processed by another program.

An executable .exe file can also be made to appear like an image file by naming it niceimage.jpg.exe. Since Windows by default hides file extensions, users see only the .jpg part and click on it thinking it’s an image file.

For your information, W32/Perrun was the first reported JPEG virus. It extracted data from JPEG files and then injected picture files with infected digital images.

Can Office Documents carry a virus?

Office documents also serve as a good carrier for malware. You might have seen emails where document files are attached, and the email says more details present in the attachment. Since Office documents like docx, doc, docm and similar formats allow active elements, you may be infected. Most of the malware is downloaded by macros present in the documents. That is why Word will not open an internet originating file in edit mode unless you ask it.

Office documents carry Macro Virus if programmed to do so. Scripts and macros make it easy. In most cases, first, the macro runs to infect your computer while the payload is downloaded later – to avoid detection by antimalware.

Can you get virus by watching YouTube?

Depends on how you use the site. YouTube videos as such are not dangerous. But then, few aspects of YouTube are beyond its control – malvertising and in-video programming. Video programming is available to users who have a good number of subscribers. That reduces the scope of being infected. But it may be dangerous if you click on those videos overlaying on the main videos.

It is the same with advertisements. They are active elements, so your computer is vulnerable unless you make it a point not to click advertisements. So the answer is that YouTube videos are not dangerous as long as you take care while interacting with the active content overlaying the main video. The scope of acquiring a virus from YouTube is low, but still, it is there – and it is the same for any other website for that matter!

Can you get virus from Tumblr, Facebook or other social sites?

It again depends on upon what you are trying to do. If you are simply uploading files and not clicking any links, you are safe. Ads against content could be malicious. Links can be URLs that try phishing. If you download an image and open it without scanning for malware, it gets dangerous. The Windows SmartScreen usually does a good job at protecting users from web-based threats.

In short, there is the possibility of socially engineered malware lurking everywhere on the Internet. You need to be on guard. Gone are the days when a virus was delivered via .exe files; now they can carry any file extension and can even be embedded in image files.


So you see the most important precautions you need to take, is to download only trusted software from their official sources, be very careful during its installation and opt out of 3rd party offers, scan any USB or drive which you connect to your device, be very careful before you click on any web links and take precautions before downloading email attachments.

Now read:

  1. How do you tell if your computer has a virus
  2. Tips to secure Windows PC.

You might want to also read about the evolution of malware and how it all began!

Posted by on , in Category Security with Tags
Anand Khanse is the Admin of, a 10-year Microsoft MVP Awardee in Windows (2006-16) & a Windows Insider MVP. Please read the entire post & the comments first, create a System Restore Point before making any changes to your system & be careful about any 3rd-party offers while installing freeware.