172
OS Security Malware Radboud University, Nijmegen, The Netherlands Winter 2016/2017

OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

  • Upload
    others

  • View
    10

  • Download
    1

Embed Size (px)

Citation preview

Page 1: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

OS SecurityMalware

Radboud University, Nijmegen, The Netherlands

Winter 2016/2017

Page 2: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

A short recap

I Processes access memory through virtual addresses

I Mapping between virtual and physical addresses is (typically) donein hardware, but managed through the OS

I OS separates memory space of different processors

I Memory attack: Write shellcode to buffer, overflow buffer, overwritereturn address with pointer to shell code

I Countermeasure: NX (or W ⊕X)

I Advanced attack: return to libc, generalization: ROPI Countermeasure: Address Space Layout Randomization

OS Security – Malware 2

Page 3: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Ad-hoc solutions for better OS security

I Completely re-designing an OS is expensive

I More feasible: Add-on security for existing OS

I Multiple techniques:

I Memory protection (NX bit) and ASLR (last week)I Detect (or prevent) malware and intrusions (this lecture)I Add mandatory access control (next week)I Compartmentalization and virtualization (Dec 5 & 12)

OS Security – Malware 3

Page 4: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Ad-hoc solutions for better OS security

I Completely re-designing an OS is expensive

I More feasible: Add-on security for existing OS

I Multiple techniques:I Memory protection (NX bit) and ASLR (last week)

I Detect (or prevent) malware and intrusions (this lecture)I Add mandatory access control (next week)I Compartmentalization and virtualization (Dec 5 & 12)

OS Security – Malware 3

Page 5: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Ad-hoc solutions for better OS security

I Completely re-designing an OS is expensive

I More feasible: Add-on security for existing OS

I Multiple techniques:I Memory protection (NX bit) and ASLR (last week)I Detect (or prevent) malware and intrusions (this lecture)

I Add mandatory access control (next week)I Compartmentalization and virtualization (Dec 5 & 12)

OS Security – Malware 3

Page 6: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Ad-hoc solutions for better OS security

I Completely re-designing an OS is expensive

I More feasible: Add-on security for existing OS

I Multiple techniques:I Memory protection (NX bit) and ASLR (last week)I Detect (or prevent) malware and intrusions (this lecture)I Add mandatory access control (next week)

I Compartmentalization and virtualization (Dec 5 & 12)

OS Security – Malware 3

Page 7: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Ad-hoc solutions for better OS security

I Completely re-designing an OS is expensive

I More feasible: Add-on security for existing OS

I Multiple techniques:I Memory protection (NX bit) and ASLR (last week)I Detect (or prevent) malware and intrusions (this lecture)I Add mandatory access control (next week)I Compartmentalization and virtualization (Dec 5 & 12)

OS Security – Malware 3

Page 8: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware

DefinitionMalware is malicious software or functionality that a user does not intendto run.

I Typical features of malware:I Some way to trick the user into running it

I A damage routine (or payload) performing the actual maliciousbehavior

I Often a routine to spread to other computersI Often functionality to hide from malware scanners

I Different ways to categorize malware:I By their malicious behavior (what they do)I By their spreading routineI By privilege of the malicious code

OS Security – Malware 4

Page 9: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware

DefinitionMalware is malicious software or functionality that a user does not intendto run.

I Typical features of malware:I Some way to trick the user into running it

I A damage routine (or payload) performing the actual maliciousbehavior

I Often a routine to spread to other computersI Often functionality to hide from malware scanners

I Different ways to categorize malware:I By their malicious behavior (what they do)I By their spreading routineI By privilege of the malicious code

OS Security – Malware 4

Page 10: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware

DefinitionMalware is malicious software or functionality that a user does not intendto run.

I Typical features of malware:I Some way to trick the user into running itI A damage routine (or payload) performing the actual malicious

behavior

I Often a routine to spread to other computersI Often functionality to hide from malware scanners

I Different ways to categorize malware:I By their malicious behavior (what they do)I By their spreading routineI By privilege of the malicious code

OS Security – Malware 4

Page 11: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware

DefinitionMalware is malicious software or functionality that a user does not intendto run.

I Typical features of malware:I Some way to trick the user into running itI A damage routine (or payload) performing the actual malicious

behaviorI Often a routine to spread to other computers

I Often functionality to hide from malware scanners

I Different ways to categorize malware:I By their malicious behavior (what they do)I By their spreading routineI By privilege of the malicious code

OS Security – Malware 4

Page 12: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware

DefinitionMalware is malicious software or functionality that a user does not intendto run.

I Typical features of malware:I Some way to trick the user into running itI A damage routine (or payload) performing the actual malicious

behaviorI Often a routine to spread to other computersI Often functionality to hide from malware scanners

I Different ways to categorize malware:I By their malicious behavior (what they do)I By their spreading routineI By privilege of the malicious code

OS Security – Malware 4

Page 13: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware

DefinitionMalware is malicious software or functionality that a user does not intendto run.

I Typical features of malware:I Some way to trick the user into running itI A damage routine (or payload) performing the actual malicious

behaviorI Often a routine to spread to other computersI Often functionality to hide from malware scanners

I Different ways to categorize malware:I By their malicious behavior (what they do)I By their spreading routineI By privilege of the malicious code

OS Security – Malware 4

Page 14: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Viruses

I A virus infects a host program:I Copy itself into the host programI Change entry point to the entry point of the virusI Change the return address from the virus code to the original entry

point

I Characteristic for a virus: it spreads by infecting other files

I Viruses traditionally need an executable host file (e.g., .exe, .bat,.vbs)

I More general: can also infect office files with macros (macro virus)

I The earliest viruses are from the 70s spreading in the ARPANET

I Originally most viruses spread over floppy disks

I Today obviously mainly spread over the Internet

OS Security – Malware 5

Page 15: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Viruses

I A virus infects a host program:I Copy itself into the host programI Change entry point to the entry point of the virusI Change the return address from the virus code to the original entry

point

I Characteristic for a virus: it spreads by infecting other files

I Viruses traditionally need an executable host file (e.g., .exe, .bat,.vbs)

I More general: can also infect office files with macros (macro virus)

I The earliest viruses are from the 70s spreading in the ARPANET

I Originally most viruses spread over floppy disks

I Today obviously mainly spread over the Internet

OS Security – Malware 5

Page 16: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Viruses

I A virus infects a host program:I Copy itself into the host programI Change entry point to the entry point of the virusI Change the return address from the virus code to the original entry

point

I Characteristic for a virus: it spreads by infecting other files

I Viruses traditionally need an executable host file (e.g., .exe, .bat,.vbs)

I More general: can also infect office files with macros (macro virus)

I The earliest viruses are from the 70s spreading in the ARPANET

I Originally most viruses spread over floppy disks

I Today obviously mainly spread over the Internet

OS Security – Malware 5

Page 17: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Viruses

I A virus infects a host program:I Copy itself into the host programI Change entry point to the entry point of the virusI Change the return address from the virus code to the original entry

point

I Characteristic for a virus: it spreads by infecting other files

I Viruses traditionally need an executable host file (e.g., .exe, .bat,.vbs)

I More general: can also infect office files with macros (macro virus)

I The earliest viruses are from the 70s spreading in the ARPANET

I Originally most viruses spread over floppy disks

I Today obviously mainly spread over the Internet

OS Security – Malware 5

Page 18: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Self-replicating code

I A virus needs to replicate (print) itself

I How do you write a program that prints itself?

I First attempt (in Python): print "print ‘hello’"

I Output: "print ‘hello’"

I Next attempt: s = ‘print %s’; print s % repr(s)

I Output: print ‘print %s’

I This works:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I Output:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I The central ingredient is recursion!

OS Security – Malware 6

Page 19: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Self-replicating code

I A virus needs to replicate (print) itself

I How do you write a program that prints itself?

I First attempt (in Python): print "print ‘hello’"

I Output: "print ‘hello’"

I Next attempt: s = ‘print %s’; print s % repr(s)

I Output: print ‘print %s’

I This works:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I Output:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I The central ingredient is recursion!

OS Security – Malware 6

Page 20: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Self-replicating code

I A virus needs to replicate (print) itself

I How do you write a program that prints itself?

I First attempt (in Python): print "print ‘hello’"

I Output: "print ‘hello’"

I Next attempt: s = ‘print %s’; print s % repr(s)

I Output: print ‘print %s’

I This works:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I Output:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I The central ingredient is recursion!

OS Security – Malware 6

Page 21: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Self-replicating code

I A virus needs to replicate (print) itself

I How do you write a program that prints itself?

I First attempt (in Python): print "print ‘hello’"

I Output: "print ‘hello’"

I Next attempt: s = ‘print %s’; print s % repr(s)

I Output: print ‘print %s’

I This works:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I Output:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I The central ingredient is recursion!

OS Security – Malware 6

Page 22: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Self-replicating code

I A virus needs to replicate (print) itself

I How do you write a program that prints itself?

I First attempt (in Python): print "print ‘hello’"

I Output: "print ‘hello’"

I Next attempt: s = ‘print %s’; print s % repr(s)

I Output: print ‘print %s’

I This works:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I Output:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I The central ingredient is recursion!

OS Security – Malware 6

Page 23: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Self-replicating code

I A virus needs to replicate (print) itself

I How do you write a program that prints itself?

I First attempt (in Python): print "print ‘hello’"

I Output: "print ‘hello’"

I Next attempt: s = ‘print %s’; print s % repr(s)

I Output: print ‘print %s’

I This works:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I Output:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I The central ingredient is recursion!

OS Security – Malware 6

Page 24: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Self-replicating code

I A virus needs to replicate (print) itself

I How do you write a program that prints itself?

I First attempt (in Python): print "print ‘hello’"

I Output: "print ‘hello’"

I Next attempt: s = ‘print %s’; print s % repr(s)

I Output: print ‘print %s’

I This works:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I Output:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I The central ingredient is recursion!

OS Security – Malware 6

Page 25: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Self-replicating code

I A virus needs to replicate (print) itself

I How do you write a program that prints itself?

I First attempt (in Python): print "print ‘hello’"

I Output: "print ‘hello’"

I Next attempt: s = ‘print %s’; print s % repr(s)

I Output: print ‘print %s’

I This works:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I Output:s = ‘s = %s; print s %% repr(s)’; print s % repr(s)

I The central ingredient is recursion!

OS Security – Malware 6

Page 26: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Worms

I A worm is a stand-alone malware program, which spreads without ahost program

I Two different ways of spreading:

1. With user interaction (e.g., by e-mail)2. Without user interaction through software vulnerabilities

OS Security – Malware 7

Page 27: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Worms

I A worm is a stand-alone malware program, which spreads without ahost program

I Two different ways of spreading:

1. With user interaction (e.g., by e-mail)2. Without user interaction through software vulnerabilities

OS Security – Malware 7

Page 28: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Worms

I A worm is a stand-alone malware program, which spreads without ahost program

I Two different ways of spreading:

1. With user interaction (e.g., by e-mail)2. Without user interaction through software vulnerabilities

I Famous example of the first type of worm: Loveletter (akaILOVEYOU)

I Worm that started spreading in May 2000I Spread by e-mail with subject line “I love you”I Read address book of infected host and sent to the address book

(from the user’s mail address)I Malicious Attachment had filename

LOVE-LETTER-FOR-YOU.TXT.vbs (Windows by default did notshow the vbs)

I Deleted all files ending on .jpg, .jpeg, .vbs, .vbe, .js, .jse, .css, .wsh,.sct and .hta and replaced them by a copy of itself (with additionalending .vbs)

I Caused an estimated damage of US$10, 000, 000, 000

OS Security – Malware 7

Page 29: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Worms

I A worm is a stand-alone malware program, which spreads without ahost program

I Two different ways of spreading:

1. With user interaction (e.g., by e-mail)2. Without user interaction through software vulnerabilities

I Famous example of the first type of worm: Loveletter (akaILOVEYOU)

I Worm that started spreading in May 2000I Spread by e-mail with subject line “I love you”I Read address book of infected host and sent to the address book

(from the user’s mail address)I Malicious Attachment had filename

LOVE-LETTER-FOR-YOU.TXT.vbs (Windows by default did notshow the vbs)

I Deleted all files ending on .jpg, .jpeg, .vbs, .vbe, .js, .jse, .css, .wsh,.sct and .hta and replaced them by a copy of itself (with additionalending .vbs)

I Caused an estimated damage of US$10, 000, 000, 000

OS Security – Malware 7

Page 30: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Worms

I A worm is a stand-alone malware program, which spreads without ahost program

I Two different ways of spreading:

1. With user interaction (e.g., by e-mail)2. Without user interaction through software vulnerabilities

I Example of the second type: SasserI Spread through a buffer overflow in the “Local Security Authority

Subsystem Service” (LSASS) in Windows XP and 2000I Communication through TCP on ports 445 and 139I Services running by default on Windows (and reachable from outside)

OS Security – Malware 7

Page 31: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Trojans

I Trojans offer useful functionality and hidden malicious functionality

I Unlike viruses and worms, trojans are not self-replicating

I Trojans can be used for a variety of criminal actions

I Trojans can be used for targeted attacks

I Trojans are also used by governments to wiretap Internet telephony

