Say for example a person gets an email with a link. That link turns out to be a download link for a virus and once the user clicks on it the virus is installed on his computer. Sure the virus is on his computer but what makes it run. If the user doesn't open the virus file there is nothing to run it? So how do hackers take over your computer if you never even ran their virus?

  • "turned out to be a download link" -- do you mean that, in this scenario, the link visibly uses the browser's download function and downloads a file to the Downloads directory? In that case, you would have to run that downloaded file. But you can get malware from links that are not file downloads. Is that what you are talking about?
    – schroeder
    Commented May 2, 2020 at 7:25
  • @schroeder Yes! The first scenario is what I mean. Commented May 2, 2020 at 21:59

3 Answers 3


In addition to @mentallurg ‘s answer there’s another way of executing the virus code. Sometimes virus code is packaged within an exploit for existing software.

For example there could be a vulnerability in your browser that allows constructing a malicious web page in such way that a part of that web page would be interpreted as code and executed on your cpu. Depending on vulnerability used that could happen right after you open the page, or when you perform specific actions (like clicking something) within the document.

The best way to defend against these attacks is to regularly update software. In addition - minimize usage of weird browser extensions (flash, silverlight, etc). Browsers are pretty secure pieces of software, but flash is regularly used as a target. Nobody should use it in 2020...


Normally virus are spreaded not as pure virus code. One of ways is that the file that user downloads is a normal application like text editor, video editor or some utility. The executable code (e.g. .exe or .msi) contains the application code and virus. User downlods such file to use the application. And to use it, user course launches it. The virus code is the activated. How successful the virus will be depends on the antivirus installed on the system.

If user doesn't run such file, of course nothing happens and virus is not activated.

Many antiviruses check the data received from Internet on the fly and normally do not allow to store infected files on the disc. But in case virus was not recognized and browser saved it to the disk, happens what I described.

  • your answer makes sense but I heard one time that for example when a ad pops up on a malicious website and you "X" out of it. Hackers program it to download virus. In this case there is a slim to none chance user will run virus so how is that done? Commented May 2, 2020 at 1:59
  • in other words how do you have the virus run if it is "Pure Virus Code"? Commented May 2, 2020 at 2:00
  • what would you do in that case Commented May 2, 2020 at 2:16
  • I don't understand your question. If user knows that the file he downloads is a pure virus without any other functionality and still downloads it and intentionally executes, he knows what will happen. What exactly is not clear here?
    – mentallurg
    Commented May 2, 2020 at 19:15
  • I mean what if he clicks on a button on a website and that button turns out to be a download link for a virus how would the hacker run it? Commented May 2, 2020 at 21:58

If attacker runs malicious shell code by java script it may work. I asked a hacker how they hackd by links. He told me that they used javascript and run shell code for that task.

  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Oct 23, 2021 at 20:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .