Computer Viruses Preetha Annamalai Niranjan Potnis.

23
Computer Viruses Preetha Annamalai Niranjan Potnis

Transcript of Computer Viruses Preetha Annamalai Niranjan Potnis.

Page 1: Computer Viruses Preetha Annamalai Niranjan Potnis.

Computer Viruses

Preetha Annamalai

Niranjan Potnis

Page 2: Computer Viruses Preetha Annamalai Niranjan Potnis.

Outline

Computer Viruses – The Fundamentals

The Modus Operandi of a Virus

Virus Behavior and Symptoms

Virus Detection -The “Heuristic” Approach

A Sample Virus Code

Page 3: Computer Viruses Preetha Annamalai Niranjan Potnis.

What is a Computer Virus ?

A malicious piece of executable code written with not so noble intentions

Attaches itself to executable files

Loads into memory and then kicks off

Replication – a key operation

Page 4: Computer Viruses Preetha Annamalai Niranjan Potnis.

The Vulnerable Areas!

EXE and COM files.

Macros in Word.

System sectors on Hard disk / Floppy disk

Scripts for Internet /Email.

Page 5: Computer Viruses Preetha Annamalai Niranjan Potnis.

Virus Types

File Infectors .COM, .EXE files

Modify entry point of file

Execute self first

System Sector Viruses Sectors contain boot time executable code

Boot Sector, MBR

Relocate boot code

Page 6: Computer Viruses Preetha Annamalai Niranjan Potnis.

Virus Types

Macro Viruses infect data files execute on opening a document modify global macro template

Worms do not attach to host files/programs rapidly replicate over network can execute in a distributed fashion use up network bandwidth

Page 7: Computer Viruses Preetha Annamalai Niranjan Potnis.

Modus Operandi

Infection Phase

Attack Phase

Page 8: Computer Viruses Preetha Annamalai Niranjan Potnis.

Infection Phase

The spreading of the virus Based on specific trigger/executionTrigger condition – disk access/copying a file/a day or time. Intention is to spread as far as possible before detectionAct as TSR’s and can reside on any part of memory.

Page 9: Computer Viruses Preetha Annamalai Niranjan Potnis.

Attack Phase

Actual function is performed

Needs a trigger

Typical attacks –• Deleting files• Formats/damages disk• Slowing down the system

Use up system resources, damages disk

Optional phase : Viruses may infect but not attack (due to poorly written virus code)

Page 10: Computer Viruses Preetha Annamalai Niranjan Potnis.

Virus Symptoms

Change in length of .exe or .com files.

Change in the file date/time stamp

Change to interrupt vectors

Reassignment of system resources

Reduction in amount of memory normally shown

Page 11: Computer Viruses Preetha Annamalai Niranjan Potnis.

Virus Detection and Prevention

Anti-virus software

Two Approaches

Pattern Matching Approach

The “Heuristic Approach”

Page 12: Computer Viruses Preetha Annamalai Niranjan Potnis.

Conventional Pattern Matching Approach

Concept of “virus signature”

Look for virus byte sequence in a file to be scanned

Compare against a signature data file

Pattern match has to be literal

Problems – Detection of viruses not in data file

Data file has to be updated.

Viruses change the characteristic byte code from computer to computer

Page 13: Computer Viruses Preetha Annamalai Niranjan Potnis.

Heuristic Approach

“Speculation and Investigation”

Analyze program structure and behavior instead of looking for signature.

How about an analogy ?

Scan file for suspicious code

Does a file have virus-like characteristics ?

Page 14: Computer Viruses Preetha Annamalai Niranjan Potnis.

Using Heuristics Content Filtering

Like a “flexible” pattern matching approachKeep track of numerous ways to program virus like codeNeed additional criteria for detection

SandboxingRun suspicious code in protected space within the systemKeep track of operating system callsCompare them to a user defined policy

Page 15: Computer Viruses Preetha Annamalai Niranjan Potnis.

A Typical Heuristic scanner

Determines most likely location of the virus

Analyze program logic contained in that region

What are the computer instructions capable of doing ?

Catalog a programs behavior

Page 16: Computer Viruses Preetha Annamalai Niranjan Potnis.

Typical Heuristic Scanner

Many ways to write the same program

Example:

Routine to terminate itself and return to DOS prompt

• Simple Approach

• Roundabout Approach

Page 17: Computer Viruses Preetha Annamalai Niranjan Potnis.

Typical Heuristic Scanner

MACHINE LANGUAGE USER-READABLE BYTES INSTRUCTIONSExample 1:

B8 00 4C MOV AX,4C00

CD 21 INT 21Example 2:

B4 3C MOV AH,3C BB 00 00 MOV BX, 0000 88 D8 MOV AL,BL 80 C4 10 ADD AH,10 8E C3 MOV ES,BX

9C PUSH F 26 ES FF 1E 84 00 CALL FAR[0084]

Page 18: Computer Viruses Preetha Annamalai Niranjan Potnis.

Typical Heuristic Scanner

Maintain a database of byte sequencesAssociate each byte sequence with its functional behaviorCan use wildcards to match information that changes from virus to virus

Example-B8 ?? 4C CD 21 – Terminate Program(perm1)B4 4C CD 21 – Terminate Program(perm2)B8 02 3D BA ?? ?? CD 21 – Open file (perm1)BA ? ?? B8 02 3D CD 21 – Open file (perm2)

Page 19: Computer Viruses Preetha Annamalai Niranjan Potnis.

Heuristic Engine

Components of a Heuristic Scanner

Disassembler Heuristic Engine

Inference Engine

Emulator

Is Execution

Recommended?Program

Maintain set of registers

Scoring Formula

Page 20: Computer Viruses Preetha Annamalai Niranjan Potnis.

Some Virus Characteristics

Illicit writes to RAM

Undocumented Call

Hooks to standard interrupts

Calls to next instruction

Page 21: Computer Viruses Preetha Annamalai Niranjan Potnis.

Scoring Formula

Weight assigned to each virus characteristic depending on its strength

Net score assigned to file depending on the characteristics found and their count

Is Net-score higher than cut off value?

Page 22: Computer Viruses Preetha Annamalai Niranjan Potnis.

An Example Virus

The Michaelangelo Virus Code

Page 23: Computer Viruses Preetha Annamalai Niranjan Potnis.

Conclusion

Virus writers have too much time!

Heuristic approach is robust

Not totally reliable – subject to false positives and false negatives

Anti-virus software needs to be updated frequently