I Probably most famous example: German “Staatstrojaner” (akaR2D2 or 0zapftis)

I German police may use malware only to wiretap Internet telephonyI Staatstrojaner was analyzed by Chaos Computer Club in 2011I Staatstrojaner was found to allow remote control, capture

screenshots, fetch upgrades remotelyI Communication from the trojan was encrypted with AES in ECB

modeI Communication to the trojan was unencrypted!I Trojan was nicknamed R2D2 because the string “C3PO-r2d2-POE”

was found in its code

OS Security – Malware 8

Page 32: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Trojans

I Trojans offer useful functionality and hidden malicious functionality

I Unlike viruses and worms, trojans are not self-replicating

I Trojans can be used for a variety of criminal actions

I Trojans can be used for targeted attacks

I Trojans are also used by governments to wiretap Internet telephony

I Probably most famous example: German “Staatstrojaner” (akaR2D2 or 0zapftis)

I German police may use malware only to wiretap Internet telephonyI Staatstrojaner was analyzed by Chaos Computer Club in 2011I Staatstrojaner was found to allow remote control, capture

screenshots, fetch upgrades remotelyI Communication from the trojan was encrypted with AES in ECB

modeI Communication to the trojan was unencrypted!I Trojan was nicknamed R2D2 because the string “C3PO-r2d2-POE”

was found in its code

OS Security – Malware 8

Page 33: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Trojans

I Trojans offer useful functionality and hidden malicious functionality

I Unlike viruses and worms, trojans are not self-replicating

I Trojans can be used for a variety of criminal actions

I Trojans can be used for targeted attacks

I Trojans are also used by governments to wiretap Internet telephony

I Probably most famous example: German “Staatstrojaner” (akaR2D2 or 0zapftis)

I German police may use malware only to wiretap Internet telephonyI Staatstrojaner was analyzed by Chaos Computer Club in 2011I Staatstrojaner was found to allow remote control, capture

screenshots, fetch upgrades remotelyI Communication from the trojan was encrypted with AES in ECB

modeI Communication to the trojan was unencrypted!I Trojan was nicknamed R2D2 because the string “C3PO-r2d2-POE”

was found in its code

OS Security – Malware 8

Page 34: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Trojans

I Trojans offer useful functionality and hidden malicious functionality

I Unlike viruses and worms, trojans are not self-replicating

I Trojans can be used for a variety of criminal actions

I Trojans can be used for targeted attacks

I Trojans are also used by governments to wiretap Internet telephony

I Probably most famous example: German “Staatstrojaner” (akaR2D2 or 0zapftis)

I German police may use malware only to wiretap Internet telephonyI Staatstrojaner was analyzed by Chaos Computer Club in 2011

I Staatstrojaner was found to allow remote control, capturescreenshots, fetch upgrades remotely

I Communication from the trojan was encrypted with AES in ECBmode

I Communication to the trojan was unencrypted!I Trojan was nicknamed R2D2 because the string “C3PO-r2d2-POE”

was found in its code

OS Security – Malware 8

Page 35: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Trojans

I Trojans offer useful functionality and hidden malicious functionality

I Unlike viruses and worms, trojans are not self-replicating

I Trojans can be used for a variety of criminal actions

I Trojans can be used for targeted attacks

I Trojans are also used by governments to wiretap Internet telephony

I Probably most famous example: German “Staatstrojaner” (akaR2D2 or 0zapftis)

I German police may use malware only to wiretap Internet telephonyI Staatstrojaner was analyzed by Chaos Computer Club in 2011I Staatstrojaner was found to allow remote control, capture

screenshots, fetch upgrades remotelyI Communication from the trojan was encrypted with AES in ECB

mode

I Communication to the trojan was unencrypted!I Trojan was nicknamed R2D2 because the string “C3PO-r2d2-POE”

was found in its code

OS Security – Malware 8

Page 36: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Trojans

I Trojans offer useful functionality and hidden malicious functionality

I Unlike viruses and worms, trojans are not self-replicating

I Trojans can be used for a variety of criminal actions

I Trojans can be used for targeted attacks

I Trojans are also used by governments to wiretap Internet telephony

I Probably most famous example: German “Staatstrojaner” (akaR2D2 or 0zapftis)

I German police may use malware only to wiretap Internet telephonyI Staatstrojaner was analyzed by Chaos Computer Club in 2011I Staatstrojaner was found to allow remote control, capture

screenshots, fetch upgrades remotelyI Communication from the trojan was encrypted with AES in ECB

modeI Communication to the trojan was unencrypted!

I Trojan was nicknamed R2D2 because the string “C3PO-r2d2-POE”was found in its code

OS Security – Malware 8

Page 37: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Trojans

I Trojans offer useful functionality and hidden malicious functionality

I Unlike viruses and worms, trojans are not self-replicating

I Trojans can be used for a variety of criminal actions

I Trojans can be used for targeted attacks

I Trojans are also used by governments to wiretap Internet telephony

I Probably most famous example: German “Staatstrojaner” (akaR2D2 or 0zapftis)

I German police may use malware only to wiretap Internet telephonyI Staatstrojaner was analyzed by Chaos Computer Club in 2011I Staatstrojaner was found to allow remote control, capture

screenshots, fetch upgrades remotelyI Communication from the trojan was encrypted with AES in ECB

modeI Communication to the trojan was unencrypted!I Trojan was nicknamed R2D2 because the string “C3PO-r2d2-POE”

was found in its code

OS Security – Malware 8

Page 38: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits

I After compromising a computer, malware (or attackers) typically tryto hide their traces

I Software that hides traces of an attack is called rootkit

I Most powerful: rootkits running in the kernel:I Can hide existence of files by modifying the file-system driverI Can hide existence of processes by modifying process managementI Can create hidden filesytem to store dataI Can temper with malware scanners

I Can communicate via covert channels

I Any information flow not considered by the reference monitor is acovert channel.

I Examples: Existence of a file, file access permissions, CPU usage,temperature sensor

I (i) Timing Channels (e.g. CPU load)I (ii) Storage Channels (e.g. existence of files)

OS Security – Malware 9

Page 39: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits

I After compromising a computer, malware (or attackers) typically tryto hide their traces

I Software that hides traces of an attack is called rootkit

I Most powerful: rootkits running in the kernel:I Can hide existence of files by modifying the file-system driverI Can hide existence of processes by modifying process managementI Can create hidden filesytem to store dataI Can temper with malware scanners

I Can communicate via covert channels

I Any information flow not considered by the reference monitor is acovert channel.

I Examples: Existence of a file, file access permissions, CPU usage,temperature sensor

I (i) Timing Channels (e.g. CPU load)I (ii) Storage Channels (e.g. existence of files)

OS Security – Malware 9

Page 40: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits

I After compromising a computer, malware (or attackers) typically tryto hide their traces

I Software that hides traces of an attack is called rootkit

I Most powerful: rootkits running in the kernel:I Can hide existence of files by modifying the file-system driverI Can hide existence of processes by modifying process managementI Can create hidden filesytem to store dataI Can temper with malware scannersI Can communicate via covert channels

I Any information flow not considered by the reference monitor is acovert channel.

I Examples: Existence of a file, file access permissions, CPU usage,temperature sensor

I (i) Timing Channels (e.g. CPU load)I (ii) Storage Channels (e.g. existence of files)

OS Security – Malware 9

Page 41: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits

I After compromising a computer, malware (or attackers) typically tryto hide their traces

I Software that hides traces of an attack is called rootkit

I Most powerful: rootkits running in the kernel:I Can hide existence of files by modifying the file-system driverI Can hide existence of processes by modifying process managementI Can create hidden filesytem to store dataI Can temper with malware scannersI Can communicate via covert channels

I Any information flow not considered by the reference monitor is acovert channel.

I Examples: Existence of a file, file access permissions, CPU usage,temperature sensor

I (i) Timing Channels (e.g. CPU load)I (ii) Storage Channels (e.g. existence of files)

OS Security – Malware 9

Page 42: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits

I After compromising a computer, malware (or attackers) typically tryto hide their traces

I Software that hides traces of an attack is called rootkit

I Most powerful: rootkits running in the kernel:I Can hide existence of files by modifying the file-system driverI Can hide existence of processes by modifying process managementI Can create hidden filesytem to store dataI Can temper with malware scannersI Can communicate via covert channels

I Any information flow not considered by the reference monitor is acovert channel.

I Examples: Existence of a file, file access permissions, CPU usage,temperature sensor

I (i) Timing Channels (e.g. CPU load)I (ii) Storage Channels (e.g. existence of files)

OS Security – Malware 9

Page 43: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits

I After compromising a computer, malware (or attackers) typically tryto hide their traces

I Software that hides traces of an attack is called rootkit

I Most powerful: rootkits running in the kernel:I Can hide existence of files by modifying the file-system driverI Can hide existence of processes by modifying process managementI Can create hidden filesytem to store dataI Can temper with malware scannersI Can communicate via covert channels

I Any information flow not considered by the reference monitor is acovert channel.

I Examples: Existence of a file, file access permissions, CPU usage,temperature sensor

I (i) Timing Channels (e.g. CPU load)I (ii) Storage Channels (e.g. existence of files)

OS Security – Malware 9

Page 44: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits (continued)

I Possible countermeasure: cryptographically sign all kernel modulesand drivers

I This went horribly wrong with Flame in 2012

I Flame tried to blend in with legitimate Microsoft applications bycloaking itself with an older cryptography algorithm that Microsoftused to digitally sign programs

I Weaknesses in the MD5 hash function allowed malware to obtainvalid signature

I Can detect and remove a kernel rootkit only when booting anotherclean OS

OS Security – Malware 10

Page 45: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits (continued)

I Possible countermeasure: cryptographically sign all kernel modulesand drivers

I This went horribly wrong with Flame in 2012

I Flame tried to blend in with legitimate Microsoft applications bycloaking itself with an older cryptography algorithm that Microsoftused to digitally sign programs

I Weaknesses in the MD5 hash function allowed malware to obtainvalid signature

I Can detect and remove a kernel rootkit only when booting anotherclean OS

OS Security – Malware 10

Page 46: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits (continued)

I Possible countermeasure: cryptographically sign all kernel modulesand drivers

I This went horribly wrong with Flame in 2012I Flame tried to blend in with legitimate Microsoft applications by

cloaking itself with an older cryptography algorithm that Microsoftused to digitally sign programs

I Weaknesses in the MD5 hash function allowed malware to obtainvalid signature

I Can detect and remove a kernel rootkit only when booting anotherclean OS

OS Security – Malware 10

Page 47: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits (continued)

I Possible countermeasure: cryptographically sign all kernel modulesand drivers

I This went horribly wrong with Flame in 2012I Flame tried to blend in with legitimate Microsoft applications by

cloaking itself with an older cryptography algorithm that Microsoftused to digitally sign programs

I Weaknesses in the MD5 hash function allowed malware to obtainvalid signature

I Can detect and remove a kernel rootkit only when booting anotherclean OS

OS Security – Malware 10

Page 48: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Bootkits

I Malware can compromise the boot process of a computer

I Rootkits that modify the bootloader are called bootkits

I Bootkits are typically installed in the MBR of the hard drive

I Bootkits can make sure to re-infect a computer at each reboot

OS Security – Malware 11

Page 49: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Firmware malwareI So far, malware was in software (user space, kernel space, boot

loader)

I How about firmware malware?

I Close to impossible to detect (or remove) by malware scanners

I Survives full re-installation of the operating system

I Example 1: badBIOS (malware infecting the BIOS)

I Example 2: badUSB (malicious USB device firmware)

I Example 3: IRATEMONK (NSA malware to infect harddrivefirmware)http://leaksource.files.wordpress.com/2013/12/

nsa-ant-iratemonk.jpg

I Impressive piece of work on firmware malware: DAGGERI Infects computer through Intel’s Advanced Management Technology

(AMT)I Includes keylogger, sends all keystrokes over the networkI Operating system cannot see any of thisI For a great talk, see

http://www.youtube.com/watch?v=Ck8bIjAUJgE

OS Security – Malware 12

Page 50: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Firmware malwareI So far, malware was in software (user space, kernel space, boot

loader)

I How about firmware malware?

I Close to impossible to detect (or remove) by malware scanners

I Survives full re-installation of the operating system

I Example 1: badBIOS (malware infecting the BIOS)

I Example 2: badUSB (malicious USB device firmware)

I Example 3: IRATEMONK (NSA malware to infect harddrivefirmware)http://leaksource.files.wordpress.com/2013/12/

nsa-ant-iratemonk.jpg

I Impressive piece of work on firmware malware: DAGGERI Infects computer through Intel’s Advanced Management Technology

(AMT)I Includes keylogger, sends all keystrokes over the networkI Operating system cannot see any of thisI For a great talk, see

http://www.youtube.com/watch?v=Ck8bIjAUJgE

OS Security – Malware 12

Page 51: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Firmware malwareI So far, malware was in software (user space, kernel space, boot

loader)

I How about firmware malware?

I Close to impossible to detect (or remove) by malware scanners

I Survives full re-installation of the operating system

I Example 1: badBIOS (malware infecting the BIOS)

I Example 2: badUSB (malicious USB device firmware)

I Example 3: IRATEMONK (NSA malware to infect harddrivefirmware)http://leaksource.files.wordpress.com/2013/12/

