Last time
- Buffer overflow defenses (and workarounds)
- Format string vulnerabilities
- Integer overflow vulnerabilities
Buffer
- verflows
We finished up
and other memory safety vulnerabilities
By looking at
Buffer Overflow overflows Defenses and other memory safety - - PowerPoint PPT Presentation
Last time We finished up By looking at Buffer Overflow overflows Defenses and other memory safety vulnerabilities Buffer overflow defenses (and workarounds) Format string vulnerabilities Integer overflow vulnerabilities This time
We finished up
and other memory safety vulnerabilities
By looking at
Getting sick with Continuing with
clicking/installing
Malicious code that is stored on and runs on a victim’s system
clicking/installing
Malicious code that is stored on and runs on a victim’s system Potentially from any mode of interaction (automated
What can it do?
When does it run?
executed
immediately executed
executed
immediately executed
The line between these is thin and blurry Some malware uses both styles
possible
possible
due to user action
How viruses infect other programs
Original program
Entry point
How viruses infect other programs
Original program
Entry point
Original program
Virus
Entry point
Take over the entry point
Viruses are classified by what they infect
Viruses are classified by what they infect
Viruses are classified by what they infect
code into memory and runs it
Viruses are classified by what they infect
code into memory and runs it
Viruses have resulted in a technological arms race
The key is evasion
Viruses have resulted in a technological arms race
The key is evasion Mechanisms for evasive propagation
Viruses have resulted in a technological arms race
The key is evasion Mechanisms for evasive propagation Mechanisms for detection and prevention
Viruses have resulted in a technological arms race
The key is evasion Mechanisms for evasive propagation Mechanisms for detection and prevention
Viruses have resulted in a technological arms race
The key is evasion Mechanisms for evasive propagation Mechanisms for detection and prevention
Want to be able to claim wide coverage for a long time Want to be able to claim the ability to detect many viruses
Increase chances by attaching malicious code to something a user is likely to run
autorun.exe
known virus
dollar antivirus market
and competition
Um.. thanks?
How viruses infect other programs
Original program
Entry point
Original program
Virus
Entry point
“Appending”
How viruses infect other programs
Original program
Entry point
Original program
Entry point jmp jmp
Original program
Virus
Entry point
“Appending” “Surrounding”
Original program
Entry point
etc.
How viruses infect other programs
Original program
Entry point
Original program
Entry point jmp jmp
Original program
Virus
Entry point
“Appending” “Surrounding”
Overwrite uncommonly used parts of the program
Original program
Entry point
etc.
How viruses infect other programs
Original program
Entry point
Original program
Entry point jmp jmp
Original program
Virus
Entry point
“Appending” Confuse scanners “Surrounding”
Overwrite uncommonly used parts of the program
Getting sick with Continuing with
Mechanize code changes: Goal: every time you inject your code, it looks different
Virus
Original program
Entry point
Take over the entry point
Virus
Virus
Original program
Entry point
Take over the entry point
Virus
Encrypted virus code Key Decrypter
Original program
Entry point
Take over the entry point
Virus
Encrypted virus code Key Decrypter
Original program
Entry point
Take over the entry point
Key Decrypter
jmp
Virus code
Key Encrypted virus code Decrypter Virus code Key Decrypter Encryptor
jmp
Key Encrypted virus code Decrypter Virus code Key Decrypter Encryptor Key 2 Encrypted virus code (same code, but each time you encrypt it looks different) Decrypter
jmp
Key Encrypted virus code Decrypter Virus code Key Decrypter Encryptor Key 2 Encrypted virus code (same code, but each time you encrypt it looks different) Decrypter
When used properly, encryption will yield a different, random
invocation
jmp
Crypting service
code
Crypting service
code
Crypting service
AV AV AV AV AV AV Many different vendors
code
Crypting service
AV AV AV AV AV AV Many different vendors code
code
Crypting service
AV AV AV AV AV AV Many different vendors detected code
code
Crypting service
AV AV AV AV AV AV Many different vendors Iteratively obfuscate the code (encrypt + jmp + …) detected code
code
Crypting service
AV AV AV AV AV AV Many different vendors Iteratively obfuscate the code (encrypt + jmp + …)
code
Crypting service
AV AV AV AV AV AV Many different vendors Iteratively obfuscate the code (encrypt + jmp + …) CoDe
code
Crypting service
AV AV AV AV AV AV Many different vendors Iteratively obfuscate the code (encrypt + jmp + …) CoDe clear
code
Crypting service
AV AV AV AV AV AV Many different vendors Iteratively obfuscate the code (encrypt + jmp + …) Until the obfuscated code is “fully undetectable” CoDe clear
code
Crypting service
AV AV AV AV AV AV Many different vendors “FUD” code Iteratively obfuscate the code (encrypt + jmp + …) Until the obfuscated code is “fully undetectable” CoDe clear
code
Crypting service
AV AV AV AV AV AV Many different vendors “FUD” code Iteratively obfuscate the code (encrypt + jmp + …)
2013: Web-based crippling services One charged $20 to “remain undetected for more than 7 days”
Until the obfuscated code is “fully undetectable” CoDe clear
Now you are the antivirus writer: how do you detect?
code to see if it decrypts.
which do something similar (decompression)?
Now you are the antivirus writer: how do you detect?
code to see if it decrypts.
which do something similar (decompression)?
Now you are the antivirus writer: how do you detect? Now you are the virus writer again: how do you evade?
decrypters
number of decrypters
semantically different version of the code
semantically different version of the code
just never run it)
When can AV software successfully scan?
When can AV software successfully scan?
behavior
safe environment, like gdb or a virtual machine)
signature
see if it matches the signature
proper behavioral signature)
(e.g., gdb) and act differently
proper behavioral signature)
(e.g., gdb) and act differently
Attackers have the upper hand: AV systems hand out signatures, thus serving as an oracle
Putting it all together sounds hard
Putting it all together sounds hard
So how much malware is out there?
easy to miscount viruses
How do we clean up an infection?
Optional reading for this lecture: “Hunting for Metamorphic” “A History of Computer Viruses — The Famous ‘Trio’”
Required reading for next time:
“How to 0wn the Internet in your Spare Time”
Going digging for Continuing with
& virus case studies