A compression virus is an example of a benevolent
computer virus
A computer virus is a type of malware that, when executed, replicates itself by modifying other computer programs and Code injection, inserting its own Computer language, code into those programs. If this replication succeeds, the affected areas ...
, invented by
Fred Cohen
Frederick B. Cohen (born 1956) is an American computer scientist and best known as the inventor of computer virus defense techniques. He gave the definition of "computer virus". Cohen is best known for his pioneering work on computer viruses, th ...
. It searches for an uninfected
executable
In computer science, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instruction (computer science), in ...
file, compresses the file and prepends itself to it. The virus can be described in pseudo code
program compression-virus:=
The ''01234567'' is the
virus signature, and is used to make sure (''if first-line-of-file = 01234567'') the file is not already infected. The virus then asks for permission (''ask-permission'') to infect a random
executable
In computer science, executable code, an executable file, or an executable program, sometimes simply referred to as an executable or binary, causes a computer "to perform indicated tasks according to encoded instruction (computer science), in ...
(''get-random-executable-file''). If the permission is granted, it
compresses the executable (''infect-executable''), prepends itself to it (''prepend''), uncompresses the current executable file (''uncompress the-rest-of-this-file'') into a
temporary file
A temporary file is a file created to store information temporarily, either for a program's intermediate use or for transfer to a permanent file when complete. It may be created by computer programs for a variety of purposes, such as when a progra ...
(''tmpfile'') and runs it (''run tmpfile'').
''Cruncher'' is an example of a compression virus, a strain of which – ''Cruncher.2092''
[{{Cite web , url=http://vil.nai.com/vil/content/v_318.htm , title=McAfee article on Cruncher.2092, ''read Characteristics'' , access-date=2009-07-29 , archive-url=https://web.archive.org/web/20100823073607/http://vil.nai.com/vil/content/v_318.htm , archive-date=2010-08-23 , url-status=dead ] – is described by
McAfee
McAfee Corp. ( ), formerly known as McAfee Associates, Inc. from 1987 to 1997 and 2004 to 2014, Network Associates Inc. from 1997 to 2004, and Intel Security Group from 2014 to 2017, is an American proprietary software company focused on online ...
as
memory-resident virus that infects all but small
com files, making them smaller. The reason for excluding small programs is that their infected versions will be bigger than their originals.
References
Computer viruses