Hey od1,
QUOTE
But far as I'm aware (correct me if im wrong) the point I was getting at with the second point was if they incorrectly replace the mbr code
0
|---MBR---|------------rest
This is correct.
QUOTE
Virus...
|-malcode-|-MBR-
This is impossible. The BIOS is hardcoded to look at the first sector/cluster on the harddisc to read the code telling him what the disc looks like (as in number of partitions, the size of them, where they begin, etc.) What an MBR virus does is change the entry point. Once the virus has changed the MBR it looks a bit like this
0
|---MBR--*|bs (disc c:)------------rest|viral code---^|-------- rest
*: Jump to start of viral code;
^: Jump to bootsector (in this case (bs (disc c:))
What happens during startup is this:
* BIOS reads the hardware and finds out that there is a hard disc.
* BIOS asks harddisc what is on it by reading the Master Boot Record. Master Boot Record contains a jump to somewhere else on the disc, and apart from telling the BIOS that there is a partition called C it also executes the viral code executed at the position the MBR told the BIOS. After the viral code is executed the BIOS jumps back to the MBR and goes on its merry way.
* BIOS does all other sorts of checks and proceeds to boot up the hard disc known as C: by jumping to the bootsector for C:
Only sector 0 of the physical disc is hard coded to be the Master Boot Record. It doesn't matter what is in it. Normally sector 0 contains the address of where the Boot Record code is situated and ready to be executed. When the MBR gets infected, the virus changes the address to point to itself and remembers the original address that was in it. Now the computer reads sector 0, executes virus and the virus jumps to the original MBR. The same method of working is done in the bootsector of logical discs like C or E. The computer boots up the logical disc reads their "sector 0", finds the adress of the boot code and goes there to execute. What happens during FIXMBR or FDISK is that the adress that should have been in that first sector is being put back in, so that the computer does not execute the viral code next time. Reboot and you're "virusfree". It is physically on the disc but is rendered harmless.