Cavity Viruses

A cavity virus attempts to install itself inside of the file it is infecting. This is difficult.

Most viruses take the easy way out when infecting files; they simply attach themselves to the end of the file and then change the start of the program so that it first points to the virus and then to the actual program code. Many viruses that do this also implement some stealth techniques so you don't see the increase in file length when the virus is active in memory.

A cavity virus, on the other hand, attempts to be clever. Some program files, for a variety of reasons, have empty space inside of them. This empty space can be used to house virus code. A cavity virus attempts to install itself in this empty space while not damaging the actual program itself. An advantage of this is that the virus then does not increase the length of the program and can avoid the need for some stealth techniques. The Lehigh virus was an early example of a cavity virus.

Because of the difficulty of writing this type of virus and the limited number of possible hosts, cavity viruses are rare.

Summary

A cavity virus attempts to install itself inside of the file it is infecting.

This is difficult to do properly and so this type of virus is rare.