nsa-ant-iratemonk.jpg

I Impressive piece of work on firmware malware: DAGGERI Infects computer through Intel’s Advanced Management Technology

(AMT)I Includes keylogger, sends all keystrokes over the networkI Operating system cannot see any of thisI For a great talk, see

http://www.youtube.com/watch?v=Ck8bIjAUJgE

OS Security – Malware 12

Page 52: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Firmware malwareI So far, malware was in software (user space, kernel space, boot

loader)

I How about firmware malware?

I Close to impossible to detect (or remove) by malware scanners

I Survives full re-installation of the operating system

I Example 1: badBIOS (malware infecting the BIOS)

I Example 2: badUSB (malicious USB device firmware)

I Example 3: IRATEMONK (NSA malware to infect harddrivefirmware)http://leaksource.files.wordpress.com/2013/12/

nsa-ant-iratemonk.jpg

I Impressive piece of work on firmware malware: DAGGERI Infects computer through Intel’s Advanced Management Technology

(AMT)I Includes keylogger, sends all keystrokes over the networkI Operating system cannot see any of thisI For a great talk, see

http://www.youtube.com/watch?v=Ck8bIjAUJgE

OS Security – Malware 12

Page 53: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Firmware malwareI So far, malware was in software (user space, kernel space, boot

loader)

I How about firmware malware?

I Close to impossible to detect (or remove) by malware scanners

I Survives full re-installation of the operating system

I Example 1: badBIOS (malware infecting the BIOS)

I Example 2: badUSB (malicious USB device firmware)

I Example 3: IRATEMONK (NSA malware to infect harddrivefirmware)http://leaksource.files.wordpress.com/2013/12/

nsa-ant-iratemonk.jpg

I Impressive piece of work on firmware malware: DAGGERI Infects computer through Intel’s Advanced Management Technology

(AMT)I Includes keylogger, sends all keystrokes over the networkI Operating system cannot see any of thisI For a great talk, see

http://www.youtube.com/watch?v=Ck8bIjAUJgE

OS Security – Malware 12

Page 54: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Firmware malwareI So far, malware was in software (user space, kernel space, boot

loader)

I How about firmware malware?

I Close to impossible to detect (or remove) by malware scanners

I Survives full re-installation of the operating system

I Example 1: badBIOS (malware infecting the BIOS)

I Example 2: badUSB (malicious USB device firmware)

I Example 3: IRATEMONK (NSA malware to infect harddrivefirmware)http://leaksource.files.wordpress.com/2013/12/

nsa-ant-iratemonk.jpg

I Impressive piece of work on firmware malware: DAGGERI Infects computer through Intel’s Advanced Management Technology

(AMT)I Includes keylogger, sends all keystrokes over the networkI Operating system cannot see any of thisI For a great talk, see

http://www.youtube.com/watch?v=Ck8bIjAUJgE

OS Security – Malware 12

Page 55: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Firmware malwareI So far, malware was in software (user space, kernel space, boot

loader)

I How about firmware malware?

I Close to impossible to detect (or remove) by malware scanners

I Survives full re-installation of the operating system

I Example 1: badBIOS (malware infecting the BIOS)

I Example 2: badUSB (malicious USB device firmware)

I Example 3: IRATEMONK (NSA malware to infect harddrivefirmware)http://leaksource.files.wordpress.com/2013/12/

nsa-ant-iratemonk.jpg

I Impressive piece of work on firmware malware: DAGGERI Infects computer through Intel’s Advanced Management Technology

(AMT)I Includes keylogger, sends all keystrokes over the networkI Operating system cannot see any of thisI For a great talk, see

http://www.youtube.com/watch?v=Ck8bIjAUJgE

OS Security – Malware 12

Page 56: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware functionality

I Can also classify malware by its damage routines:

I Many worms and viruses turn infected computers into botnet zombiehosts

I Primary target: obtain network for DOS attacks and spamming

I Ransomware encrypts part of the harddrive, requests money fordecryption key

I Spyware is used to exfiltrate information (e.g., banking data)

I Dialer were used to dial expensive numbers from the modem (notcommon anymore)

I Targeted malware can have very specific damage routines

I Example: Stuxnet sabotaged the Iranian nuclear program

I Finally, some malware just destroys data (digital vandalism)

OS Security – Malware 13

Page 57: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware functionality

I Can also classify malware by its damage routines:

I Many worms and viruses turn infected computers into botnet zombiehosts

I Primary target: obtain network for DOS attacks and spamming

I Ransomware encrypts part of the harddrive, requests money fordecryption key

I Spyware is used to exfiltrate information (e.g., banking data)

I Dialer were used to dial expensive numbers from the modem (notcommon anymore)

I Targeted malware can have very specific damage routines

I Example: Stuxnet sabotaged the Iranian nuclear program

I Finally, some malware just destroys data (digital vandalism)

OS Security – Malware 13

Page 58: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware functionality

I Can also classify malware by its damage routines:

I Many worms and viruses turn infected computers into botnet zombiehosts

I Primary target: obtain network for DOS attacks and spamming

I Ransomware encrypts part of the harddrive, requests money fordecryption key

I Spyware is used to exfiltrate information (e.g., banking data)

I Dialer were used to dial expensive numbers from the modem (notcommon anymore)

I Targeted malware can have very specific damage routines

I Example: Stuxnet sabotaged the Iranian nuclear program

I Finally, some malware just destroys data (digital vandalism)

OS Security – Malware 13

Page 59: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware functionality

I Can also classify malware by its damage routines:

I Many worms and viruses turn infected computers into botnet zombiehosts

I Primary target: obtain network for DOS attacks and spamming

I Ransomware encrypts part of the harddrive, requests money fordecryption key

I Spyware is used to exfiltrate information (e.g., banking data)

I Dialer were used to dial expensive numbers from the modem (notcommon anymore)

I Targeted malware can have very specific damage routines

I Example: Stuxnet sabotaged the Iranian nuclear program

I Finally, some malware just destroys data (digital vandalism)

OS Security – Malware 13

Page 60: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware functionality

I Can also classify malware by its damage routines:

I Many worms and viruses turn infected computers into botnet zombiehosts

I Primary target: obtain network for DOS attacks and spamming

I Ransomware encrypts part of the harddrive, requests money fordecryption key

I Spyware is used to exfiltrate information (e.g., banking data)

I Dialer were used to dial expensive numbers from the modem (notcommon anymore)

I Targeted malware can have very specific damage routines

I Example: Stuxnet sabotaged the Iranian nuclear program

I Finally, some malware just destroys data (digital vandalism)

OS Security – Malware 13

Page 61: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware functionality

I Can also classify malware by its damage routines:

I Many worms and viruses turn infected computers into botnet zombiehosts

I Primary target: obtain network for DOS attacks and spamming

I Ransomware encrypts part of the harddrive, requests money fordecryption key

I Spyware is used to exfiltrate information (e.g., banking data)

I Dialer were used to dial expensive numbers from the modem (notcommon anymore)

I Targeted malware can have very specific damage routines

I Example: Stuxnet sabotaged the Iranian nuclear program

I Finally, some malware just destroys data (digital vandalism)

OS Security – Malware 13

Page 62: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware functionality

I Can also classify malware by its damage routines:

I Many worms and viruses turn infected computers into botnet zombiehosts

I Primary target: obtain network for DOS attacks and spamming

I Ransomware encrypts part of the harddrive, requests money fordecryption key

I Spyware is used to exfiltrate information (e.g., banking data)

I Dialer were used to dial expensive numbers from the modem (notcommon anymore)

I Targeted malware can have very specific damage routines

I Example: Stuxnet sabotaged the Iranian nuclear program

I Finally, some malware just destroys data (digital vandalism)

OS Security – Malware 13

Page 63: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware detection

I Idea: look at incoming files before they are stored on the hard drive

I Scan for malware, stop if malware detected

I Alternative: full scan of all files on the hard drive

I Important malware-scanner characteristics:I Detection rate: percentage of malware that is detectedI Undetected malware is called false negatives

I Files that are incorrectly classified as malware are false positivesI Typical requirement: no false positives!

I Mainly two techniques to detect malware:I Signature-based detection: Look for known patterns in filesI Behavior-based detection: Analyse behavior and make decision

OS Security – Malware 14

Page 64: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware detection

I Idea: look at incoming files before they are stored on the hard drive

I Scan for malware, stop if malware detected

I Alternative: full scan of all files on the hard drive

I Important malware-scanner characteristics:I Detection rate: percentage of malware that is detectedI Undetected malware is called false negatives

I Files that are incorrectly classified as malware are false positivesI Typical requirement: no false positives!

I Mainly two techniques to detect malware:I Signature-based detection: Look for known patterns in filesI Behavior-based detection: Analyse behavior and make decision

OS Security – Malware 14

Page 65: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware detection

I Idea: look at incoming files before they are stored on the hard drive

I Scan for malware, stop if malware detected

I Alternative: full scan of all files on the hard drive

I Important malware-scanner characteristics:I Detection rate: percentage of malware that is detectedI Undetected malware is called false negativesI Files that are incorrectly classified as malware are false positivesI Typical requirement: no false positives!

I Mainly two techniques to detect malware:I Signature-based detection: Look for known patterns in filesI Behavior-based detection: Analyse behavior and make decision

OS Security – Malware 14

Page 66: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Malware detection

I Idea: look at incoming files before they are stored on the hard drive

I Scan for malware, stop if malware detected

I Alternative: full scan of all files on the hard drive

I Important malware-scanner characteristics:I Detection rate: percentage of malware that is detectedI Undetected malware is called false negativesI Files that are incorrectly classified as malware are false positivesI Typical requirement: no false positives!

I Mainly two techniques to detect malware:I Signature-based detection: Look for known patterns in filesI Behavior-based detection: Analyse behavior and make decision

OS Security – Malware 14

Page 67: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Signature-based malware detection

I Signature-based malware detection only detects known malware

I Essential requirement: update the signature database daily

I Still cannot detect zero-day (next-generation) malware

I Signatures can be as simple as a cryptographic hash or sequence ofsystem calls

I Typically look for certain code sequences (less susceptible to minorchanges)

I Generally powerful technique against known malware

I Used by all major anti-malware software

OS Security – Malware 15

Page 68: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Signature-based malware detection

I Signature-based malware detection only detects known malware

I Essential requirement: update the signature database daily

I Still cannot detect zero-day (next-generation) malware

I Signatures can be as simple as a cryptographic hash or sequence ofsystem calls

I Typically look for certain code sequences (less susceptible to minorchanges)

I Generally powerful technique against known malware

I Used by all major anti-malware software

OS Security – Malware 15

Page 69: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Signature-based malware detection

I Signature-based malware detection only detects known malware

I Essential requirement: update the signature database daily

I Still cannot detect zero-day (next-generation) malware

I Signatures can be as simple as a cryptographic hash or sequence ofsystem calls

I Typically look for certain code sequences (less susceptible to minorchanges)

I Generally powerful technique against known malware

I Used by all major anti-malware software

OS Security – Malware 15

Page 70: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Code polymorphism

I Idea to defeat signature-based malware detection: polymorphic code

I Use automated engine to generate many versions of a virus

I All have the same functionality, but look different

I In principle there is an infite number of ways to mutate a programand keep functionality

I Trivial example: insert NOP instructions

I More advanced: permute independent instructions

I Can even check that polymorphic versions are not detected

