How do computer virus work: a basic understanding

The word “virus” is commonly used for all malicious programs, but the answer to “How do computer virus work” is here as precisely virus is a program or code that assigns itself to a legitimate, executable part of the software, and then reproduces itself when that program is run.

How do computer virus work: a basic understanding

How viruses work

In early times viruses were used for digital infection and attach to some famous programs like games. It was started when infected games is installed and run in the system.when any legitimate program started viruses run their function too. The virus inserts itself into memory and find another program in the disk.

If it found any open program, it adds the virus’s code to it and modifies it to an unsuspecting program. At that time viruses run their real program and user cannot know whats going on. Unfortunately, the virus has made its multiple copies and infect other programs.

A new chain of infection starts when affected programs are transfers to other people through floppy disc or other means and same viral code infect host files, that’s how a computer virus spread.

The first part of spreading a computer virus is the infection phase. Viruses wouldn’t be so hateful if they just limit themselves to the replicative phase. Unfortunately, most viruses enter into the destructive phase in which they manipulate orignal files and documents and sometimes hardware parts of system too.

Some kind of commands would trigger the attack phase and then viruses manifest their show. The trigger might be a specific date, or the number of times the virus has been replicated, or something similar.

To make their attack successful virus creators learned more tricks and started making program more sophisticated. One important trick to remain virus functionable was the insertion of the virus into its memory.

They have used another trick to insert a virus into the boot system. The boot sector is the first part of the operating system that the computer loads.

The boot sector contains a tiny program that commands the computer how to load the rest of the operating system. By putting its code in the boot sector, a virus can guarantee it gets executed. It can load itself into memory immediately, and it is able to run whenever the computer is on.

First virus from Pakistan

Amjad Alvi and his younger brother Basit Alvi are renowned for writing the first free-range PC virus that went viral in an age before the internet. But he’s done so much more.

It was a time before the internet came to be what we know it as today. Most IBM personal computers ran on MS-DOS and data was stored on 5.25-inch floppy disks, which could store 160 kilobytes of files.

It was on one such disk that Amjad had copied the ‘Brain Virus’ or, the Pakistani Brain, which became the first viral computer infestation the world had seen. 

“An NGO wanted us to write a patient management programme. But they were paying us very little. So I copied Brain on to their floppy and explicitly told them not to give it to anyone,” said Amjad. 

Despite his warning the infected floppy was apparently shared, copied and the virus started to move and take on a life of its own. 

The self-replicating virus that automatically copied onto the disks spread like wildfire. Students came across it on disks in the universities of Pittsburgh, Pennsylvania, Delaware and George Washington University. 

Everyone knew the name of the culprit because Amjad had put his address and phone number in between the code along with this message:  

“WELCOME TO DUNGEON…Beware of this Virus…Contact Us for Vaccination” 

Viral computer infestations jumped tenfold from 3,000 in the first two months of 1988 to around 30,000 in its last two months, a US-based software trade organisation noted at the time. 

No history of computer viruses is complete without mention of the Pakistani Brain. It was the Brain that gave the idea to some programmers to write the first anti-virus software.

In the late 1960s, students at the Massachusetts Institute of Technology wrote a computer programme they called the “Cookie”.

Amjad says before writing Brain, he and some of his friends had modified Cookie into a programme which told stories if the computer was left idle for a few minutes. 

“Initially DOS didn’t give you the option of multitasking. Then they included a new procedure in the code called Terminate and Stay Resident, which basically allowed you to push a programme to the background and pull it back without terminating it,” said Amjad. 

Brain was a BOOT Sector Virus and loaded onto the computer from the infected floppy when it was switched on — without the user ever finding out. 

“It was seen as sophisticated for its time by the use of relocation of the boot sector rather than overwriting it, and by marking the moved boot sector as unavailable on the disk,” Gene Spafford, a cyber security expert, told TRT World

Among the people who were awed by the novelty of its code was a software engineer named John McAfee, the eccentric US millionaire and guru of the anti-virus industry. And he called the Alvi brothers geniuses.