6.3 Virus and Worm Concepts
Introduction to Viruses
- A virus is a self-replicating program that produces its own copy by attaching itself to another program, computer boot sector or document.
- Viruses are generally transmitted through file downloads, infected disk/flash drives and as email attachments.
- Virus Characteristics:
- Infects other program
- Transforms itself
- Encrypts itself
- Alters data
- Corrupts files and programs
Stages of Virus Life
- Design: Developing virus code using programming languages or construction kits.
- Replication: Virus replicates for a period of time within the target system and then spreads itself.
- Launch: It gets activated with the user performing certain actions such as running an infected program.
- Detection: A virus is identified as threat infecting target systems.
- Incorporation: Antivirus software developers assimilate defenses against the virus.
- Elimination: Users install antivirus updates and eliminate the virus threats.
Working of Viruses: Infection Phase and Attack Phase
- Infection Phase:
- In the infection phase, the virus replicates itself and attaches to an .exe file in the system.
- Attack Phase:
- Viruses are programmed with trigger events to activate and corrupt systems.
- Some viruses infect each time they are run and others infect only when a certain predefined condition is met such as user's specific task, a day, time, or a particular event.
Why Do People Create Computer Viruses
- Inflict damage to competitors
- Financial benefits
- Research projects
- Play prank
- Cyber terrorism
- Distribute political messages
Indications of Virus Attack
- Abnormal Activities: If the system acts in an unprecedented manner, you can suspect a virus attack.
- Processes take more resources and time
- Computer beeps with no display
- Drive label changes
- Unable to load Operating system
- Anti-virus alerts
- Browser window "freezes"
- Hard drive is accessed often
- Files and folders are missing
- Computer freezes frequently or encounters error
- Computer slows down when programs start
- False Positives: However, not all glitches can be attributed to virus attacks.
How does a Computer Get Infected by Viruses
- When a user accepts files and downloads without checking properly for the source.
- Opening infected e-mail attachments.
- Installing pirated software.
- Not updating and not installing new versions of plug-ins.
- Not running the latest anti-virus application.
Virus Hoaxes and Fake Antiviruses
- Hoaxes are false alarms claiming reports about a non-existing virus which may contain virus attachments.
- Warning messages propagating that a certain email message should not be viewed and doing so will damage one's system.
- Attackers disguise malwares as an antivirus and trick users to install them in their systems.
- Once installed these fake antiviruses can damage target systems similar to other malwares.
Q1) You receive an e-mail with the following text message.
"Microsoft and HP today warned all customers that a new, highly dangerous virus has been discovered which will erase all your files at midnight. If there's a file called hidserv.exe on your computer, you have been infected and your computer is now running a hidden server that allows hackers to access your computer. Delete the file immediately. Please also pass this message to all your friends and colleagues as soon as possible."
You launch your antivirus software and scan the suspicious looking file hidserv.exe located in c:\windows directory and the AV comes out clean meaning the file is not infected. You view the file signature and confirm that it is a legitimate Windows system file "Human Interface Device Service". What category of virus is this?
- Virus hoax
- Spooky Virus
- Stealth Virus
- Polymorphic Virus
- Ransomware is a type of a malware which restricts access to the computer system's files and folders and demands an online ransom payment to the malware creator(s) in order to remove the restrictions.
- Ransomware Family:
- Cryptorbit Ransomware
- CryptoLocker Ransomware
- CryptoDefense Ransomware
- CryptoWall Ransomware
- Police-themed Ransomware
Q1) It is a kind of malware (malicious software) that criminals install on your computer so they can lock it from a remote location. This malware generates a pop-up windows, webpage, or email warning from what looks like an official authority. It explains your computer has been locked because of possible illegal activities and demands payment before you can access your files and programs again. Which term best matches this definition?
Riskware (風險軟體): 是一種合法軟體，但本身存在嚴重安全性問題，會被惡意軟體利用來對電腦造成傷害。
Types of Viruses
- System or Boot Sector Viruses
- File and Multipartite Viruses
- Macro Viruses
- Cluster Viruses
- Stealth/Tunneling Viruses
- Encryption Viruses
- Metamorphic Viruses
- File Overwriting or Cavity Viruses
- Spare Infector Viruses
- Companion/Camouflage Viruses
- Shell Viruses
- File Extension Viruses
- Add-on and Intrusive Viruses
- Transient and Terminate and Stay Resident Viruses
System or Boot Sector Viruses
- Boot sector virus moves MBR to another location on the hard disk and copies itself to the original location of MBR.
- When system boots, virus code is executed first and then control is passed to original MBR.
- 開機磁區病毒：病毒是放在開機磁區的一種病毒。當電腦試著去讀取和執行開機磁區的程式時，病毒會附著在電腦的記憶體內，等到機會成熟時感染其他的電腦，也就是從這裡延伸到其他磁碟區。開機程式再被執行時，病毒也再次被執行， 又再一次散佈到其他磁區上。
Q1) Which of the following items of a computer system will an anti-virus program scan for viruses?
- Boot Sector
- Deleted Files
- Windows Process List
- Password Protected Files
Q2) Which of the following describes the characteristics of a Boot Sector Virus?
- Moves the MBR to another location on the RAM and copies itself to the original location of the MBR
- Moves the MBR to another location on the hard disk and copies itself to the original location of the MBR
- Modifies directory table entries so that directory entries point to the virus code instead of the actual program
- Overwrites the original MBR and only executes the new virus code
File and Multipartite Viruses (重要)
- File Viruses:
- File viruses infect files which are executed or interpreted in the system such as COM, EXE, SYS, OVL, OBJ, PRG, MNU and BAT files.
- File viruses can be either direct-action (non-resident) or memory-resident.
- Multipartite Virus:
- Multipartite viruses infect the system boot sector and the executable files at the same time.
Multipartite Virus具有多重散播途徑：可同時感染boot sector與executable files
Q1) A virus that can cause multiple infections is know as what type of virus?
A1) A multipartite virus can cause multiple infections.
- Macro viruses infect files created by Microsoft Word or Excel.
- Most macro viruses are written using macro language Visual Basic for Applications (VBA).
- Macro viruses infect templates or convert infected documents into template files, while maintaining their appearance of ordinary document files.
Q1) Which of the following programs is usually targeted at Microsoft Office products?
- Polymorphic virus
- Multipart virus
- Macro virus
- Stealth virus
Q2) Melissa is a virus that attacks Microsoft Windows platforms. To which category does this virus belong?
- Boot Sector infector
A2) The Melissa macro virus propagates in the form of an email message containing an infected Word document as an attachment.
Q3) The Melissa virus exploited security problems in Microsoft Excel and Word. What type of virus was it?
A3) Macro viruses, like Melissa, take advantage of macro functionality in files.
Q4) A user has just reported that he downloaded a file from a prospective client using IM. The user indicates that the file was called account.doc. The system has been behaving unusually since he downloaded the file. What is the most likely event that occurred?
- Your user inadvertently downloaded a macro virus using IM.
- Your user may have a defective hard drive.
- Your user is imagining what cannot be and is therefore mistaken.
- The system is suffering from power surges.
A4) The file itself is a Microsoft Word file and as such can have VBA macros embedded into it that can be used to deliver macro viruses.
- Cluster viruses modify directory table entries so that it points users or system processes to the virus code instead of the actual program.
- There is only once copy of the virus on the disk infecting all the programs in the computer system.
- It will launch itself first when any program on the computer system is started and then the control is passed to actual program.
- These viruses evade the anti-virus software by intercepting its requests to the operating system.
- A virus can hide itself by intercepting the anti-virus software's request to read the file and passing the request to the virus, instead of the OS.
- The virus can then return an uninfected version of the file to the anti-virus software, so that it appears as if the file is "clean".
Q1) Which of the following viruses tries to hide from anti-virus programs by actively altering and corrupting the chosen service call interruptions when they are being run?
- Cavity virus
- Polymorphic virus
- Tunneling virus
- Stealth virus (Stealth與Tunneling是不一樣的)
- This type of virus uses simple encryption to encipher the code.
- The virus is encrypted with a different key for each infected file.
- AV scanner cannot directly detect these types of viruses using signature detection methods.
- Polymorphic code is a code that mutates while keeping the original algorithm intact.
- To enable polymorphic code, the virus has to have a polymorphic engine (also called mutating engine or mutation engine).
- A well-written polymorphic virus therefore has no parts that stay the same on each infection.
Q1) ViruXine.W32 virus hides their presence by changing the underlying executable code. This Virus code mutates while keeping the original algorithm intact, the code changes itself each time it runs, but the function of the code (its semantics) will not change at all. What is this technique called?
- Polymorphic Virus
- Metamorphic Virus
- Dravidic Virus
- Stealth Virus
Q2) June, a security analyst, understands that a polymorphic virus has the ability to mutate and can change its known viral signature and hide from signature-based antivirus programs. Can June use an antivirus program in this case and would it be effective against a polymorphic virus?
- Yes. June can use an antivirus program since it compares the parity bit of executable files to the database of known check sum counts and it is effective on a polymorphic virus
- Yes. June can use an antivirus program since it compares the signatures of executable files to the database of known viral signatures and it is very effective against a polymorphic virus
- No. June can't use an antivirus program since it compares the signatures of executable files to the database of known viral signatures and in the case the polymorphic viruses cannot be detected by a signature-based anti-virus program
- No. June can't use an antivirus program since it compares the size of executable files to the database of known viral signatures and it is effective on a polymorphic virus
Q3) What type of virus modifies itself to avoid detection?
- Stealth virus
- Polymorphic virus
- Multipartite virus
- Armored virus
A3) A polymorphic virus modifies itself to evade detection.
Q4) Your client is confident that his enterprise antivirus protection software will eliminate and prevent malware in his system. Will this signature-based antivirus system protect against polymorphic viruses?
- Yes. No matter the virus, the generic signatures will catch it.
- Yes. All signature-based systems also use a heuristics engine to catch these.
- No. Because the system compares a signature to the executable, polymorphic viruses are not identified and quarantined.
- No, because the system compares file sizes to potential viruses and would catch the polymorphic that way.
A4) Polymorphic viruses constantly change their code in order to defeat the signature-based comparison of the executable.
Q5) A polymorphic virus _.
- Evades detection through backdoors
- Evades detection through heuristics
- Evades detection through rewriting itself
- Evades detection through luck
A5) A polymorphic virus evades detection through rewriting itself.
- Metamorphic Viruses: Metamorphic viruses rewrite themselves completely each time they are to infect new executable.
- Metamorphic Code: Metamorphic code can reprogram itself by translating its own code into a temporary representation and then back to the normal code again.
- Example: For example, E32/Simile consisted of over 14000 lines of assembly code, 90% of it is part of the metamorphic engine.
- ex: simile, zmist
- Mistfall is the first virus to use the technique called "code integration."
File Overwriting or Cavity Viruses
- Cavity Virus overwrites a part of the host file that is with a constant (usually nulls), without increasing the length or the file and preserving its functionality.
- CIH(Chernobyl or Spacefiller)
Sparse Infector Viruses
- Sparse Infector Virus: Sparse infector virus infects only occasionally (e.g. every tenth program executed), or only files whose lengths fall within a narrow range.
- Difficult to Detect: By infecting less often, such viruses try to minimize the probability of being discovered.
- Infection Process: For example, wake up on 15th of every month and execute code.
- 例：只感染最大只有128 kb容量大小的檔案或每月12日執行感染，減少被偵測的機會
Q1) A sparse infector virus __.
- Creates backdoors
- Infects data and executables
- Infects files selectively
- Rewrites itself
A1) A sparse infector evades detection by infecting only a handful or selection of files instead of all of them.
- A Companion virus creates a companion file for each executable file the virus infects.
- Therefore, a companion virus may save itself as notepad.com and every time a user executes notepad.exe (good program), the computer will load notepad.com (virus) and infect the system.
- Virus code forms a shell around the target host program's code, making itself the original program and host code as its sub-routine.
- Almost all boot program viruses are shell viruses.
感染後，都會先執行virus code，然後才執行original program
File Extension Viruses
- File extension viruses change the extensions of files.
- .TXT is safe as it indicates a pure text file.
- With extensions turned off, if someone sends you a file named BAD.TXT.VBS, you will only see BAD.TXT.
- If you have forgotten that extensions are turned off, you might think this is a text file and open it.
- This is an executable Visual Basic Script virus file and could do serious damage.
- Countermeasure is to turn off "Hide file extensions" in Windows.
另個攻擊手法：unicode RLO 反轉字元
Q1) You are trying to package a RAT Trojan so that Anti-Virus software will not detect it. Which of the listed technique will NOT be effective in evading Anti-Virus scanner?
- Convert the Trojan.exe file extension to Trojan.txt disguising as text file
- Break the Trojan into multiple smaller files and zip the individual pieces
- Change the content of the Trojan using hex editor and modify the checksum
- Encrypt the Trojan using multiple hashing algorithms like MD5 and SHA-1
Add-on and Intrusive Viruses
- Add-on Viruses: Add-on viruses append their code to the host code without making any changes to the latter or relocate the host code to insert their own code at the beginning.
- Intrusive Viruses: Intrusive viruses overwrite the host code partly or completely with the viral code.
Transient and Terminate and Stay Resident Viruses
Basic Infection Techniques:
- Direct Action or Transient Virus:
- Transfers all the controls of the host code to where it resides in the memory.
- The virus runs when the host code is run and terminates itself or exits memory as soon as the host code execution ends.
- Terminate and Stay Resident Virus (TSR):
- Remains permanently in the memory during the entire work session even after the target host's program is executed and terminated; can be removed only by rebooting the system.
- 根據lifetime可分為transient和resident based兩種:
- Direct Action or Transient Virus: 當被host執行時它才被載入到記憶體裡執行，當host終止時它也隨之終止
- Terminate and Stay Resident Virus (TSR): 當被感染時，病毒會永久存在記憶體裡。只有在重開機後才會被移除。
Writing a Simple Virus Program
Sam's Virus Generator and JPS Virus Maker
Andreinick05's Batch Virus Maker and DeadLine's Virus Maker
Sonic Bat - Batch FIle Virus Creator and Poison Virus Maker
- Computer worms are malicious programs that replicate, execute, and spread across the network connections independently without human interaction.
- Most of the worms are created only to replicate and spread across a network, consuming available computing resources; however, some worms carry a payload to damage the host system.
- Attackers use worm payload to install backdoors in infected computers, which turns them into zombies and creates botnet; these botnets can be used to carry further cyber attacks.
How is a Worm Different from a Virus?
- Replicates on its own: A worm is a special type of malware that can replicate itself and use memory, but cannot attach itself to other programs.
- Spreads through the Infected Network: A worm takes advantages of file or information transport features on computer systems and spread through the infected network automatically but a virus does not.
|Virus infects a system by inserting itselft into a file or executable program||Worm infects a system by exploiting a vulnerability in an OS or application by replicating itself|
|It might delete or alter content in files, or change the location of files in the system||Typically, a worm does not modify any stored programs. It only exploits the CPU and memory|
|It alters the way a computer system operates, without the knowledge or consent of a user||It consumes network bandwidth, system memory, etc., excessively overloading servers and computer systems|
|A virus cannot be spread to other computers unless an infected file is replicated and actually sent to the other computer||A worm, after being installed in a system, can replicate it selft and spread by using IRC, Outlook, or other applicable mailing programs|
|A virus is spread at a uniform speed, as programmed||A worm spreads more rapidly than a virus|
|Viruses are hard to remove from infected machines||As compared with a virus, a worm can be easily removed from a system|
Q1) Which of the following is one of the key features found in a worm but not seen in a virus?
- The payload is very small,usually below 800 bytes.
- It is self replicating without need for user intervention.
- It does not have the ability to propagate on its own.
- All of them cannot be detected by virus scanners.
A1) A worm is similar to a virus by its design,and is considered to be a sub-class of a virus. Worms spread from computer to computer,but unlike a virus,it has the capability to travel without any help from a person. A worm takes advantage of file or information transport features on your system,which allows it to travel unaided.
Q2) What are worms typically known for?
- Rapid replication
- Configuration changes
- Identity theft
A2) Worms are typically known for extremely rapid replication rates once they are released into the wild.
Computer Worms: Ghost Eye Worm
- Ghost Eye worm is a hacking program that spreads random messages on Facebook or steam or chat websites to get the password.