Companion Viruses

Dos makes running a program very easy. All you have to do is type in the name of the program. Dos will workout, from the extension, what type of program, Exe, Com or bat, it is and how to execute it. But what happens if you have two files with the same name but different extensions, eg Fred.Exe and Fred.Com.

Well, if they are in different directories then Dos will execute which ever is first on the path.

However, if they are in the same directory the Dos will execute the .Com file.

Companion viruses make use of this feature. What they do is copy themselves into a directory with a .Exe program and give themselves the same name as the .Exe but with a .Com extension. Then when you execute the program you actually execute the virus. Naturally once the virus has executed it will run the original program.