What is a computer virus ?

There seems to be a bit confusion about what is a computer virus, so here an article clarifying it hopefully. A computer virus is not necessarily a malware, and there are many other types of malwares than viruses. This is better summarized with a small schema:

Malware vs. Virus

Most viruses are malwares currently, but many malwares are not viruses.

So the question still holds: What is precisely a virus? Tada… suspens… it’s a program that creates a variant of itself in a given environment.

NB:

A bit of history

The word virus applied to computer programs was first coined by Leonard Adleman as he was supervising the PhD of Fred Cohen at the University of South California (4 miles from where I am writing this article btw.). This dissertation was completed in 1986 and was the first to formalize computer viruses. However, there were already viruses at that time, like Elk Cloner. At that time it was just a timid beginning, nothing compared to what is going on nowadays…

Formalization

Before diving into the formalization of a virus, we should first introduce what is a Turing Machine

Formalization of a Turing Machine

A Turing Machine is the abstraction of a computer program (whereas the formalization of a computer would be a Universal Turing Machine). So what is a Turing Machine? There are many ways of formalizing it. You can get a good overview in this Wikipedia article. Basically, it consists in two parts:

Illustration of a Turing Machine:

Illustration of a Turing Machine

If the head comes to a point where it does nothing, then the program is executed and halts.

The formalization we adopt here for a Turing Machine is the following:

Formalization of a virus

Now the question is, what is a virus on a Turing machine? It’s simply a sequence on the band of a Turing Machine \(M\) that gets reproduced to itself or a variant (evolution) of itself. Note that the same sequence on the band of another Turing Machine \(M'\) may not reproduce: a virus is a virus only relatively to a given machine (environment).

Here a schematic illustration: virus on a turing machine

NB: The virus reproduction can be an exact copy of the virus itself, or a variant of it. On the machine \(M\), a virus \(v\) can produce first a variant \(v_1\) of itself, \(v_1\) producing then a variant \(v_2\) of itself etc. The set \(\{v, v_1, v_2, \dots\}\) is called the viral set of \(v\). A viral set can be be of size 1 (the virus produces each time an exact copy of itself), of size 2, 3 etc. until infinity, means there are in this case infinitely many variations of the virus. The viral set of a virus \(v\) is noted \(V\).

Now the formal definition of a virus… Brace yourself and don’t worry, the explanation follows:

\(V\) is a viral set (for a Turing Machine \(M\)) if: \(\forall v \in V: \\ [\exists t, j \in \mathbb{N}\space such\space that: \\ P(t) = j\space (1.1) \\ and\space S(t) = S(0)\space (1.2) \\ and\space \big(C(t, j), \dots, C(t, j + \mid v\mid -1)\big) = v\space (1.3)] \\ \Rightarrow \\ [\exists v'\in V, t', j' \in \mathbb{N} \space with\space t'>t \space such\space that: \\ j' + \mid v'\mid \leq j\space or\space j + \mid v\mid \leq j'\space (2.1) \\ and\space \big(C(t', j'),\dots,C(t', j'+\mid v'\mid-1)\big)=v'\space (2.2) \\ and\space \exists t'' \space such\space that:\space \\ \hspace{3em} t<t''<t'\space \\ \hspace{3em} and\space P(t'')\in \{j',\dots,j'+\mid v'\mid-1\}\space (2.3)]\)

Explanation

If:

Then later at time \(t'\) the head is at the cell \(j'\) such that:

And because \(v\) and \(v'\) belong the the same viral set \(V\), \(v'\) is an reproduction/evolution of \(v\).

Remarks

Conclusion

This article is a purely formal definition of what is (and by contrast what is not) a virus. It bases in a large part on the book Computer Viruses: from theory to applications by Éric Filiol which I warmly recommend. I hope it demystified a bit the notion of computer virus and made you curious. I will probably come later with more practical articles about viruses, but at least we know now what we are talking about.


Share this: