Is it illegal to create a computer virus?
<p>I've seen videos of "hackers" on YouTube infecting computers of tech support scammers. If the tech support scammer were to take a program from the person's computer, without their consent or knowledge, but the program turns out to be a virus and once they run it, it destroys the computer of the tech support scammer, is that considered distributing a virus? </p>

<p>And if so, is it a crime if that person's virus destroys a whole system of computers that the tech support scammer works on, even though the virus was taken off the person's computer without their knowledge/consent?</p>

<p>In most jurisdictions, no - "hacking back" is a crime in most (all?) places - although there is discussion about "hack back" laws - but even these laws generally stop short of malicious behaviour.    For example - read up on the <a href="https://en.wikipedia.org/wiki/Computer_Fraud_and_Abuse_Act" rel="nofollow noreferrer">CFAA</a>", and note the lack of anything to protect you where you hack back.</p>

<p>As a rule, if another party commits a crime, and you commit a crime against them, both parties can be prosecuted for their crimes.   This may not be true in civil matters however (because of the "Clean Hands" doctrine - ie if you did something wrong, and were thus wronged, don't go looking to the courts for a remedy)</p>

<p>I do note that a Virus is different from a binary, which, when run performs an action like deleting data.   In the latter case, that would not be a virus (as it can not spread by itself), and you would most likely be in the clear.</p>

criminal-law