I Useful tools, e.g., VirusTotal(https://www.virustotal.com/en/),IDA Pro(https://www.hex-rays.com/products/ida/index.shtml)

I More advanced: self-mutating code (metamorphism)

I Virus that prints mutated copies of itself

OS Security – Malware 16

Page 71: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Code polymorphism

I Idea to defeat signature-based malware detection: polymorphic code

I Use automated engine to generate many versions of a virus

I All have the same functionality, but look different

I In principle there is an infite number of ways to mutate a programand keep functionality

I Trivial example: insert NOP instructions

I More advanced: permute independent instructions

I Can even check that polymorphic versions are not detected

I Useful tools, e.g., VirusTotal(https://www.virustotal.com/en/),IDA Pro(https://www.hex-rays.com/products/ida/index.shtml)

I More advanced: self-mutating code (metamorphism)

I Virus that prints mutated copies of itself

OS Security – Malware 16

Page 72: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Code polymorphism

I Idea to defeat signature-based malware detection: polymorphic code

I Use automated engine to generate many versions of a virus

I All have the same functionality, but look different

I In principle there is an infite number of ways to mutate a programand keep functionality

I Trivial example: insert NOP instructions

I More advanced: permute independent instructions

I Can even check that polymorphic versions are not detected

I Useful tools, e.g., VirusTotal(https://www.virustotal.com/en/),IDA Pro(https://www.hex-rays.com/products/ida/index.shtml)

I More advanced: self-mutating code (metamorphism)

I Virus that prints mutated copies of itself

OS Security – Malware 16

Page 73: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Code polymorphism

I Idea to defeat signature-based malware detection: polymorphic code

I Use automated engine to generate many versions of a virus

I All have the same functionality, but look different

I In principle there is an infite number of ways to mutate a programand keep functionality

I Trivial example: insert NOP instructions

I More advanced: permute independent instructions

I Can even check that polymorphic versions are not detected

I Useful tools, e.g., VirusTotal(https://www.virustotal.com/en/),IDA Pro(https://www.hex-rays.com/products/ida/index.shtml)

I More advanced: self-mutating code (metamorphism)

I Virus that prints mutated copies of itself

OS Security – Malware 16

Page 74: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Code polymorphism

I Idea to defeat signature-based malware detection: polymorphic code

I Use automated engine to generate many versions of a virus

I All have the same functionality, but look different

I In principle there is an infite number of ways to mutate a programand keep functionality

I Trivial example: insert NOP instructions

I More advanced: permute independent instructions

I Can even check that polymorphic versions are not detected

I Useful tools, e.g., VirusTotal(https://www.virustotal.com/en/),IDA Pro(https://www.hex-rays.com/products/ida/index.shtml)

I More advanced: self-mutating code (metamorphism)

I Virus that prints mutated copies of itself

OS Security – Malware 16

Page 75: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Packers

I Other technique to evade malware detection: packers

I Packer: A piece of software that takes the original malware andcompresses it, thus making all the original code and dataunreadable.

I At runtime, a wrapper program will take the packed program anddecompress it in memory, revealing the program’s original code.

I Packing can be simple XOR or bit-flipping or advanced encryptionwith AES

I Can even use multiple layers of packing

I Can also unpack (decrypt) blockwise, such that full malware is neverin memory

I Essentially two ways to detect packed malware:

I Static detection: Try known packers on the payloadI Dynamic detection: Run the malware (including unpacking routine)

itself in a safe environment (sandbox)

I An interesting research area

OS Security – Malware 17

Page 76: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Packers

I Other technique to evade malware detection: packers

I Packer: A piece of software that takes the original malware andcompresses it, thus making all the original code and dataunreadable.

I At runtime, a wrapper program will take the packed program anddecompress it in memory, revealing the program’s original code.

I Packing can be simple XOR or bit-flipping or advanced encryptionwith AES

I Can even use multiple layers of packing

I Can also unpack (decrypt) blockwise, such that full malware is neverin memory

I Essentially two ways to detect packed malware:

I Static detection: Try known packers on the payloadI Dynamic detection: Run the malware (including unpacking routine)

itself in a safe environment (sandbox)

I An interesting research area

OS Security – Malware 17

Page 77: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Packers

I Other technique to evade malware detection: packers

I Packer: A piece of software that takes the original malware andcompresses it, thus making all the original code and dataunreadable.

I At runtime, a wrapper program will take the packed program anddecompress it in memory, revealing the program’s original code.

I Packing can be simple XOR or bit-flipping or advanced encryptionwith AES

I Can even use multiple layers of packing

I Can also unpack (decrypt) blockwise, such that full malware is neverin memory

I Essentially two ways to detect packed malware:

I Static detection: Try known packers on the payloadI Dynamic detection: Run the malware (including unpacking routine)

itself in a safe environment (sandbox)

I An interesting research area

OS Security – Malware 17

Page 78: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Packers

I Other technique to evade malware detection: packers

I Packer: A piece of software that takes the original malware andcompresses it, thus making all the original code and dataunreadable.

I At runtime, a wrapper program will take the packed program anddecompress it in memory, revealing the program’s original code.

I Packing can be simple XOR or bit-flipping or advanced encryptionwith AES

I Can even use multiple layers of packing

I Can also unpack (decrypt) blockwise, such that full malware is neverin memory

I Essentially two ways to detect packed malware:

I Static detection: Try known packers on the payloadI Dynamic detection: Run the malware (including unpacking routine)

itself in a safe environment (sandbox)

I An interesting research area

OS Security – Malware 17

Page 79: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Packers

I Other technique to evade malware detection: packers

I Packer: A piece of software that takes the original malware andcompresses it, thus making all the original code and dataunreadable.

I At runtime, a wrapper program will take the packed program anddecompress it in memory, revealing the program’s original code.

I Packing can be simple XOR or bit-flipping or advanced encryptionwith AES

I Can even use multiple layers of packing

I Can also unpack (decrypt) blockwise, such that full malware is neverin memory

I Essentially two ways to detect packed malware:

I Static detection: Try known packers on the payloadI Dynamic detection: Run the malware (including unpacking routine)

itself in a safe environment (sandbox)

I An interesting research area

OS Security – Malware 17

Page 80: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Packers

I Other technique to evade malware detection: packers

I Packer: A piece of software that takes the original malware andcompresses it, thus making all the original code and dataunreadable.

I At runtime, a wrapper program will take the packed program anddecompress it in memory, revealing the program’s original code.

I Packing can be simple XOR or bit-flipping or advanced encryptionwith AES

I Can even use multiple layers of packing

I Can also unpack (decrypt) blockwise, such that full malware is neverin memory

I Essentially two ways to detect packed malware:I Static detection: Try known packers on the payloadI Dynamic detection: Run the malware (including unpacking routine)

itself in a safe environment (sandbox)

I An interesting research area

OS Security – Malware 17

Page 81: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Packers

I Other technique to evade malware detection: packers

I Packer: A piece of software that takes the original malware andcompresses it, thus making all the original code and dataunreadable.

I At runtime, a wrapper program will take the packed program anddecompress it in memory, revealing the program’s original code.

I Packing can be simple XOR or bit-flipping or advanced encryptionwith AES

I Can even use multiple layers of packing

I Can also unpack (decrypt) blockwise, such that full malware is neverin memory

I Essentially two ways to detect packed malware:I Static detection: Try known packers on the payloadI Dynamic detection: Run the malware (including unpacking routine)

itself in a safe environment (sandbox)

I An interesting research area

OS Security – Malware 17

Page 82: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Moving to the GPU

I Usually malware (and the packer) runs on the CPUI Idea to hide from scanners: use the Graphics Processing Unit (GPU)

for unpackingI Proof-of-concept presented by Vasiliadis, Polychronakis, and

Ioannidis in 2010: “GPU assisted malware”

I Problem for static detection:I Malware can use computational power of the GPU for unpackingI Trying to unpack on the CPU causes significant slowdown

I Problem for dynamic detection:I Sandboxes don’t support GPU binariesI Cannot run the malware in a safe environment

I Obviously, the GPU can also be used for malware detection(signature matching)

I Seamans and Alexander described GPU extension to ClamAV in 2007I Speedup of signature detection on Nvidia GTX 7800 compared to

3-GHz Pentium 4:I 27× for 0% match rateI 17× for 1% match rateI 11× for 50% match rate

OS Security – Malware 18

Page 83: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Moving to the GPU

I Usually malware (and the packer) runs on the CPUI Idea to hide from scanners: use the Graphics Processing Unit (GPU)

for unpackingI Proof-of-concept presented by Vasiliadis, Polychronakis, and

Ioannidis in 2010: “GPU assisted malware”I Problem for static detection:

I Malware can use computational power of the GPU for unpackingI Trying to unpack on the CPU causes significant slowdown

I Problem for dynamic detection:I Sandboxes don’t support GPU binariesI Cannot run the malware in a safe environment

I Obviously, the GPU can also be used for malware detection(signature matching)

I Seamans and Alexander described GPU extension to ClamAV in 2007I Speedup of signature detection on Nvidia GTX 7800 compared to

3-GHz Pentium 4:I 27× for 0% match rateI 17× for 1% match rateI 11× for 50% match rate

OS Security – Malware 18

Page 84: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Moving to the GPU

I Usually malware (and the packer) runs on the CPUI Idea to hide from scanners: use the Graphics Processing Unit (GPU)

for unpackingI Proof-of-concept presented by Vasiliadis, Polychronakis, and

Ioannidis in 2010: “GPU assisted malware”I Problem for static detection:

I Malware can use computational power of the GPU for unpackingI Trying to unpack on the CPU causes significant slowdown

I Problem for dynamic detection:I Sandboxes don’t support GPU binariesI Cannot run the malware in a safe environment

I Obviously, the GPU can also be used for malware detection(signature matching)

I Seamans and Alexander described GPU extension to ClamAV in 2007I Speedup of signature detection on Nvidia GTX 7800 compared to

3-GHz Pentium 4:I 27× for 0% match rateI 17× for 1% match rateI 11× for 50% match rate

OS Security – Malware 18

Page 85: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Moving to the GPU

I Usually malware (and the packer) runs on the CPUI Idea to hide from scanners: use the Graphics Processing Unit (GPU)

for unpackingI Proof-of-concept presented by Vasiliadis, Polychronakis, and

Ioannidis in 2010: “GPU assisted malware”I Problem for static detection:

I Malware can use computational power of the GPU for unpackingI Trying to unpack on the CPU causes significant slowdown

I Problem for dynamic detection:I Sandboxes don’t support GPU binariesI Cannot run the malware in a safe environment

I Obviously, the GPU can also be used for malware detection(signature matching)

I Seamans and Alexander described GPU extension to ClamAV in 2007I Speedup of signature detection on Nvidia GTX 7800 compared to

3-GHz Pentium 4:I 27× for 0% match rateI 17× for 1% match rateI 11× for 50% match rate

OS Security – Malware 18

Page 86: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Behavior-based malware detection

I Approach to detect unknown (variants of) malware: behaviors (orheuristics)

I Simple case: use wildcards in signatures

I Advanced case: run the malware in a safe environment (virtualmachine, sandbox), study behavior

I Behavior analysis relies on experience

I Good at detecting malware with behavior that “has been seenbefore”

I Typically not good at detecting really new malware

I Certainly not reliable at detecting new malware

OS Security – Malware 19

Page 87: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Behavior-based malware detection

I Approach to detect unknown (variants of) malware: behaviors (orheuristics)

I Simple case: use wildcards in signatures

I Advanced case: run the malware in a safe environment (virtualmachine, sandbox), study behavior

I Behavior analysis relies on experience

I Good at detecting malware with behavior that “has been seenbefore”

I Typically not good at detecting really new malware

I Certainly not reliable at detecting new malware

OS Security – Malware 19

Page 88: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Behavior-based malware detection

I Approach to detect unknown (variants of) malware: behaviors (orheuristics)

I Simple case: use wildcards in signatures

I Advanced case: run the malware in a safe environment (virtualmachine, sandbox), study behavior

I Behavior analysis relies on experience

I Good at detecting malware with behavior that “has been seenbefore”

I Typically not good at detecting really new malware

I Certainly not reliable at detecting new malware

OS Security – Malware 19

Page 89: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus software (AV) can’t hurt, or can it?

I Common security recommendation for end users: “Use a malwarescanner (AV) and keep it up to date”

I “Wisdom” behind this recommendation: AV certainly makes securitybetter (even if it doesn’t detect everything)

I Multiple problems with this wisdom:

1. AV software can seriously degrade system performance2. False positives can break system functionality3. AV software is highly trusted (needs privileged access), but not

necessarily trustworthy4. Users may feel secure and behave less carefully5. AV software can actively degrade security (e.g. Kaspersky):

I Kaspersky has man-in-the-middle functionality for SSL connectionsI Kaspersky still speaks SSL 3.0 (although the browser may have it

disabled)I SSL 3.0 is vulnerable to the POODLE attackI POODLE - Padding Oracle On Downgraded Legacy EncryptionI MiTM attack exploiting web browser vulnerability when web browsers

and servers will downgrade to SSL 3.0 if there are problemsnegotiating a TLS session

OS Security – Malware 20

Page 90: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus software (AV) can’t hurt, or can it?

I Common security recommendation for end users: “Use a malwarescanner (AV) and keep it up to date”

I “Wisdom” behind this recommendation: AV certainly makes securitybetter (even if it doesn’t detect everything)

I Multiple problems with this wisdom:

1. AV software can seriously degrade system performance

2. False positives can break system functionality3. AV software is highly trusted (needs privileged access), but not

necessarily trustworthy4. Users may feel secure and behave less carefully5. AV software can actively degrade security (e.g. Kaspersky):

I Kaspersky has man-in-the-middle functionality for SSL connectionsI Kaspersky still speaks SSL 3.0 (although the browser may have it

disabled)I SSL 3.0 is vulnerable to the POODLE attackI POODLE - Padding Oracle On Downgraded Legacy EncryptionI MiTM attack exploiting web browser vulnerability when web browsers

and servers will downgrade to SSL 3.0 if there are problemsnegotiating a TLS session

OS Security – Malware 20

Page 91: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus software (AV) can’t hurt, or can it?

I Common security recommendation for end users: “Use a malwarescanner (AV) and keep it up to date”

I “Wisdom” behind this recommendation: AV certainly makes securitybetter (even if it doesn’t detect everything)

I Multiple problems with this wisdom:

1. AV software can seriously degrade system performance2. False positives can break system functionality

3. AV software is highly trusted (needs privileged access), but notnecessarily trustworthy

4. Users may feel secure and behave less carefully5. AV software can actively degrade security (e.g. Kaspersky):

I Kaspersky has man-in-the-middle functionality for SSL connectionsI Kaspersky still speaks SSL 3.0 (although the browser may have it

disabled)I SSL 3.0 is vulnerable to the POODLE attackI POODLE - Padding Oracle On Downgraded Legacy EncryptionI MiTM attack exploiting web browser vulnerability when web browsers

and servers will downgrade to SSL 3.0 if there are problemsnegotiating a TLS session

OS Security – Malware 20

Page 92: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus software (AV) can’t hurt, or can it?

I Common security recommendation for end users: “Use a malwarescanner (AV) and keep it up to date”

I “Wisdom” behind this recommendation: AV certainly makes securitybetter (even if it doesn’t detect everything)

I Multiple problems with this wisdom:

1. AV software can seriously degrade system performance2. False positives can break system functionality3. AV software is highly trusted (needs privileged access), but not

necessarily trustworthy

4. Users may feel secure and behave less carefully5. AV software can actively degrade security (e.g. Kaspersky):

I Kaspersky has man-in-the-middle functionality for SSL connectionsI Kaspersky still speaks SSL 3.0 (although the browser may have it

disabled)I SSL 3.0 is vulnerable to the POODLE attackI POODLE - Padding Oracle On Downgraded Legacy EncryptionI MiTM attack exploiting web browser vulnerability when web browsers

and servers will downgrade to SSL 3.0 if there are problemsnegotiating a TLS session

OS Security – Malware 20

Page 93: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus software (AV) can’t hurt, or can it?

I Common security recommendation for end users: “Use a malwarescanner (AV) and keep it up to date”

I “Wisdom” behind this recommendation: AV certainly makes securitybetter (even if it doesn’t detect everything)

I Multiple problems with this wisdom:

1. AV software can seriously degrade system performance2. False positives can break system functionality3. AV software is highly trusted (needs privileged access), but not

necessarily trustworthy4. Users may feel secure and behave less carefully

5. AV software can actively degrade security (e.g. Kaspersky):

I Kaspersky has man-in-the-middle functionality for SSL connectionsI Kaspersky still speaks SSL 3.0 (although the browser may have it

disabled)I SSL 3.0 is vulnerable to the POODLE attackI POODLE - Padding Oracle On Downgraded Legacy EncryptionI MiTM attack exploiting web browser vulnerability when web browsers

and servers will downgrade to SSL 3.0 if there are problemsnegotiating a TLS session

OS Security – Malware 20

Page 94: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus software (AV) can’t hurt, or can it?

I Common security recommendation for end users: “Use a malwarescanner (AV) and keep it up to date”

I “Wisdom” behind this recommendation: AV certainly makes securitybetter (even if it doesn’t detect everything)

I Multiple problems with this wisdom:

1. AV software can seriously degrade system performance2. False positives can break system functionality3. AV software is highly trusted (needs privileged access), but not

necessarily trustworthy4. Users may feel secure and behave less carefully5. AV software can actively degrade security (e.g. Kaspersky):

I Kaspersky has man-in-the-middle functionality for SSL connectionsI Kaspersky still speaks SSL 3.0 (although the browser may have it

disabled)I SSL 3.0 is vulnerable to the POODLE attackI POODLE - Padding Oracle On Downgraded Legacy EncryptionI MiTM attack exploiting web browser vulnerability when web browsers

and servers will downgrade to SSL 3.0 if there are problemsnegotiating a TLS session

OS Security – Malware 20

Page 95: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus software (AV) can’t hurt, or can it?

I Common security recommendation for end users: “Use a malwarescanner (AV) and keep it up to date”

I “Wisdom” behind this recommendation: AV certainly makes securitybetter (even if it doesn’t detect everything)

I Multiple problems with this wisdom:

1. AV software can seriously degrade system performance2. False positives can break system functionality3. AV software is highly trusted (needs privileged access), but not

necessarily trustworthy4. Users may feel secure and behave less carefully5. AV software can actively degrade security (e.g. Kaspersky):

I Kaspersky has man-in-the-middle functionality for SSL connectionsI Kaspersky still speaks SSL 3.0 (although the browser may have it

disabled)I SSL 3.0 is vulnerable to the POODLE attack

I POODLE - Padding Oracle On Downgraded Legacy EncryptionI MiTM attack exploiting web browser vulnerability when web browsers

and servers will downgrade to SSL 3.0 if there are problemsnegotiating a TLS session

OS Security – Malware 20

Page 96: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus software (AV) can’t hurt, or can it?

I Common security recommendation for end users: “Use a malwarescanner (AV) and keep it up to date”

I “Wisdom” behind this recommendation: AV certainly makes securitybetter (even if it doesn’t detect everything)

I Multiple problems with this wisdom:

1. AV software can seriously degrade system performance2. False positives can break system functionality3. AV software is highly trusted (needs privileged access), but not

necessarily trustworthy4. Users may feel secure and behave less carefully5. AV software can actively degrade security (e.g. Kaspersky):

I Kaspersky has man-in-the-middle functionality for SSL connectionsI Kaspersky still speaks SSL 3.0 (although the browser may have it

disabled)I SSL 3.0 is vulnerable to the POODLE attackI POODLE - Padding Oracle On Downgraded Legacy EncryptionI MiTM attack exploiting web browser vulnerability when web browsers

and servers will downgrade to SSL 3.0 if there are problemsnegotiating a TLS session

OS Security – Malware 20

Page 97: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Zip bombs

I Malware scanners (AV) needs to unpack zipped files

I Unpacked copy needs to sit somewhere in memory or on disk

I Can use this as attack against AV:I Create small zip file, which expands to huge unpacked dataI Can also use multiple levels of zipping

I Famous example: 42.zipI Packed size: 42 KBI Fully unpacked (after 5 levels of unzip): 4.5 PBI Expansion factor of >100,000,000,000

I Recall self-replicating code, how about a self replicating zip?

I Idea: create a zip file that contains itself

I Virus scanners will keep unpacking forever

I This exists, for details see http://research.swtch.com/zip

I Not restricted to zip, also works with gzip

OS Security – Malware 21

Page 98: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Zip bombs

I Malware scanners (AV) needs to unpack zipped files

I Unpacked copy needs to sit somewhere in memory or on disk

I Can use this as attack against AV:I Create small zip file, which expands to huge unpacked dataI Can also use multiple levels of zipping

I Famous example: 42.zipI Packed size: 42 KBI Fully unpacked (after 5 levels of unzip): 4.5 PBI Expansion factor of >100,000,000,000

I Recall self-replicating code, how about a self replicating zip?

I Idea: create a zip file that contains itself

I Virus scanners will keep unpacking forever

I This exists, for details see http://research.swtch.com/zip

I Not restricted to zip, also works with gzip

OS Security – Malware 21

Page 99: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Zip bombs

I Malware scanners (AV) needs to unpack zipped files

I Unpacked copy needs to sit somewhere in memory or on disk

I Can use this as attack against AV:I Create small zip file, which expands to huge unpacked dataI Can also use multiple levels of zipping

I Famous example: 42.zipI Packed size: 42 KBI Fully unpacked (after 5 levels of unzip): 4.5 PBI Expansion factor of >100,000,000,000

I Recall self-replicating code, how about a self replicating zip?

I Idea: create a zip file that contains itself

I Virus scanners will keep unpacking forever

I This exists, for details see http://research.swtch.com/zip

I Not restricted to zip, also works with gzip

OS Security – Malware 21

Page 100: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Zip bombs

I Malware scanners (AV) needs to unpack zipped files

I Unpacked copy needs to sit somewhere in memory or on disk

I Can use this as attack against AV:I Create small zip file, which expands to huge unpacked dataI Can also use multiple levels of zipping

I Famous example: 42.zipI Packed size: 42 KBI Fully unpacked (after 5 levels of unzip): 4.5 PBI Expansion factor of >100,000,000,000

I Recall self-replicating code, how about a self replicating zip?

I Idea: create a zip file that contains itself

I Virus scanners will keep unpacking forever

I This exists, for details see http://research.swtch.com/zip

I Not restricted to zip, also works with gzip

OS Security – Malware 21

Page 101: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Zip bombs

I Malware scanners (AV) needs to unpack zipped files

I Unpacked copy needs to sit somewhere in memory or on disk

I Can use this as attack against AV:I Create small zip file, which expands to huge unpacked dataI Can also use multiple levels of zipping

I Famous example: 42.zipI Packed size: 42 KBI Fully unpacked (after 5 levels of unzip): 4.5 PBI Expansion factor of >100,000,000,000

I Recall self-replicating code, how about a self replicating zip?

I Idea: create a zip file that contains itself

I Virus scanners will keep unpacking forever

I This exists, for details see http://research.swtch.com/zip

I Not restricted to zip, also works with gzip

OS Security – Malware 21

Page 102: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Part II

Smartphone Malware

Page 103: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Evolution of Malware: From PC to Smartphone

I Larger attack surface for malware authors; easy-to-deploy attacks;many forms of attack vectors

I Motivation: ‘low risk, high reward’

I Various app markets: official (e.g. Google Play) and non-official (e.g.Pandaapp)

I Decentralized: anyone can become an app developer; no propervetting of new apps

OS Security – Malware 23

Page 104: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Evolution of Malware: From PC to Smartphone

I Larger attack surface for malware authors; easy-to-deploy attacks;many forms of attack vectors

I Motivation: ‘low risk, high reward’

I Various app markets: official (e.g. Google Play) and non-official (e.g.Pandaapp)

I Decentralized: anyone can become an app developer; no propervetting of new apps

OS Security – Malware 23

Page 105: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Evolution of Malware: From PC to Smartphone

I Larger attack surface for malware authors; easy-to-deploy attacks;many forms of attack vectors

I Motivation: ‘low risk, high reward’

I Various app markets: official (e.g. Google Play) and non-official (e.g.Pandaapp)

I Decentralized: anyone can become an app developer; no propervetting of new apps

OS Security – Malware 23

Page 106: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Evolution of Malware: From PC to Smartphone

I Larger attack surface for malware authors; easy-to-deploy attacks;many forms of attack vectors

I Motivation: ‘low risk, high reward’I Various app markets: official (e.g. Google Play) and non-official (e.g.

Pandaapp)I Decentralized: anyone can become an app developer; no proper

vetting of new apps

OS Security – Malware 23

Page 107: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Early days of smartphone malware

I Back in 2004, a group known as 29A released Cabir - a malware(worm) for Symbian

I Propagate via BluetoothI Bluetooth was the most used technology to transfer information

between 2 devices at the time

I Countermeasure: simply turn Bluetooth off or switch it to the“invisible” mode

I Trojan, Qdial, targeting Symbian users, was released in same yearI Malware sent text messages to premium rate services, for which the

handset owner would be charged, thus making an income for themalware author.

I In 2005, a variant of Cabir was released - Pbstealer

I It copied all the information from an infected device’s address bookand attempted to transmit it to any Bluetooth-enabled device withinrange.

I Malware included the string: “.:: Good artist copy, Great artist steal::.”

OS Security – Malware 24

Page 108: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Early days of smartphone malware

I Back in 2004, a group known as 29A released Cabir - a malware(worm) for Symbian

I Propagate via BluetoothI Bluetooth was the most used technology to transfer information

between 2 devices at the time

I Countermeasure: simply turn Bluetooth off or switch it to the“invisible” mode

I Trojan, Qdial, targeting Symbian users, was released in same yearI Malware sent text messages to premium rate services, for which the

handset owner would be charged, thus making an income for themalware author.

I In 2005, a variant of Cabir was released - Pbstealer

I It copied all the information from an infected device’s address bookand attempted to transmit it to any Bluetooth-enabled device withinrange.

I Malware included the string: “.:: Good artist copy, Great artist steal::.”

OS Security – Malware 24

Page 109: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Early days of smartphone malware

I Back in 2004, a group known as 29A released Cabir - a malware(worm) for Symbian

I Propagate via BluetoothI Bluetooth was the most used technology to transfer information

between 2 devices at the timeI Countermeasure: simply turn Bluetooth off or switch it to the

“invisible” mode

I Trojan, Qdial, targeting Symbian users, was released in same yearI Malware sent text messages to premium rate services, for which the

handset owner would be charged, thus making an income for themalware author.

I In 2005, a variant of Cabir was released - Pbstealer

I It copied all the information from an infected device’s address bookand attempted to transmit it to any Bluetooth-enabled device withinrange.

I Malware included the string: “.:: Good artist copy, Great artist steal::.”

OS Security – Malware 24

Page 110: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Early days of smartphone malware

I Back in 2004, a group known as 29A released Cabir - a malware(worm) for Symbian

I Propagate via BluetoothI Bluetooth was the most used technology to transfer information

between 2 devices at the timeI Countermeasure: simply turn Bluetooth off or switch it to the

“invisible” mode

I Trojan, Qdial, targeting Symbian users, was released in same yearI Malware sent text messages to premium rate services, for which the

handset owner would be charged, thus making an income for themalware author.

I In 2005, a variant of Cabir was released - Pbstealer

I It copied all the information from an infected device’s address bookand attempted to transmit it to any Bluetooth-enabled device withinrange.

I Malware included the string: “.:: Good artist copy, Great artist steal::.”

OS Security – Malware 24

Page 111: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Early days of smartphone malware

I Back in 2004, a group known as 29A released Cabir - a malware(worm) for Symbian

I Propagate via BluetoothI Bluetooth was the most used technology to transfer information

between 2 devices at the timeI Countermeasure: simply turn Bluetooth off or switch it to the

“invisible” mode

I Trojan, Qdial, targeting Symbian users, was released in same yearI Malware sent text messages to premium rate services, for which the

handset owner would be charged, thus making an income for themalware author.

I In 2005, a variant of Cabir was released - PbstealerI It copied all the information from an infected device’s address book

and attempted to transmit it to any Bluetooth-enabled device withinrange.

I Malware included the string: “.:: Good artist copy, Great artist steal::.”

OS Security – Malware 24

Page 112: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Early days of smartphone malware

I Back in 2004, a group known as 29A released Cabir - a malware(worm) for Symbian

I Propagate via BluetoothI Bluetooth was the most used technology to transfer information

between 2 devices at the timeI Countermeasure: simply turn Bluetooth off or switch it to the

“invisible” mode

I Trojan, Qdial, targeting Symbian users, was released in same yearI Malware sent text messages to premium rate services, for which the

handset owner would be charged, thus making an income for themalware author.

I In 2005, a variant of Cabir was released - PbstealerI It copied all the information from an infected device’s address book

and attempted to transmit it to any Bluetooth-enabled device withinrange.

I Malware included the string: “.:: Good artist copy, Great artist steal::.”

OS Security – Malware 24

Page 113: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Current state of smartphone malware

I All major smartphone platforms have been infected

I iOS: WireLurker (2014), can install malicious third-partyapplications to an iOS device through an infected Mac via a USBconnection

I Windows Phone: Proof-of-concept for Windows Phone 8 presentedat MalCon 2013; FinSpy Mobile spyware (2013)

I Blackberry: Trojans use a technique referred to as ‘BackStab’; stealunencrypted backups of phones from computers; does not requirehigher-level privileges or root access to the phone or computer

I Android OS - most infected platform to date

OS Security – Malware 25

Page 114: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Current state of smartphone malware

I All major smartphone platforms have been infectedI iOS: WireLurker (2014), can install malicious third-party

applications to an iOS device through an infected Mac via a USBconnection

I Windows Phone: Proof-of-concept for Windows Phone 8 presentedat MalCon 2013; FinSpy Mobile spyware (2013)

I Blackberry: Trojans use a technique referred to as ‘BackStab’; stealunencrypted backups of phones from computers; does not requirehigher-level privileges or root access to the phone or computer

I Android OS - most infected platform to date

OS Security – Malware 25

Page 115: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Current state of smartphone malware

I All major smartphone platforms have been infectedI iOS: WireLurker (2014), can install malicious third-party

applications to an iOS device through an infected Mac via a USBconnection

I Windows Phone: Proof-of-concept for Windows Phone 8 presentedat MalCon 2013; FinSpy Mobile spyware (2013)

I Blackberry: Trojans use a technique referred to as ‘BackStab’; stealunencrypted backups of phones from computers; does not requirehigher-level privileges or root access to the phone or computer

I Android OS - most infected platform to date

OS Security – Malware 25

Page 116: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Current state of smartphone malware

I All major smartphone platforms have been infectedI iOS: WireLurker (2014), can install malicious third-party

applications to an iOS device through an infected Mac via a USBconnection

I Windows Phone: Proof-of-concept for Windows Phone 8 presentedat MalCon 2013; FinSpy Mobile spyware (2013)

I Blackberry: Trojans use a technique referred to as ‘BackStab’; stealunencrypted backups of phones from computers; does not requirehigher-level privileges or root access to the phone or computer

I Android OS - most infected platform to date

OS Security – Malware 25

Page 117: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Current state of smartphone malware

I All major smartphone platforms have been infectedI iOS: WireLurker (2014), can install malicious third-party

applications to an iOS device through an infected Mac via a USBconnection

I Windows Phone: Proof-of-concept for Windows Phone 8 presentedat MalCon 2013; FinSpy Mobile spyware (2013)

I Blackberry: Trojans use a technique referred to as ‘BackStab’; stealunencrypted backups of phones from computers; does not requirehigher-level privileges or root access to the phone or computer

I Android OS - most infected platform to date

OS Security – Malware 25

Page 118: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Popular Android Malware

I First proof-of-concept malware released in 2008.I Causes the phone to accept all incoming callsI Turns off the radio, preventing outgoing/incoming callsI Causes the phone to end all callsI Gathers sensitive information and sends it to the attacker

I Mobile Spy spyware, 2009I Monitored infected device via web browser, phone calls, text

messages, photos, videos, GPS locations

I Ran in ‘stealth mode’, no visible icon

I DroidKungFu, capable of root-level access on vulnerable Androiddevices and evade the detection of security software by encryptingits exploits using AES.

I One of the exploits used was the RageAgainstTheCage (RATC)exploit.

I Also known as adb setuid exhaustion attackI A race condition between RATC and adb-serverI See https://thesnkchrmr.wordpress.com/2011/03/24/

rageagainstthecage/ for more details about the exploit and itssource code

OS Security – Malware 26

Page 119: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Popular Android Malware

I First proof-of-concept malware released in 2008.I Causes the phone to accept all incoming callsI Turns off the radio, preventing outgoing/incoming callsI Causes the phone to end all callsI Gathers sensitive information and sends it to the attacker

I Mobile Spy spyware, 2009I Monitored infected device via web browser, phone calls, text

messages, photos, videos, GPS locations

I Ran in ‘stealth mode’, no visible icon

I DroidKungFu, capable of root-level access on vulnerable Androiddevices and evade the detection of security software by encryptingits exploits using AES.

I One of the exploits used was the RageAgainstTheCage (RATC)exploit.

I Also known as adb setuid exhaustion attackI A race condition between RATC and adb-serverI See https://thesnkchrmr.wordpress.com/2011/03/24/

rageagainstthecage/ for more details about the exploit and itssource code

OS Security – Malware 26

Page 120: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Popular Android Malware

I First proof-of-concept malware released in 2008.I Causes the phone to accept all incoming callsI Turns off the radio, preventing outgoing/incoming callsI Causes the phone to end all callsI Gathers sensitive information and sends it to the attacker

I Mobile Spy spyware, 2009I Monitored infected device via web browser, phone calls, text

messages, photos, videos, GPS locationsI Ran in ‘stealth mode’, no visible icon

I DroidKungFu, capable of root-level access on vulnerable Androiddevices and evade the detection of security software by encryptingits exploits using AES.

I One of the exploits used was the RageAgainstTheCage (RATC)exploit.

I Also known as adb setuid exhaustion attackI A race condition between RATC and adb-serverI See https://thesnkchrmr.wordpress.com/2011/03/24/

rageagainstthecage/ for more details about the exploit and itssource code

OS Security – Malware 26

Page 121: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Popular Android Malware

I First proof-of-concept malware released in 2008.I Causes the phone to accept all incoming callsI Turns off the radio, preventing outgoing/incoming callsI Causes the phone to end all callsI Gathers sensitive information and sends it to the attacker

I Mobile Spy spyware, 2009I Monitored infected device via web browser, phone calls, text

messages, photos, videos, GPS locationsI Ran in ‘stealth mode’, no visible icon

I DroidKungFu, capable of root-level access on vulnerable Androiddevices and evade the detection of security software by encryptingits exploits using AES.

I One of the exploits used was the RageAgainstTheCage (RATC)exploit.

I Also known as adb setuid exhaustion attackI A race condition between RATC and adb-serverI See https://thesnkchrmr.wordpress.com/2011/03/24/

rageagainstthecage/ for more details about the exploit and itssource code

OS Security – Malware 26

Page 122: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Popular Android Malware

I First proof-of-concept malware released in 2008.I Causes the phone to accept all incoming callsI Turns off the radio, preventing outgoing/incoming callsI Causes the phone to end all callsI Gathers sensitive information and sends it to the attacker

I Mobile Spy spyware, 2009I Monitored infected device via web browser, phone calls, text

messages, photos, videos, GPS locationsI Ran in ‘stealth mode’, no visible icon

I DroidKungFu, capable of root-level access on vulnerable Androiddevices and evade the detection of security software by encryptingits exploits using AES.

I One of the exploits used was the RageAgainstTheCage (RATC)exploit.

I Also known as adb setuid exhaustion attackI A race condition between RATC and adb-server

I See https://thesnkchrmr.wordpress.com/2011/03/24/

rageagainstthecage/ for more details about the exploit and itssource code

OS Security – Malware 26

Page 123: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Popular Android Malware

I First proof-of-concept malware released in 2008.I Causes the phone to accept all incoming callsI Turns off the radio, preventing outgoing/incoming callsI Causes the phone to end all callsI Gathers sensitive information and sends it to the attacker

I Mobile Spy spyware, 2009I Monitored infected device via web browser, phone calls, text

messages, photos, videos, GPS locationsI Ran in ‘stealth mode’, no visible icon

I DroidKungFu, capable of root-level access on vulnerable Androiddevices and evade the detection of security software by encryptingits exploits using AES.

I One of the exploits used was the RageAgainstTheCage (RATC)exploit.

I Also known as adb setuid exhaustion attackI A race condition between RATC and adb-serverI See https://thesnkchrmr.wordpress.com/2011/03/24/

rageagainstthecage/ for more details about the exploit and itssource code

OS Security – Malware 26

Page 124: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits & Bootkits

I One of the first Android rootkit was presented at DEF CON 18(2010)

I Rootkit was used to track location of smartphone’s owner, readSMS and redirect calls

I A demo of a clickjacking rootkit targeting Android 4.0,https://www.youtube.com/watch?v=RxpMPrqnxC0

I Bootkit, Android.Oldboot (2014) has the capability of reinstallingitself even after all of its working components have been deleted.Primary targets were rooted Android devices.

OS Security – Malware 27

Page 125: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits & Bootkits

I One of the first Android rootkit was presented at DEF CON 18(2010)

I Rootkit was used to track location of smartphone’s owner, readSMS and redirect calls

I A demo of a clickjacking rootkit targeting Android 4.0,https://www.youtube.com/watch?v=RxpMPrqnxC0

I Bootkit, Android.Oldboot (2014) has the capability of reinstallingitself even after all of its working components have been deleted.Primary targets were rooted Android devices.

OS Security – Malware 27

Page 126: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits & Bootkits

I One of the first Android rootkit was presented at DEF CON 18(2010)

I Rootkit was used to track location of smartphone’s owner, readSMS and redirect calls

I A demo of a clickjacking rootkit targeting Android 4.0,https://www.youtube.com/watch?v=RxpMPrqnxC0

I Bootkit, Android.Oldboot (2014) has the capability of reinstallingitself even after all of its working components have been deleted.Primary targets were rooted Android devices.

OS Security – Malware 27

Page 127: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Rootkits & Bootkits

I One of the first Android rootkit was presented at DEF CON 18(2010)

I Rootkit was used to track location of smartphone’s owner, readSMS and redirect calls

I A demo of a clickjacking rootkit targeting Android 4.0,https://www.youtube.com/watch?v=RxpMPrqnxC0

I Bootkit, Android.Oldboot (2014) has the capability of reinstallingitself even after all of its working components have been deleted.Primary targets were rooted Android devices.

OS Security – Malware 27

Page 128: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Bitcoin Mining malware

I In 2014, several malicious apps found on Google Play store wereused in a large-scale crypto currency mining operation

I Contained a hidden crypto miner that stealthily exploit users’ devicefor computational resources

I Malware was deployed through Wallpaper apps, with more than 500downloads

OS Security – Malware 28

Page 129: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Bitcoin Mining malware

I In 2014, several malicious apps found on Google Play store wereused in a large-scale crypto currency mining operation

I Contained a hidden crypto miner that stealthily exploit users’ devicefor computational resources

I Malware was deployed through Wallpaper apps, with more than 500downloads

OS Security – Malware 28

Page 130: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Bitcoin Mining malware

I In 2014, several malicious apps found on Google Play store wereused in a large-scale crypto currency mining operation

I Contained a hidden crypto miner that stealthily exploit users’ devicefor computational resources

I Malware was deployed through Wallpaper apps, with more than 500downloads

OS Security – Malware 28

Page 131: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Tools to analyze Android Malware

I Mobile Malware can be analyzed in 2 ways: statically anddynamically

I Static Analysis: Analyze suspicious app through reverse-engineering

I Dynamic Analysis: Execute the suspicious app in a controlledenvironment and monitor its behaviors

I Tools: IDA Pro, JD-Gui, Dex2Jar, Android SDK

I Countermeasures against Android malware:

I There is no single solution!I Download apps from official markets onlyI Read permissions carefully before downloading and installing an app

OS Security – Malware 29

Page 132: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Tools to analyze Android Malware

I Mobile Malware can be analyzed in 2 ways: statically anddynamically

I Static Analysis: Analyze suspicious app through reverse-engineering

I Dynamic Analysis: Execute the suspicious app in a controlledenvironment and monitor its behaviors

I Tools: IDA Pro, JD-Gui, Dex2Jar, Android SDK

I Countermeasures against Android malware:

I There is no single solution!I Download apps from official markets onlyI Read permissions carefully before downloading and installing an app

OS Security – Malware 29

Page 133: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Tools to analyze Android Malware

I Mobile Malware can be analyzed in 2 ways: statically anddynamically

I Static Analysis: Analyze suspicious app through reverse-engineering

I Dynamic Analysis: Execute the suspicious app in a controlledenvironment and monitor its behaviors

I Tools: IDA Pro, JD-Gui, Dex2Jar, Android SDK

I Countermeasures against Android malware:

I There is no single solution!I Download apps from official markets onlyI Read permissions carefully before downloading and installing an app

OS Security – Malware 29

Page 134: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Tools to analyze Android Malware

I Mobile Malware can be analyzed in 2 ways: statically anddynamically

I Static Analysis: Analyze suspicious app through reverse-engineering

I Dynamic Analysis: Execute the suspicious app in a controlledenvironment and monitor its behaviors

I Tools: IDA Pro, JD-Gui, Dex2Jar, Android SDK

I Countermeasures against Android malware:

I There is no single solution!I Download apps from official markets onlyI Read permissions carefully before downloading and installing an app

OS Security – Malware 29

Page 135: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Tools to analyze Android Malware

I Mobile Malware can be analyzed in 2 ways: statically anddynamically

I Static Analysis: Analyze suspicious app through reverse-engineering

I Dynamic Analysis: Execute the suspicious app in a controlledenvironment and monitor its behaviors

I Tools: IDA Pro, JD-Gui, Dex2Jar, Android SDK

I Countermeasures against Android malware:

I There is no single solution!I Download apps from official markets onlyI Read permissions carefully before downloading and installing an app

OS Security – Malware 29

Page 136: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Tools to analyze Android Malware

I Mobile Malware can be analyzed in 2 ways: statically anddynamically

I Static Analysis: Analyze suspicious app through reverse-engineering

I Dynamic Analysis: Execute the suspicious app in a controlledenvironment and monitor its behaviors

I Tools: IDA Pro, JD-Gui, Dex2Jar, Android SDK

I Countermeasures against Android malware:I There is no single solution!I Download apps from official markets onlyI Read permissions carefully before downloading and installing an app

OS Security – Malware 29

Page 137: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus apps for Smartphones

I Useful as a first-line of defenseI Can detect popular malware families and their variants

I But...I App developers have fine-grained access (mostly via permissions) to

hardware and software resources of the deviceI As a result, many malicious attack go undetected by antivirus apps

I DRAMMER1 attack

I Deterministic Rowhammer attack; allows attackers to manipulatedata stored in memory chips, resulting in gaining root access of thedevice

I Side-channel attacks on smartphones

I Apps often (unintentionally) leak sensitive information which can beexploited by malware

I Leaks via in-built sensors, such as accelerometers, GPS, motionsensors, etc..

I See this paper2 for more details

1https://vvdveen.com/publications/drammer.pdf2https://arxiv.org/pdf/1611.03748v1.pdf

OS Security – Malware 30

Page 138: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus apps for Smartphones

I Useful as a first-line of defenseI Can detect popular malware families and their variantsI But...

I App developers have fine-grained access (mostly via permissions) tohardware and software resources of the device

I As a result, many malicious attack go undetected by antivirus apps

I DRAMMER1 attack

I Deterministic Rowhammer attack; allows attackers to manipulatedata stored in memory chips, resulting in gaining root access of thedevice

I Side-channel attacks on smartphones

I Apps often (unintentionally) leak sensitive information which can beexploited by malware

I Leaks via in-built sensors, such as accelerometers, GPS, motionsensors, etc..

I See this paper2 for more details

1https://vvdveen.com/publications/drammer.pdf2https://arxiv.org/pdf/1611.03748v1.pdf

OS Security – Malware 30

Page 139: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus apps for Smartphones

I Useful as a first-line of defenseI Can detect popular malware families and their variantsI But...I App developers have fine-grained access (mostly via permissions) to

hardware and software resources of the deviceI As a result, many malicious attack go undetected by antivirus apps

I DRAMMER1 attack

I Deterministic Rowhammer attack; allows attackers to manipulatedata stored in memory chips, resulting in gaining root access of thedevice

I Side-channel attacks on smartphones

I Apps often (unintentionally) leak sensitive information which can beexploited by malware

I Leaks via in-built sensors, such as accelerometers, GPS, motionsensors, etc..

I See this paper2 for more details

1https://vvdveen.com/publications/drammer.pdf2https://arxiv.org/pdf/1611.03748v1.pdf

OS Security – Malware 30

Page 140: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus apps for Smartphones

I Useful as a first-line of defenseI Can detect popular malware families and their variantsI But...I App developers have fine-grained access (mostly via permissions) to

hardware and software resources of the deviceI As a result, many malicious attack go undetected by antivirus apps

I DRAMMER1 attack

I Deterministic Rowhammer attack; allows attackers to manipulatedata stored in memory chips, resulting in gaining root access of thedevice

I Side-channel attacks on smartphones

I Apps often (unintentionally) leak sensitive information which can beexploited by malware

I Leaks via in-built sensors, such as accelerometers, GPS, motionsensors, etc..

I See this paper2 for more details

1https://vvdveen.com/publications/drammer.pdf2https://arxiv.org/pdf/1611.03748v1.pdf

OS Security – Malware 30

Page 141: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus apps for Smartphones

I Useful as a first-line of defenseI Can detect popular malware families and their variantsI But...I App developers have fine-grained access (mostly via permissions) to

hardware and software resources of the deviceI As a result, many malicious attack go undetected by antivirus apps

I DRAMMER1 attackI Deterministic Rowhammer attack; allows attackers to manipulate

data stored in memory chips, resulting in gaining root access of thedevice

I Side-channel attacks on smartphones

I Apps often (unintentionally) leak sensitive information which can beexploited by malware

I Leaks via in-built sensors, such as accelerometers, GPS, motionsensors, etc..

I See this paper2 for more details

1https://vvdveen.com/publications/drammer.pdf2https://arxiv.org/pdf/1611.03748v1.pdf

OS Security – Malware 30

Page 142: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus apps for Smartphones

I Useful as a first-line of defenseI Can detect popular malware families and their variantsI But...I App developers have fine-grained access (mostly via permissions) to

hardware and software resources of the deviceI As a result, many malicious attack go undetected by antivirus apps

I DRAMMER1 attackI Deterministic Rowhammer attack; allows attackers to manipulate

data stored in memory chips, resulting in gaining root access of thedevice

I Side-channel attacks on smartphonesI Apps often (unintentionally) leak sensitive information which can be

exploited by malware

I Leaks via in-built sensors, such as accelerometers, GPS, motionsensors, etc..

I See this paper2 for more details

1https://vvdveen.com/publications/drammer.pdf2https://arxiv.org/pdf/1611.03748v1.pdf

OS Security – Malware 30

Page 143: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Antivirus apps for Smartphones

I Useful as a first-line of defenseI Can detect popular malware families and their variantsI But...I App developers have fine-grained access (mostly via permissions) to

hardware and software resources of the deviceI As a result, many malicious attack go undetected by antivirus apps

I DRAMMER1 attackI Deterministic Rowhammer attack; allows attackers to manipulate

data stored in memory chips, resulting in gaining root access of thedevice

I Side-channel attacks on smartphonesI Apps often (unintentionally) leak sensitive information which can be

exploited by malwareI Leaks via in-built sensors, such as accelerometers, GPS, motion

sensors, etc..I See this paper2 for more details

1https://vvdveen.com/publications/drammer.pdf2https://arxiv.org/pdf/1611.03748v1.pdf

OS Security – Malware 30

Page 144: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Intrusion Detection & Prevention

I Two kinds of intrusion detection systems (IDS):I Network-based IDS (NIDS)I Host-based IDS (HIDS)

I Special kind of HIDS: antivirus software (AV)I AV is typically more generally anti-malware software (aka virus

scanners, malware scanners)

I Some systems have additional capabilities to prevent intrusion

I Those systems are called intrusion prevention systems (IPS), again:I Network-based IPS (NIPS)I Host-based IPS (HIPS)

I IDS/IPS tool: SNORT (more on this later)

OS Security – Malware 31

Page 145: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Intrusion Detection & Prevention

I Two kinds of intrusion detection systems (IDS):I Network-based IDS (NIDS)I Host-based IDS (HIDS)

I Special kind of HIDS: antivirus software (AV)I AV is typically more generally anti-malware software (aka virus

scanners, malware scanners)

I Some systems have additional capabilities to prevent intrusion

I Those systems are called intrusion prevention systems (IPS), again:I Network-based IPS (NIPS)I Host-based IPS (HIPS)

I IDS/IPS tool: SNORT (more on this later)

OS Security – Malware 31

Page 146: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Intrusion Detection & Prevention

I Two kinds of intrusion detection systems (IDS):I Network-based IDS (NIDS)I Host-based IDS (HIDS)

I Special kind of HIDS: antivirus software (AV)I AV is typically more generally anti-malware software (aka virus

scanners, malware scanners)

I Some systems have additional capabilities to prevent intrusion

I Those systems are called intrusion prevention systems (IPS), again:I Network-based IPS (NIPS)I Host-based IPS (HIPS)

I IDS/IPS tool: SNORT (more on this later)

OS Security – Malware 31

Page 147: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Intrusion Detection & Prevention

I Two kinds of intrusion detection systems (IDS):I Network-based IDS (NIDS)I Host-based IDS (HIDS)

I Special kind of HIDS: antivirus software (AV)I AV is typically more generally anti-malware software (aka virus

scanners, malware scanners)

I Some systems have additional capabilities to prevent intrusion

I Those systems are called intrusion prevention systems (IPS), again:I Network-based IPS (NIPS)I Host-based IPS (HIPS)

I IDS/IPS tool: SNORT (more on this later)

OS Security – Malware 31

Page 148: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Network-based intrusion detection system

I NIDS monitors traffic on its network segment as a data source

I This is achieved by placing the network interface in promiscuousmode to capture all traffic that crosses its network segment

I Different detection methods:

I Signature-based detection: Signatures are attack patternspredetermined and pre-configured. This detection method monitorsthe network traffic and compares it with the pre-configuredsignatures so as to find a match.

I Anomaly-based detection: This method of detection creates abaseline on average network conditions. Once a baseline has beencreated, the system intermittently samples network traffic on thebasis of statistical analysis and compares the sample to the createdbaseline.

I Protocol state analysis detection: This type of detection methodidentifies deviations of protocol states by comparing observed eventswith predefined profiles

OS Security – Malware 32

Page 149: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Network-based intrusion detection system

I NIDS monitors traffic on its network segment as a data source

I This is achieved by placing the network interface in promiscuousmode to capture all traffic that crosses its network segment

I Different detection methods:I Signature-based detection: Signatures are attack patterns

predetermined and pre-configured. This detection method monitorsthe network traffic and compares it with the pre-configuredsignatures so as to find a match.

I Anomaly-based detection: This method of detection creates abaseline on average network conditions. Once a baseline has beencreated, the system intermittently samples network traffic on thebasis of statistical analysis and compares the sample to the createdbaseline.

I Protocol state analysis detection: This type of detection methodidentifies deviations of protocol states by comparing observed eventswith predefined profiles

OS Security – Malware 32

Page 150: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Network-based intrusion detection system

I NIDS monitors traffic on its network segment as a data source

I This is achieved by placing the network interface in promiscuousmode to capture all traffic that crosses its network segment

I Different detection methods:I Signature-based detection: Signatures are attack patterns

predetermined and pre-configured. This detection method monitorsthe network traffic and compares it with the pre-configuredsignatures so as to find a match.

I Anomaly-based detection: This method of detection creates abaseline on average network conditions. Once a baseline has beencreated, the system intermittently samples network traffic on thebasis of statistical analysis and compares the sample to the createdbaseline.

I Protocol state analysis detection: This type of detection methodidentifies deviations of protocol states by comparing observed eventswith predefined profiles

OS Security – Malware 32

Page 151: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Network-based intrusion detection system

I NIDS monitors traffic on its network segment as a data source

I This is achieved by placing the network interface in promiscuousmode to capture all traffic that crosses its network segment

I Different detection methods:I Signature-based detection: Signatures are attack patterns

predetermined and pre-configured. This detection method monitorsthe network traffic and compares it with the pre-configuredsignatures so as to find a match.

I Anomaly-based detection: This method of detection creates abaseline on average network conditions. Once a baseline has beencreated, the system intermittently samples network traffic on thebasis of statistical analysis and compares the sample to the createdbaseline.

I Protocol state analysis detection: This type of detection methodidentifies deviations of protocol states by comparing observed eventswith predefined profiles

OS Security – Malware 32

Page 152: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Signature-based detection

I Only works for known attacks

I Packets can be matched against three different types of signatures:

I String signatures: look for a text string that indicates a possibleattack. For example: "cat "+ +" > /.rhosts" might cause aUNIX system to become extremely vulnerable to network attack

I Port signatures: monitor connection attempts to well-known,frequently attacked ports. Examples of these ports include telnet(TCP port 23), FTP (TCP port 21/20), SUNRPC (TCP/UDP port111), and IMAP (TCP port 143)

I Header signatures: watch for suspicious combinations in packetheaders. For example:s a TCP packet with both the SYN and FINflags set, signifying that the requester wishes to start and stop aconnection at the same time

OS Security – Malware 33

Page 153: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Signature-based detection

I Only works for known attacks

I Packets can be matched against three different types of signatures:

I String signatures: look for a text string that indicates a possibleattack. For example: "cat "+ +" > /.rhosts" might cause aUNIX system to become extremely vulnerable to network attack

I Port signatures: monitor connection attempts to well-known,frequently attacked ports. Examples of these ports include telnet(TCP port 23), FTP (TCP port 21/20), SUNRPC (TCP/UDP port111), and IMAP (TCP port 143)

I Header signatures: watch for suspicious combinations in packetheaders. For example:s a TCP packet with both the SYN and FINflags set, signifying that the requester wishes to start and stop aconnection at the same time

OS Security – Malware 33

Page 154: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Signature-based detection

I Only works for known attacks

I Packets can be matched against three different types of signatures:I String signatures: look for a text string that indicates a possible

attack. For example: "cat "+ +" > /.rhosts" might cause aUNIX system to become extremely vulnerable to network attack

I Port signatures: monitor connection attempts to well-known,frequently attacked ports. Examples of these ports include telnet(TCP port 23), FTP (TCP port 21/20), SUNRPC (TCP/UDP port111), and IMAP (TCP port 143)

I Header signatures: watch for suspicious combinations in packetheaders. For example:s a TCP packet with both the SYN and FINflags set, signifying that the requester wishes to start and stop aconnection at the same time

OS Security – Malware 33

Page 155: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Signature-based detection

I Only works for known attacks

I Packets can be matched against three different types of signatures:I String signatures: look for a text string that indicates a possible

attack. For example: "cat "+ +" > /.rhosts" might cause aUNIX system to become extremely vulnerable to network attack

I Port signatures: monitor connection attempts to well-known,frequently attacked ports. Examples of these ports include telnet(TCP port 23), FTP (TCP port 21/20), SUNRPC (TCP/UDP port111), and IMAP (TCP port 143)

I Header signatures: watch for suspicious combinations in packetheaders. For example:s a TCP packet with both the SYN and FINflags set, signifying that the requester wishes to start and stop aconnection at the same time

OS Security – Malware 33

Page 156: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Signature-based detection

I Only works for known attacks

I Packets can be matched against three different types of signatures:I String signatures: look for a text string that indicates a possible

attack. For example: "cat "+ +" > /.rhosts" might cause aUNIX system to become extremely vulnerable to network attack

I Port signatures: monitor connection attempts to well-known,frequently attacked ports. Examples of these ports include telnet(TCP port 23), FTP (TCP port 21/20), SUNRPC (TCP/UDP port111), and IMAP (TCP port 143)

I Header signatures: watch for suspicious combinations in packetheaders. For example:s a TCP packet with both the SYN and FINflags set, signifying that the requester wishes to start and stop aconnection at the same time

OS Security – Malware 33

Page 157: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Host-based intrusion detection system

I HIDS goes beyond malware scanning (although there may be someoverlap)

I Typically register certain resources with the IDS, those resources aremonitored

I Examples of resources: system files, Windows registry entries,network ports

I Idea: remember state of resource, detect modifications

I Typically store hash values of resources

I Crucial to protect the table of hashes!

I Additionally, analyze log files (e.g., /var/log/syslog)

I For log-file analysis, two possibilities:I Signature-based intrusion detectionI Behavior-based intrusion detection

I Problem of signature-based IDS: same as with AV

I Problem of behavior-based IDS: hard to obtain good detection rateat low false-positive rate in highly dynamic systems

OS Security – Malware 34

Page 158: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Host-based intrusion detection system

I HIDS goes beyond malware scanning (although there may be someoverlap)

I Typically register certain resources with the IDS, those resources aremonitored

I Examples of resources: system files, Windows registry entries,network ports

I Idea: remember state of resource, detect modifications

I Typically store hash values of resources

I Crucial to protect the table of hashes!

I Additionally, analyze log files (e.g., /var/log/syslog)

I For log-file analysis, two possibilities:I Signature-based intrusion detectionI Behavior-based intrusion detection

I Problem of signature-based IDS: same as with AV

I Problem of behavior-based IDS: hard to obtain good detection rateat low false-positive rate in highly dynamic systems

OS Security – Malware 34

Page 159: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Host-based intrusion detection system

I HIDS goes beyond malware scanning (although there may be someoverlap)

I Typically register certain resources with the IDS, those resources aremonitored

I Examples of resources: system files, Windows registry entries,network ports

I Idea: remember state of resource, detect modifications

I Typically store hash values of resources

I Crucial to protect the table of hashes!

I Additionally, analyze log files (e.g., /var/log/syslog)

I For log-file analysis, two possibilities:I Signature-based intrusion detectionI Behavior-based intrusion detection

I Problem of signature-based IDS: same as with AV

I Problem of behavior-based IDS: hard to obtain good detection rateat low false-positive rate in highly dynamic systems

OS Security – Malware 34

Page 160: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Host-based intrusion detection system

I HIDS goes beyond malware scanning (although there may be someoverlap)

I Typically register certain resources with the IDS, those resources aremonitored

I Examples of resources: system files, Windows registry entries,network ports

I Idea: remember state of resource, detect modifications

I Typically store hash values of resources

I Crucial to protect the table of hashes!

I Additionally, analyze log files (e.g., /var/log/syslog)

I For log-file analysis, two possibilities:I Signature-based intrusion detectionI Behavior-based intrusion detection

I Problem of signature-based IDS: same as with AV

I Problem of behavior-based IDS: hard to obtain good detection rateat low false-positive rate in highly dynamic systems

OS Security – Malware 34

Page 161: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Host-based intrusion detection system

I HIDS goes beyond malware scanning (although there may be someoverlap)

I Typically register certain resources with the IDS, those resources aremonitored

I Examples of resources: system files, Windows registry entries,network ports

I Idea: remember state of resource, detect modifications

I Typically store hash values of resources

I Crucial to protect the table of hashes!

I Additionally, analyze log files (e.g., /var/log/syslog)

I For log-file analysis, two possibilities:I Signature-based intrusion detectionI Behavior-based intrusion detection

I Problem of signature-based IDS: same as with AV

I Problem of behavior-based IDS: hard to obtain good detection rateat low false-positive rate in highly dynamic systems

OS Security – Malware 34

Page 162: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

SNORT

I Can be used for network intrusion detection and prevention

I Free and open source

I Uses a simple rules description language to create rules

I Snort rules are divided into 2 logical sections: rule header and ruleoptions

I The rule header contains the rule’s action (e.g., log, alert, drop),protocol, source and destination IP addresses and netmasks, and thesource and destination ports information

I The rule option section contains alert messages and information onwhich parts of the packet should be inspected to determine if therule action should be taken.

I action proto src ip src port direction dst ip dst port (options)

I Example: log tcp any :1024 -> 192.168.1.0/24 500:

I Log tcp traffic from priveleged ports less than or equal to 1024 goingto ports greater than or equal to 500

OS Security – Malware 35

Page 163: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

SNORT

I Can be used for network intrusion detection and prevention

I Free and open source

I Uses a simple rules description language to create rules

I Snort rules are divided into 2 logical sections: rule header and ruleoptions

I The rule header contains the rule’s action (e.g., log, alert, drop),protocol, source and destination IP addresses and netmasks, and thesource and destination ports information

I The rule option section contains alert messages and information onwhich parts of the packet should be inspected to determine if therule action should be taken.

I action proto src ip src port direction dst ip dst port (options)

I Example: log tcp any :1024 -> 192.168.1.0/24 500:

I Log tcp traffic from priveleged ports less than or equal to 1024 goingto ports greater than or equal to 500

OS Security – Malware 35

Page 164: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

SNORT

I Can be used for network intrusion detection and prevention

I Free and open source

I Uses a simple rules description language to create rules

I Snort rules are divided into 2 logical sections: rule header and ruleoptions

I The rule header contains the rule’s action (e.g., log, alert, drop),protocol, source and destination IP addresses and netmasks, and thesource and destination ports information

I The rule option section contains alert messages and information onwhich parts of the packet should be inspected to determine if therule action should be taken.

I action proto src ip src port direction dst ip dst port (options)

I Example: log tcp any :1024 -> 192.168.1.0/24 500:

I Log tcp traffic from priveleged ports less than or equal to 1024 goingto ports greater than or equal to 500

OS Security – Malware 35

Page 165: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

SNORT

I Can be used for network intrusion detection and prevention

I Free and open source

I Uses a simple rules description language to create rules

I Snort rules are divided into 2 logical sections: rule header and ruleoptions

I The rule header contains the rule’s action (e.g., log, alert, drop),protocol, source and destination IP addresses and netmasks, and thesource and destination ports information

I The rule option section contains alert messages and information onwhich parts of the packet should be inspected to determine if therule action should be taken.

I action proto src ip src port direction dst ip dst port (options)

I Example: log tcp any :1024 -> 192.168.1.0/24 500:

I Log tcp traffic from priveleged ports less than or equal to 1024 goingto ports greater than or equal to 500

OS Security – Malware 35

Page 166: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

SNORT

I Can be used for network intrusion detection and prevention

I Free and open source

I Uses a simple rules description language to create rules

I Snort rules are divided into 2 logical sections: rule header and ruleoptions

I The rule header contains the rule’s action (e.g., log, alert, drop),protocol, source and destination IP addresses and netmasks, and thesource and destination ports information

I The rule option section contains alert messages and information onwhich parts of the packet should be inspected to determine if therule action should be taken.

I action proto src ip src port direction dst ip dst port (options)

I Example: log tcp any :1024 -> 192.168.1.0/24 500:

I Log tcp traffic from priveleged ports less than or equal to 1024 goingto ports greater than or equal to 500

OS Security – Malware 35

Page 167: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

SNORT

I Can be used for network intrusion detection and prevention

I Free and open source

I Uses a simple rules description language to create rules

I Snort rules are divided into 2 logical sections: rule header and ruleoptions

I The rule header contains the rule’s action (e.g., log, alert, drop),protocol, source and destination IP addresses and netmasks, and thesource and destination ports information

I The rule option section contains alert messages and information onwhich parts of the packet should be inspected to determine if therule action should be taken.

I action proto src ip src port direction dst ip dst port (options)

I Example: log tcp any :1024 -> 192.168.1.0/24 500:

I Log tcp traffic from priveleged ports less than or equal to 1024 goingto ports greater than or equal to 500

OS Security – Malware 35

Page 168: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Recover after intrusion

I Easy situation: download a file from the Internet, AV complains.⇒ Don’t run/open file, but stop download (or delete file).

I Hard situation: AV complains about old files or IDS reports intrusion

I AV software typically offers to “remove the virus/worm/trojan”

I Question: Is that enough?

I There is only one responsible answer: No.

I Once a system has been compromised, you don’t know what else isbroken

I Only reasonable recovery from intrusion:I Isolate the system (to prevent further damage)I Analyze what was compromised and how (forensics)I Restore to a clean state (reinstall, restore clean data backup)

OS Security – Malware 36

Page 169: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Recover after intrusion

I Easy situation: download a file from the Internet, AV complains.⇒ Don’t run/open file, but stop download (or delete file).

I Hard situation: AV complains about old files or IDS reports intrusion

I AV software typically offers to “remove the virus/worm/trojan”

I Question: Is that enough?

I There is only one responsible answer: No.

I Once a system has been compromised, you don’t know what else isbroken

I Only reasonable recovery from intrusion:I Isolate the system (to prevent further damage)I Analyze what was compromised and how (forensics)I Restore to a clean state (reinstall, restore clean data backup)

OS Security – Malware 36

Page 170: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Recover after intrusion

I Easy situation: download a file from the Internet, AV complains.⇒ Don’t run/open file, but stop download (or delete file).

I Hard situation: AV complains about old files or IDS reports intrusion

I AV software typically offers to “remove the virus/worm/trojan”

I Question: Is that enough?

I There is only one responsible answer: No.

I Once a system has been compromised, you don’t know what else isbroken

I Only reasonable recovery from intrusion:I Isolate the system (to prevent further damage)I Analyze what was compromised and how (forensics)I Restore to a clean state (reinstall, restore clean data backup)

OS Security – Malware 36

Page 171: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Recover after intrusion

I Easy situation: download a file from the Internet, AV complains.⇒ Don’t run/open file, but stop download (or delete file).

I Hard situation: AV complains about old files or IDS reports intrusion

I AV software typically offers to “remove the virus/worm/trojan”

I Question: Is that enough?

I There is only one responsible answer: No.

I Once a system has been compromised, you don’t know what else isbroken

I Only reasonable recovery from intrusion:I Isolate the system (to prevent further damage)I Analyze what was compromised and how (forensics)I Restore to a clean state (reinstall, restore clean data backup)

OS Security – Malware 36

Page 172: OS Securityvmoonsamy/teaching/ossec2016/Malware.pdf · Ad-hoc solutions for better OS security I Completely re-designing an OS is expensive I More feasible: Add-on security for existing

Recover after intrusion

I Easy situation: download a file from the Internet, AV complains.⇒ Don’t run/open file, but stop download (or delete file).

I Hard situation: AV complains about old files or IDS reports intrusion

I AV software typically offers to “remove the virus/worm/trojan”

I Question: Is that enough?

I There is only one responsible answer: No.

I Once a system has been compromised, you don’t know what else isbroken

I Only reasonable recovery from intrusion:I Isolate the system (to prevent further damage)I Analyze what was compromised and how (forensics)I Restore to a clean state (reinstall, restore clean data backup)

OS Security – Malware 36