Computer Security Exam

profileMalikbinn
CPSC353PowerPoints-A.zip

Ch03-BufferOverflow.pptx

Buffer Overflow Attacks

1

2009-01-28

Operating Systems: Basic Concepts

CS 166

What is an Exploit?

An exploit is any input (i.e., a piece of software, an argument string, or sequence of commands) that takes advantage of a bug, glitch or vulnerability in order to cause an attack

An attack is an unintended or unanticipated behavior that occurs on computer software, hardware, or something electronic and that brings an advantage to the attacker

10/13/10

Buffer Overflow

2

not necessarily a program... while it can be a program that communicates bad input to a vulnerable piece of software, it can also be just the bad input itself... any bad input (or even valid input that the developer just failed to anticipate) can cause the vulnerable application to behave improperly...

Operating Systems: Basic Concepts

2009-01-28

CS 166

2

Buffer Overflow Attack

One of the most common OS bugs is a buffer overflow

The developer fails to include code that checks whether an input string fits into its buffer array

An input to the running process exceeds the length of the buffer

The input string overwrites a portion of the memory of the process

Causes the application to behave improperly and unexpectedly

Effect of a buffer overflow

The process can operate on malicious data or execute malicious code passed in by the attacker

If the process is executed as root, the malicious code will be executing with root privileges

10/13/10

Buffer Overflow

3

3

Because of the nature of the address space, locally declared buffers are allocated on the stack

Since the stack grows downward, if you write past the end of the buffer, you can corrupt the content of the rest of the stack, thus, if enough information is known about the program, one could write over known register information and the return address

2009-01-28

Operating Systems: Basic Concepts

CS 166

Address Space

Every program needs to access memory in order to run

For simplicity sake, it would be nice to allow each process (i.e., each executing program) to act as if it owns all of memory

The address space model is used to accomplish this

Each process can allocate space anywhere it wants in memory

Most kernels manage each process’ allocation of memory through the virtual memory model

How the memory is managed is irrelevant to the process

10/13/10

Buffer Overflow

4

4

This would also be consistent with the process model proposed earlier where each process feels like it “owns” the machine. The size of the address space is machine dependent, until the Intel 386 came around, most address spaces were 16 bit, for most of the past 15 years, we have been sing 32 bit machines, though increasingly larger number of processors with 64 bit modes are making their way into people’s computers.

2009-01-28

Operating Systems: Basic Concepts

CS 166

Virtual Memory

Mapping virtual addresses to real addresses

10/13/10

Buffer Overflow

5

Another

Program

Hard Drive

Program Sees

Actual Memory

Unix Address Space

Text: machine code of the program, compiled from the source code

Data: static program variables initialized in the source code prior to execution

BSS (block started by symbol): static variables that are uninitialized

Heap : data dynamically generated during the execution of a process

Stack: structure that grows downwards and keeps track of the activated method calls, their arguments and local variables

10/13/10

Buffer Overflow

6

Low Addresses

0x0000 0000

High Addresses

0xFFFF FFFF

Stack

Heap

BSS

Data

Text

Vulnerabilities and Attack Method

Vulnerability scenarios

The program has root privileges (setuid) and is launched from a shell

The program is part of a web application

Typical attack method

Find vulnerability

Reverse engineer the program

Build the exploit

10/13/10

Buffer Overflow

7

Buffer Overflow Attack in a Nutshell

First described in

Aleph One. Smashing The Stack For Fun And Profit. e-zine www.Phrack.org #49, 1996

The attacker exploits an unchecked buffer to perform a buffer overflow attack

The ultimate goal for the attacker is getting a shell that allows to execute arbitrary commands with high privileges

Kinds of buffer overflow attacks:

Heap smashing

Stack smashing

10/13/10

Buffer Overflow

8

Buffer Overflow

Retrieves domain registration info

e.g., domain brown.edu

10/13/10

Buffer Overflow

9

domain.c

Main(int argc, char *argv[ ])

/* get user_input */

{

char var1[15];

char command[20];

strcpy(command, “whois ");

strcat(command, argv[1]);

strcpy(var1, argv[1]);

printf(var1);

system(command);

}

Top of

Memory

0xFFFFFFFF

Bottom of

Memory

0x00000000

.

.

.

Stack

Fill

Direction

var1 (15 char)

command

(20 char)

strcpy() Vulnerability

argv[1] is the user input

strcpy(dest, src) does not check buffer

strcat(d, s) concatenates strings

10/13/10

Buffer Overflow

10

domain.c

Main(int argc, char *argv[])

/*get user_input*/

{

char var1[15];

char command[20];

strcpy(command, “whois ");

strcat(command, argv[1]);

strcpy(var1, argv[1]);

printf(var1);

system(command);

}

var1 (15 char)

command

(20 char)

argv[1] (15 char)

argv[1] (20 char)

Top of

Memory

0xFFFFFFFF

Bottom of

Memory

0x00000000

.

.

.

Stack

Fill

Direction

Overflow

exploit

strcpy() vs. strncpy()

Function strcpy() copies the string in the second argument into the first argument

e.g., strcpy(dest, src)

If source string > destination string, the overflow characters may occupy the memory space used by other variables

The null character is appended at the end automatically

Function strncpy() copies the string by specifying the number n of characters to copy

e.g., strncpy(dest, src, n); dest[n] = ‘\0’

If source string is longer than the destination string, the overflow characters are discarded automatically

You have to place the null character manually

10/13/10

Buffer Overflow

Return Address Smashing

The Unix fingerd() system call, which runs as root (it needs to access sensitive files), used to be vulnerable to buffer overflow

Write malicious code into buffer and overwrite return address to point to the malicious code

When return address is reached, it will now execute the malicious code with the full rights and privileges of root

10/13/10

Buffer Overflow

12

void fingerd (…) {

char buf[80];

get(buf);

}

current frame

previous frames

f() arguments

buffer

local variables

program code

program code

next location

padding

attacker’s input

malicious code

return address

f() arguments

EIP

return address

EIP

12

The fragment of C code for fingerd() above shows the problem

A local array buf[80] is declared, which gets allocated on the stack, but the function get does not do bounds checking, and hence makes buffer overflows possible.

2009-01-28

Operating Systems: Basic Concepts

CS 166

Unix Shell Command Substitution

The Unix shell enables a command argument to be obtained from the standard output of another

This feature is called command substitution

When parsing command line, the shell replaces the output of a command between back quotes with the output of the command

Example:

File name.txt contains string farasi

The following two commands are equivalent

finger `cat name.txt`

finger farasi

10/13/10

Buffer Overflow

13

Shellcode Injection

An exploit takes control of attacked computer so injects code to “spawn a shell” or “shellcode”

A shellcode is:

Code assembled in the CPU’s native instruction set (e.g. x86 , x86-64, arm, sparc, risc, etc.)

Injected as a part of the buffer that is overflowed.

We inject the code directly into the buffer that we send for the attack

A buffer containing shellcode is a “payload”

10/13/10

14

Buffer Overflow

14

Now comes the question of injecting our own code to be executed. We inject the code directly into the buffer that we send for the attack.

Buffer Overflow Mitigation

We know how a buffer overflow happens, but why does it happen?

This problem could not occur in Java; it is a C problem

In Java, objects are allocated dynamically on the heap (except ints, etc.)

Also cannot do pointer arithmetic in Java

In C, however, you can declare things directly on the stack

One solution is to make the buffer dynamically allocated

Another (OS) problem is that fingerd had to run as root

Just get rid of fingerd’s need for root access (solution eventually used)

The program needed access to a file that had sensitive information in it

A new world-readable file was created with the information required by fingerd

10/13/10

Buffer Overflow

15

15

Why doesn’t get do a bounds check and why does the operating system allow writing beyond the array bounds?

In Java can’t just overwrite the stack because you don’t know where the stack is!

In Java, cannot access memory without direct access, since we lack pointer arithmetic

2009-01-28

Operating Systems: Basic Concepts

CS 166

Stack-based buffer overflow detection using a random canary

The canary is placed in the stack prior to the return address, so that any attempt to over-write the return address also over-writes the canary.

10/13/10

Buffer Overflow

16

Buffer

Other local variables

Canary (random)

Return address

Other data

Buffer

Corrupt return address

Attack code

Normal (safe) stack configuration:

Buffer overflow attack attempt:

Overflow data

x

Ch03-OS.pptx

Operating Systems Concepts

1

1

10/13/10

Introduction

A Computer Model

An operating system has to deal with the fact that a computer is made up of a CPU, random access memory (RAM), input/output (I/O) devices, and long-term storage.

2

Disk Drive

RAM

CPU

0

1

2

3

4

5

6

7

8

9

.

.

.

I/O

OS Concepts

An operating system (OS) provides the interface between the users of a computer and that computer’s hardware.

An operating system manages the ways applications access the resources in a computer, including its disk drives, CPU, main memory, input devices, output devices, and network interfaces.

An operating system manages multiple users.

An operating system manages multiple programs.

3

Multitasking

Give each running program a “slice” of the CPU’s time.

The CPU is running so fast that to any user it appears that the computer is running all the programs simultaneously.

4

Public domain image from http://commons.wikimedia.org/wiki/File:Chapters_meeting_2009_Liam_juggling.JPG

The Kernel

The kernel is the core component of the operating system. It handles the management of low-level hardware resources, including memory, processors, and input/output (I/O) devices, such as a keyboard, mouse, or video display.

Most operating systems define the tasks associated with the kernel in terms of a layer metaphor, with the hardware components, such as the CPU, memory, and input/output devices being on the bottom, and users and applications being on the top.

5

User Applications

Non-essential OS Applications

The OS Kernel

CPU, Memory, Input/Output

Userland

Operating System

Hardware

Input/Output

The input/output devices of a computer include things like its keyboard, mouse, video display, and network card, as well as other more optional devices, like a scanner, Wi-Fi interface, video camera, USB ports, etc.

Each such device is represented in an operating system using a device driver, which encapsulates the details of how interaction with that device should be done.

The application programmer interface (API), which the device drivers present to application programs, allows those programs to interact with those devices at a fairly high level, while the operating system does the “heavy lifting” of performing the low-level interactions that make such devices actually work.

6

System Calls

7

User applications don’t communicate directly with low-level hardware components, and instead delegate such tasks to the kernel via system calls.

System calls are usually contained in a collection of programs, that is, a library such as the C library (libc), and they provide an interface that allows applications to use a predefined series of APIs that define the functions for communicating with the kernel.

Examples of system calls include those for performing file I/O (open, close, read, write) and running application programs (exec).

Processes

A process is an instance of a program that is currently executing.

The actual contents of all programs are initially stored in persistent storage, such as a hard drive.

In order to be executed, a program must be loaded into random-access memory (RAM) and uniquely identified as a process.

In this way, multiple copies of the same program can be run as different processes.

For example, we can have multiple copies of MS Powerpoint open at the same time.

8

Process IDs

Each process running on a given computer is identified by a unique nonnegative integer, called the process ID (PID).

Given the PID for a process, we can then associate its CPU time, memory usage, user ID (UID), program name, etc.

9

File Systems

A filesystem is an abstraction of how the external, nonvolatile memory of the computer is organized.

Operating systems typically organize files hierarchically into folders, also called directories.

Each folder may contain files and/or subfolders.

Thus, a volume, or drive, consists of a collection of nested folders that form a tree.

The topmost folder is the root of this tree and is also called the root folder.

10

File System Example

11

File Permissions

File permissions are checked by the operating system to determine if a file is readable, writable, or executable by a user or group of users.

In Unix-like OS’s, a file permission matrix shows who is allowed to do what to the file.

Files have owner permissions, which show what the owner can do, and group permissions, which show what some group id can do, and world permissions, which give default access rights.

12

Memory Management

The RAM memory of a computer is its address space.

It contains both the code for the running program, its input data, and its working memory.

For any running process, it is organized into different segments, which keep the different parts of the address space separate.

As we will discuss, security concerns require that we never mix up these different segments.

13

Memory Organization

Text. This segment contains the actual (binary) machine code of the program.

Data. This segment contains static program variables that have been initialized in the program code.

BSS. This segment, which is named for an antiquated acronym for block started by symbol, contains static variables that are uninitialized.

Heap. This segment, which is also known as the dynamic segment, stores data generated during the execution of a process.

Stack. This segment houses a stack data structure that grows downwards and is used for keeping track of the call structure of subroutines (e.g., methods in Java and functions in C) and their arguments.

14

Memory Layout

15

Virtual Memory

There is generally not enough computer memory for the address spaces of all running processes.

Nevertheless, the OS gives each running process the illusion that it has access to its complete (contiguous) address space.

In reality, this view is virtual, in that the OS supports this view, but it is not really how the memory is organized.

Instead, memory is divided into pages, and the OS keeps track of which ones are in memory and which ones are stored out to disk.

16

ATM

Page Faults

17

Process

1. Process requests virtual address not in memory,

causing a page fault.

2. Paging supervisor pages out

an old block of RAM memory.

3. Paging supervisor locates requested block

on the disk and brings it into RAM memory.

“read 0110101”

“Page fault,

let me fix that.”

Blocks in

RAM memory:

Paging supervisor

External disk

old

new

Virtual Machines

Virtual machine: A view that an OS presents that a process is running on a specific architecture and OS, when really it is something else. E.g., a windows emulator on a Mac.

Benefits:

Hardware Efficiency

Portability

Security

Management

18

Public domain image from http://commons.wikimedia.org/wiki/File:VMM-Type2.JPG

Stack

Dynamic

BSS

Data

Text

Another Program

Hard Drive

Program Sees: Actual Memory:

Ch04-Malware.pptx

Malware: Malicious Software

10/21/2010

Malware

1

1

2009-02-02

CS 166 - Malware

Viruses, Worms, Trojans, Rootkits

Malware can be classified into several categories, depending on propagation and concealment

Propagation

Virus: human-assisted propagation (e.g., open email attachment)

Worm: automatic propagation without human assistance

Concealment

Rootkit: modifies operating system to hide its existence

Trojan: provides desirable functionality but hides malicious operation

Various types of payloads, ranging from annoyance to crime

10/21/2010

Malware

2

2

Name derives from the wooden horse left by the Greeks at the gates of Troy during the siege of Troy

A Trojan horse program intentionally hides malicious activity while pretending to be something else

Usually described as innocuous looking, or software delivered through innocuous means which either allows to take control of systems

Trojan horse programs do not replicate themselves

Sometimes passed on using commonly passed executables, things like jokes forwarded by e-mail

Sometimes marketed/distributed as “remote administration tool”

Often combined with rootkits to disguise activity and remote access

Popularized to an extent by software like Cult of the Dead Cow’s Back Orifice, offered as a free download for running “remote administration” tasks or playing spooky jokes on friends

The line between user-launched worms and Trojans is highly blurred, with many user-launched worms behaving in a manner similar to worms.

Trojans are by definition malicious. The classic movie/television exploit of remotely opening disk drives is a definite symptom of being infected by a Trojan.

Have lately begun using much of the same defense mechanisms used by viruses, there are known Trojans which use WSH to run.

To detect infected computers, attackers often use so called sweep lists, list of IP addresses known to be online. One of the popular ways of doing this is to monitor IRC chat rooms and use the IP addresses of participants in these rooms.

Payload examples

perform amusing or annoying pranks

destroy/corrupt files and applications

monitor and transmit user activity (spyware, logger)

install backdoor (makes the infected computer a zombie)

email spam

launch denial-of-service attack

alter browser settings to display ads

dial out international or 900 numbers (dialer)

2009-02-02

CS 166 - Malware

Insider Attacks

An insider attack is a security breach that is caused or facilitated by someone who is a part of the very organization that controls or builds the asset that should be protected.

In the case of malware, an insider attack refers to a security hole that is created in a software system by one of its programmers.

10/21/2010

Malware

3

Backdoors

A backdoor, which is also sometimes called a trapdoor, is a hidden feature or command in a program that allows a user to perform actions he or she would not normally be allowed to do.

When used in a normal way, this program performs completely as expected and advertised.

But if the hidden feature is activated, the program does something unexpected, often in violation of security policies, such as performing a privilege escalation.

Benign example: Easter Eggs in DVDs and software

10/21/2010

Malware

4

Logic Bombs

A logic bomb is a program that performs a malicious action as a result of a certain logic condition.

The classic example of a logic bomb is a programmer coding up the software for the payroll system who puts in code that makes the program crash should it ever process two consecutive payrolls without paying him.

Another classic example combines a logic bomb with a backdoor, where a programmer puts in a logic bomb that will crash the program on a certain date.

10/21/2010

Malware

5

The Omega Engineering Logic Bomb

An example of a logic bomb that was actually triggered and caused damage is one that programmer Tim Lloyd was convicted of using on his former employer, Omega Engineering Corporation. On July 31, 1996, a logic bomb was triggered on the server for Omega Engineering’s manufacturing operations, which ultimately cost the company millions of dollars in damages and led to it laying off many of its employees.

10/21/2010

Malware

6

The Omega Bomb Code

The Logic Behind the Omega Engineering Time Bomb included the following strings:

7/30/96

Event that triggered the bomb

F:

Focused attention to volume F, which had critical files

F:\LOGIN\LOGIN 12345

Login a fictitious user, 12345 (the back door)

CD \PUBLIC

Moves to the public folder of programs

FIX.EXE /Y F:\*.*

Run a program, called FIX, which actually deletes everything

PURGE F:\/ALL

Prevent recovery of the deleted files

10/21/2010

Malware

7

Defenses against Insider Attacks

Avoid single points of failure.

Use code walk-throughs.

Use archiving and reporting tools.

Limit authority and permissions.

Physically secure critical systems.

Monitor employee behavior.

Control software installations.

10/21/2010

Malware

8

Computer Viruses

A computer virus is computer code that can replicate itself by modifying other files or programs to insert code that is capable of further replication.

This self-replication property is what distinguishes computer viruses from other kinds of malware, such as logic bombs.

Another distinguishing property of a virus is that replication requires some type of user assistance, such as clicking on an email attachment or sharing a USB drive.

10/21/2010

Malware

9

Biological Analogy

Computer viruses share some properties with Biological viruses

10/21/2010

Malware

10

Attack

Penetration

Replication and assembly

Release

Early History

1972 sci-fi novel “When HARLIE Was One” features a program called VIRUS that reproduces itself

First academic use of term virus by PhD student Fred Cohen in 1984, who credits advisor Len Adleman with coining it

In 1982, high-school student Rich Skrenta wrote first virus released in the wild: Elk Cloner, a boot sector virus

(c)Brain, by Basit and Amjood Farooq Alvi in 1986, credited with being the first virus to infect PCs

10/21/2010

Malware

11

Much of the macro classification carries over from viruses, worms based on macro capabilities of programs are programmed in much the same way as viruses, with minor differences

Primary classification has often been based on a worm relying on e-mail or IRC, ICQ, AIM.

Through much of the mid-90s IRC was a popular target, and worms were often combined with Trojans to allow for remotely controlling systems

Examples include IRC.Worm.Ceyda and IRC.Worm.Whacked, the later of which is also a Trojan

Simultaneously with a growth in instant messaging, popular IM clients have been targeted by worms

There are known worms targeting AIM (W32.AimVen.Worm), MSN (W32.Kelvir and variants), ICQ (W32.Bizex), Yahoo Messenger (W32.Hawawi) and pretty much every other popular IM network

P2P networks have been targeted of late, with W32.Hawawi and others spreading through Kazza

E-mail, exploited indirectly by the Morris Worm continues to be a popular propagation method, with worms like W97M.Melissa, and W32.Navidad relying on MAPI to provide them with an easy way to e-mail themselves out.

CS 166 - Malware

2009-02-02

11

Virus Phases

Dormant phase. During this phase, the virus just exists—the virus is laying low and avoiding detection.

Propagation phase. During this phase, the virus is replicating itself, infecting new files on new systems.

Triggering phase. In this phase, some logical condition causes the virus to move from a dormant or propagation phase to perform its intended action.

Action phase. In this phase, the virus performs the malicious action that it was designed to perform, called payload.

This action could include something seemingly innocent, like displaying a silly picture on a computer’s screen, or something quite malicious, such as deleting all essential files on the hard drive.

10/21/2010

Malware

12

Infection Types

Overwriting

Destroys original code

Pre-pending

Keeps original code, possibly compressed

Infection of libraries

Allows virus to be memory resident

E.g., kernel32.dll

Macro viruses

Infects MS Office documents

Often installs in main document template

10/21/2010

Malware

13

virus

compressed

original code

Resident viruses continue running after executing the infected file

Modified system calls

Modified DLLs

Non-resident viruses

Resident viruses are more common than non-resident viruses, and essentially latch onto system calls, DLLs and the like, and stay resident, affecting every program run subsequent to them being introduced into memory.

Non resident viruses are executed every time an infected file is executed

All Windows DLLs have an export table listing the functions provided and their addresses

A virus can hook onto a DLL

Fairly easy for viruses using DLLs to get memory resident

kernel32.dll is a collection of core Windows API calls (system calls) that is imported by most applications

Most viruses relying on patching DLLs usually attack kernel32.dll

For instance W32.Kriz will attack any PE executable, and also kernel32.dll to get a hook on system calls

Hooking system calls may be done by legitimate programs, such as Regmon (a registry monitoring utility)

Viruses hook onto DLLs by either changing their exported symbol table, so as to call malicious code, or by adding mallicious code to the DLL.

CS 166 - Malware

2009-02-02

13

Degrees of Complication

Viruses have various degrees of complication in how they can insert themselves in computer code.

10/21/2010

Malware

14

Concealment

Encrypted virus

Decryption engine + encrypted body

Randomly generate encryption key

Detection looks for decryption engine

Polymorphic virus

Encrypted virus with random variations of the decryption engine (e.g., padding code)

Detection using CPU emulator

Metamorphic virus

Different virus bodies

Approaches include code permutation and instruction replacement

Challenging to detect

10/21/2010

Malware

15

Computer Worms

A computer worm is a malware program that spreads copies of itself without the need to inject itself in other programs, and usually without human interaction.

Thus, computer worms are technically not computer viruses (since they don’t infect other programs), but some people nevertheless confuse the terms, since both spread by self-replication.

In most cases, a computer worm will carry a malicious payload, such as deleting files or installing a backdoor.

10/21/2010

Malware

16

Early History

First worms built in the labs of John Shock and Jon Hepps at Xerox PARC in the early 80s

CHRISTMA EXEC written in REXX, released in December 1987, and targeting IBM VM/CMS systems was the first worm to use e-mail service

The first internet worm was the Morris Worm, written by Cornell student Robert Tappan Morris and released on November 2, 1988

10/21/2010

Malware

17

Much of the macro classification carries over from viruses, worms based on macro capabilities of programs are programmed in much the same way as viruses, with minor differences

Primary classification has often been based on a worm relying on e-mail or IRC, ICQ, AIM.

Through much of the mid-90s IRC was a popular target, and worms were often combined with Trojans to allow for remotely controlling systems

Examples include IRC.Worm.Ceyda and IRC.Worm.Whacked, the later of which is also a Trojan

Simultaneously with a growth in instant messaging, popular IM clients have been targeted by worms

There are known worms targeting AIM (W32.AimVen.Worm), MSN (W32.Kelvir and variants), ICQ (W32.Bizex), Yahoo Messenger (W32.Hawawi) and pretty much every other popular IM network

P2P networks have been targeted of late, with W32.Hawawi and others spreading through Kazza

E-mail, exploited indirectly by the Morris Worm continues to be a popular propagation method, with worms like W97M.Melissa, and W32.Navidad relying on MAPI to provide them with an easy way to e-mail themselves out.

CS 166 - Malware

2009-02-02

17

Worm Development

Identify vulnerability still unpatched

Write code for

Exploit of vulnerability

Generation of target list

Random hosts on the internet

Hosts on LAN

Divide-and-conquer

Installation and execution of payload

Querying/reporting if a host is infected

Initial deployment on botnet

Worm template

Generate target list

For each host on target list

Check if infected

Check if vulnerable

Infect

Recur

Distributed graph search algorithm

Forward edges: infection

Back edges: already infected or not vulnerable

10/21/2010

Malware

18

Worm Propagation

Worms propagate by finding and infecting vulnerable hosts.

They need a way to tell if a host is vulnerable

They need a way to tell if a host is already infected.

10/21/2010

Malware

19

initial infection

Propagation: Theory

Classic epidemic model

N: total number of vulnerable hosts

I(t): number of infected hosts at time t

S(t): number of susceptible hosts at time t

I(t) + S(t) = N

b: infection rate

Differential equation for I(t):

dI/dt = bI(t) S(t)

More accurate models adjust propagation rate over time

10/21/2010

Malware

20

Source:

Cliff C. Zou, Weibo Gong, Don Towsley, and Lixin Gao. The Monitoring and Early Detection of Internet Worms, IEEE/ACM Transactions on Networking, 2005.

Propagation: Practice

Cumulative total of unique IP addresses infected by the first outbreak of Code-RedI v2 on July 19-20, 2001

10/21/2010

Malware

21

Source:

David Moore, Colleen Shannon, and Jeffery Brown. Code-Red: a case study on the spread and victims of an Internet worm, CAIDA, 2002

Trojan Horses

A Trojan horse (or Trojan) is a malware program that appears to perform some useful task, but which also does something with negative consequences (e.g., launches a keylogger).

Trojan horses can be installed as part of the payload of other malware but are often installed by a user or administrator, either deliberately or accidentally.

10/21/2010

Malware

22

Current Trends

Trojans currently have largest infection potential

Often exploit browser vulnerabilities

Typically used to download other malware in multi-stage attacks

10/21/2010

Malware

23

Source:

Symantec Internet Security Threat Report, April 2009

Rootkits

A rootkit modifies the operating system to hide its existence

E.g., modifies file system exploration utilities

Hard to detect using software that relies on the OS itself

RootkitRevealer

By Bryce Cogswell and Mark Russinovich (Sysinternals)

Two scans of file system

High-level scan using the Windows API

Raw scan using disk access methods

Discrepancy reveals presence of rootkit

Could be defeated by rootkit that intercepts and modifies results of raw scan operations

10/21/2010

Malware

24

Malware Zombies

Malware can turn a computer in to a zombie, which is a machine that is controlled externally to perform malicious attacks, usually as a part of a botnet.

10/21/2010

25

Botnet Controller (Attacker)

Victim

Botnet:

Attack Commands

Attack Actions

Financial Impact

Malware often affects a large user population

Significant financial impact, though estimates vary widely, up to $100B per year (mi2g)

Examples

LoveBug (2000) caused $8.75B in damages and shut down the British parliament

In 2004, 8% of emails infected by W32/MyDoom.A at its peak

In February 2006, the Russian Stock Exchange was taken down by a virus.

10/21/2010

Malware

26

26

2009-02-02

CS 166 - Malware

Economics of Malware

New malware threats have grown from 20K to 1.7M in the period 2002-2008

Most of the growth has been from 2006 to 2008

Number of new threats per year appears to be growing an exponential rate.

10/21/2010

Malware

27

Professional Malware

Growth in professional cybercrime and online fraud has led to demand for professionally developed malware

New malware is often a custom-designed variations of known exploits, so the malware designer can sell different “products” to his/her customers.

Like every product, professional malware is subject to the laws of supply and demand.

Recent studies put the price of a software keystroke logger at $23 and a botnet use at $225.

10/21/2010

Malware

28

Image by User:SilverStar from http://commons.wikimedia.org/wiki/File:Supply-demand-equilibrium.svg

used by permission under the Creative Commons Attribution ShareAlike 3.0 License

Adware

10/21/2010

Malware

29

Adware software payload

Adware engine infects

a user’s computer

Computer user

Adware agent

Adware engine requests

advertisements

from adware agent

Advertisers

Advertisers contract with

adware agent for content

Adware agent delivers

ad content to user

Spyware

10/21/2010

Malware

30

Spyware software payload

1. Spyware engine infects

a user’s computer.

Computer user

Spyware data collection agent

2. Spyware process collects

keystrokes, passwords,

and screen captures.

3. Spyware process

periodically sends

collected data to

spyware data collection

agent.

Signatures: A Malware Countermeasure

Scan compare the analyzed object with a database of signatures

A signature is a virus fingerprint

E.g.,a string with a sequence of instructions specific for each virus

Different from a digital signature

A file is infected if there is a signature inside its code

Fast pattern matching techniques to search for signatures

All the signatures together create the malware database that usually is proprietary

10/21/2010

Malware

31

Signatures Database

Common Malware Enumeration (CME)

aims to provide unique, common identifiers to new virus threats

Hosted by MITRE

http://cme.mitre.org/data/list.html

Digital Immune System (DIS)

Create automatically new signatures

10/21/2010

Malware

32

While not completely standardized, virus naming follows a fairly standard convention

Viruses often have multiple names in standard usage, and names reported often depend on the detection software used.

Commonly used prefixes include:

@m: Worms or viruses propagating by e-mail

@mm: Mass mailer worms or viruses

Dr: Dropper programs

Family: A virus which shares characteristics with other viruses in a family

Gen: Similar to family

Int: An intended virus, a virus which failed

Worm: Sometimes used to indicate worms

CS 166 - Malware

2009-02-02

32

White/Black Listing

Maintain database of cryptographic hashes for

Operating system files

Popular applications

Known infected files

Compute hash of each file

Look up into database

Needs to protect the integrity of the database

10/21/2010

Malware

33

Heuristic Analysis

Useful to identify new and “zero day” malware

Code analysis

Based on the instructions, the antivirus can determine whether or not the program is malicious, i.e., program contains instruction to delete system files,

Execution emulation

Run code in isolated emulation environment

Monitor actions that target file takes

If the actions are harmful, mark as virus

Heuristic methods can trigger false alarms

10/21/2010

Malware

34

Shield vs. On-demand

Shield

Background process (service/daemon)

Scans each time a file is touched (open, copy, execute, etc.)

10/21/2010

Malware

35

On-demand

Scan on explicit user request or according to regular schedule

On a suspicious file, directory, drive, etc.

Performance test of scan techniques

Comparative: check the number of already known viruses that are found and the time to perform the scan

Retrospective: test the proactive detection of the scanner for unknown viruses, to verify which vendor uses better heuristics

Anti-viruses are ranked using both parameters:

http://www.av-comparatives.org/

Malicious Code

2008-02-04

35

Online vs Offline Anti Virus Software

Online

Free browser plug-in

Authentication through third party certificate (i.e. VeriSign)

No shielding

Software and signatures update at each scan

Poorly configurable

Scan needs internet connection

Report collected by the company that offers the service

Offline

Paid annual subscription

Installed on the OS

Software distributed securely by the vendor online or a retailer

System shielding

Scheduled software and signatures updates

Easily configurable

Scan without internet connection

Report collected locally and may be sent to vendor

10/21/2010

Malware

36

Quarantine

A suspicious file can be isolated in a folder called quarantine:

E.g,. if the result of the heuristic analysis is positive and you are waiting for db signatures update

The suspicious file is not deleted but made harmless: the user can decide when to remove it or eventually restore for a false positive

Interacting with a file in quarantine it is possible only through the antivirus program

The file in quarantine is harmless because it is encrypted

Usually the quarantine technique is proprietary and the details are kept secret

10/21/2010

Malware

37

Malicious Code

2008-02-04

37

Static vs. Dynamic Analysis

Static Analysis

Checks the code without trying to execute it

Quick scan in white list

Filtering: scan with different antivirus and check if they return same result with different name

Weeding: remove the correct part of files as junk to better identify the virus

Code analysis: check binary code to understand if it is an executable, e.g., PE

Disassembling: check if the byte code shows something unusual

Dynamic Analysis

Check the execution of codes inside a virtual sandbox

Monitor

File changes

Registry changes

Processes and threads

Networks ports

10/21/2010

Malware

38

Virus Detection is Undecidable

Theoretical result by Fred Cohen (1987)

Virus abstractly modeled as program that eventually executes infect

Code for infect may be generated at runtime

Proof by contradiction similar to that of the halting problem

Suppose program isVirus(P) determines whether program P is a virus

Define new program Q as follows:

if (not isVirus(Q))

infect stop

Running isVirus on Q achieves a contradiction

10/21/2010

Malware

39

Theoretically a class of viruses can be found for which there is no minimal detection algorithm

Can thus prove inability to find a perfect virus scanning algorithm and hence a perfect virus scanner

The signatures are behavioral signatures, changing registers, accessing certain memory locations

Signatures are expensive to generate, but cheap to compare against and distinguish between normal computer behavior and abnormal behavior

Virus detection technologies:

Activity monitors rely on monitoring current system activity, help in detecting malware by monitoring specific memory or service access

Signature scanners broadly check files and memory for known virus signatures

File authentication methods rely on authenticating files to make sure they are not really infected by viruses

CS 166 - Malware

2009-02-02

39

Other Undecidable Detection Problems

Detection of a virus

by its appearance

by its behavior

Detection of an evolution of a known virus

Detection of a triggering mechanism

by its appearance

by its behavior

Detection of a virus detector

by its appearance

by its behavior

Detection of an evolution of

a known virus

a known triggering mechanism

a virus detector

10/21/2010

Malware

40

40

Theoretically a class of viruses can be found for which there is no minimal detection algorithm

Can thus prove inability to find a perfect virus scanning algorithm and hence a perfect virus scanner

The signatures are behavioral signatures, changing registers, accessing certain memory locations

Signatures are expensive to generate, but cheap to compare against and distinguish between normal computer behavior and abnormal behavior

2008-02-04

Malicious Code

Resources

Computer Emergency Response Team

Research center funded by the US federal government

Vulnerabilities database

Symantec

Reports on malware trends

Database of malware

Art of Computer Virus Research and Defense by Peter Szor

10/21/2010

Malware

41

41

2009-02-02

CS 166 - Malware

Chart1

1997 1997
1998 1998
1999 1999
2000 2000
2001 2001
2002 2002
2003 2003
2004 2004
2005 2005
2006 2006
Impact
Impact2
Source: Computer Economics
3300000000
3.3
6100000000
6.1
13000000000
13
17100000000
17.1
13200000000
13.2
11100000000
11.1
13000000000
13
17500000000
17.5
14200000000
14.2
13300000000
13.3

Sheet2

Year Impact Impact2
1997 $3B $ 3
1998 $6B $ 6
1999 $13B $ 13
2000 $17B $ 17
2001 $13B $ 13
2002 $11B $ 11
2003 $13B $ 13
2004 $17B $ 18
2005 $14B $ 14
2006 $13B $ 13

Ch03-FilesystemSecurity.pptx

Filesystem Security

1

1

General Principles

Files and folders are managed by the operating system

Applications, including shells, access files through an API

Access control entry (ACE)

Allow/deny a certain type of access to a file/folder by user/group

Access control list (ACL)

Collection of ACEs for a file/folder

A file handle provides an opaque identifier for a file/folder

File operations

Open file: returns file handle

Read/write/execute file

Close file: invalidates file handle

Hierarchical file organization

Tree (Windows)

DAG (Linux)

2

Discretionary Access Control (DAC)

Users can protect what they own

The owner may grant access to others

The owner may define the type of access (read/write/execute) given to others

DAC is the standard model used in operating systems

Mandatory Access Control (MAC)

Alternative model not covered in this lecture

Multiple levels of security for users and documents

Read down and write up principles

3

3

Ripasso DAC

Closed vs. Open Policy

Closed policy

Also called “default secure”

Give Tom read access to “foo”

Give Bob r/w access to “bar

Tom: I would like to read “foo”

Access allowed

Tom: I would like to read “bar”

Access denied

Open Policy

Deny Tom read access to “foo”

Deny Bob r/w access to “bar”

Tom: I would like to read “foo”

Access denied

Tom: I would like to read “bar”

Access allowed

4

4

Default sicuro

Closed Policy with Negative Authorizations and Deny Priority

Give Tom r/w access to “bar”

Deny Tom write access to “bar”

Tom: I would like to read “bar”

Access allowed

Tom: I would like to write “bar”

Access denied

Policy is used by Windows to manage access control to the file system

5

Access Control Entries and Lists

An Access Control List (ACL) for a resource (e.g., a file or folder) is a sorted list of zero or more Access Control Entries (ACEs)

An ACE refers specifies that a certain set of accesses (e.g., read, execute and write) to the resources is allowed or denied for a user or group

Examples of ACEs for folder “Bob’s CS167 Grades”

Bob; Read; Allow

TAs; Read; Allow

TWD; Read, Write; Allow

Bob; Write; Deny

TAs; Write; Allow

6

Linux vs. Windows

Linux

Allow-only ACEs

Access to file depends on ACL of file and of all its ancestor folders

Start at root of file system

Traverse path of folders

Each folder must have execute (cd) permission

Different paths to same file not equivalent

File’s ACL must allow requested access

Windows

Allow and deny ACEs

By default, deny ACEs precede allow ones

Access to file depends only on file’s ACL

ACLs of ancestors ignored when access is requested

Permissions set on a folder usually propagated to descendants (inheritance)

System keeps track of inherited ACE’s

7

7

Linux File Access Control

File Access Control for:

Files

Directories

Therefore…

\dev\ : devices

\mnt\ : mounted file systems

What else? Sockets, pipes, symbolic links…

8

8

Because of the way devices and mounted file systems are represented in Linux as part of the file system, they are also covered by the same access control scheme as normal files.

Linux File System

Tree of directories (folders)

Each directory has links to zero or more files or directories

Hard link

From a directory to a file

The same file can have hard links from multiple directories, each with its own filename, but all sharing owner, group, and permissions

File deleted when no more hard links to it

Symbolic link (symlink)

From a directory to a target file or directory

Stores path to target, which is traversed for each access

The same file or directory can have multiple symlinks to it

Removal of symlink does not affect target

Removal of target invalidates (but not removes) symlinks to it

Analogue of Windows shortcut or Mac OS alias

9

Unix Permissions

Standard for all UNIXes

Every file is owned by a user and has an associated group

Permissions often displayed in compact 10-character notation

To see permissions, use ls –l

jk@sphere:~/test$ ls –l

total 0

-rw-r----- 1 jk ugrad 0 2005-10-13 07:18 file1

-rwxrwxrwx 1 jk ugrad 0 2005-10-13 07:18 file2

10

10

Permissions Examples (Regular Files)

11

read/write/execute to everyone

-rwxrwxrwx

read-only to everyone, including owner

-r--r--r--

read/write/execute for owner, forbidden to everyone else

-rwx------

read/write for owner, read-only for group, forbidden to others

-rw-r-----

read/write for owner, read-only for everyone else

-rw-r—r--

11

Permissions for Directories

Permissions bits interpreted differently for directories

Read bit allows listing names of files in directory, but not their properties like size and permissions

Write bit allows creating and deleting files within the directory

Execute bit allows entering the directory and getting properties of files in the directory

Lines for directories in ls –l output begin with d, as below:

jk@sphere:~/test$ ls –l

Total 4

drwxr-xr-x 2 jk ugrad 4096 2005-10-13 07:37 dir1

-rw-r--r-- 1 jk ugrad 0 2005-10-13 07:18 file1

12

12

Permissions Examples (Directories)

13

full access to everyone

-rwxrwxrwx

full access to owner, group can access known filenames in directory, forbidden to others

drwx--x---

full access to owner and group, forbidden to others

drwxrwx---

all can enter and list the directory, only owner can add/delete files

drwxr-xr-x

13

File Sharing Challenge

Creating and modifying groups requires root

Given a directory with permissions drwx------x and a file in it

Give permission to write the file to user1, user2, user3, … without creating a new group

Selectively revoke a user

Solution 1

Give file write permission for everyone

Create different random hard links: user1-23421, user2-56784, …

Problem! Selectively removing access: hard link can be copied

Solution 2

Create random symbolic links

Problem! Symbolic link tells where it points

14

14

Creating and adding users to groups in Linux requires root. Thus, groups, in a sense, are not “dynamic.” The example on this slide hints at a problem with this permission system: it is difficult to manage by-user access to files.

Working Graphically with Permissions

Several Linux GUIs exist for displaying and changing permissions

In KDE’s file manager Konqueror, right-click on a file and choose Properties, and click on the Permissions tab:

Changes can be made here (more about changes later)

15

15

Special Permission Bits

Three other permission bits exist

Set-user-ID (“suid” or “setuid”) bit

Set-group-ID (“sgid” or “setgid”) bit

Sticky bit

16

16

Set-user-ID

Set-user-ID (“suid” or “setuid”) bit

On executable files, causes the program to run as file owner regardless of who runs it

Ignored for everything else

In 10-character display, replaces the 4th character (x or -) with s (or S if not also executable)

-rwsr-xr-x: setuid, executable by all

-rwxr-xr-x: executable by all, but not setuid

-rwSr--r--: setuid, but not executable - not useful

17

17

Set-group-ID

Set-group-ID (“sgid” or “setgid”) bit

On executable files, causes the program to run with the file’s group, regardless of whether the user who runs it is in that group

On directories, causes files created within the directory to have the same group as the directory, useful for directories shared by multiple users with different default groups

Ignored for everything else

In 10-character display, replaces 7th character (x or -) with s (or S if not also executable)

-rwxr-sr-x: setgid file, executable by all

drwxrwsr-x: setgid directory; files within will have group of directory

-rw-r-Sr--: setgid file, but not executable - not useful

18

18

The setgid bit is used by many games. The executable files are in group games and are setgid. No users are in group games, but the high-score files are. Being setgid games allows games to update high scores!

Sticky Bit

On directories, prevents users from deleting or renaming files they do not own

Ignored for everything else

In 10-character display, replaces 10th character (x or -) with t (or T if not also executable)

drwxrwxrwt: sticky bit set, full access for everyone

drwxrwx--T: sticky bit set, full access by user/group

drwxr--r-T: sticky, full owner access, others can read (useless)

19

19

Working Graphically with Special Bits

Special permission bits can also be displayed and changed through a GUI

In Konqueror’s Permissions window, click Advanced Permissions:

Changes can be made here (more about changes later)

20

20

Root

“root” account is a super-user account, like Administrator on Windows

Multiple roots possible

File permissions do not restrict root

This is dangerous, but necessary, and OK with good practices

21

21

There can be multiple root accounts, but root is the conventional name. Any account with user ID 0 has root powers. This is like the Windows Administrators group. As the system administrator, root can change any file’s owner, group, or permissions, or delete the file, regardless of who owns it or its permissions. This is clearly dangerous, but necessary, and in practice can be secure. Choosing a good root password is very important, as well as minimizing programs and commands which are run as root. Finally, root is the entity charged with making sure that permissions allow no other users to disrupt the system (accidentally or intentionally), but there is nobody doing oversight on root. Thus, it is wise to think twice before doing anything as root, to guard against mistakes.

Becoming Root

su

Changes home directory, PATH, and shell to that of root, but doesn’t touch most of environment and doesn’t run login scripts

su -

Logs in as root just as if root had done so normally

sudo <command>

Run just one command as root

su [-] <user>

Become another non-root user

Root does not require to enter password

22

22

To become root, type su or su - and put in the root password when prompted. Sudo functions similarly, but only for the duration of one command.

Changing Permissions

Permissions are changed with chmod or through a GUI like Konqueror

Only the file owner or root can change permissions

If a user owns a file, the user can use chgrp to set its group to any group of which the user is a member

root can change file ownership with chown (and can optionally change group in the same command)

chown, chmod, and chgrp can take the -R option to recur through subdirectories

23

23

Examples of Changing Permissions

24

Sets the setuid bit on file1. (Doesn’t change execute bit.)

chmod u+s file1

Sets file1’s group to testgrp, if the user is a member of that group

chgrp testgrp file1

Adds group read/write permission to dir1 and everything within it, and group execute permission on files or directories where someone has execute permission

chmod -R g=rwX dir1

Adds group write permission to file1 and file2, denying all access to others

chmod g+w,o-rwx file1 file2

Changes ownership of dir1 and everything within it to root

chown -R root dir1

24

Octal Notation

Previous slide’s syntax is nice for simple cases, but bad for complex changes

Alternative is octal notation, i.e., three or four digits from 0 to 7

Digits from left (most significant) to right(least significant): [special bits][user bits][group bits][other bits]

Special bit digit = (4 if setuid) + (2 if setgid) + (1 if sticky)

All other digits = (4 if readable) + (2 if writable) + (1 if executable)

25

25

Octal Notation Examples

26

read/write/execute to everyone (dangerous!)

777 or 0777

same as 777, plus sticky bit

1777

same as 775, plus setgid (useful for directories)

2775

read/write for owner, read-only for group, forbidden to others

640 or 0640

read/write/execute for owner and group, read/execute for others

775 or 0775

read/write for owner, read-only for everyone else

644 or 0644

26

Limitations of Unix Permissions

Unix permissions are not perfect

Groups are restrictive

Limitations on file creation

Linux optionally uses POSIX ACLs

Builds on top of traditional Unix permissions

Several users and groups can be named in ACLs, each with different permissions

Allows for finer-grained access control

Each ACL is of the form type:[name]:rwx

Setuid, setgid, and sticky bits are outside the ACL system

27

27

27

Unix permissions are not perfect. There is, for instance, no way to have specific permissions for two or three users, groups, etc. There is also limited ability to set permissions on newly created files, and non-root users cannot create groups and may only use the groups provided by root. At some risk of giving away the next slide, an optional solution is provided in POSIX ACLs.

Linux supports Access Control Lists (ACLs) specified by a POSIX draft standard, which works with Linux filesystems such as Ext2, Ext3, XFS, JFS, and ReiserFS. ACLs build on top of traditional Unix permissions, which still work, but allow for finer-grained access control. Several users and groups can be named in ACLs, each with different permissions. POSIX ACLs also permits a default ACLs for new files within directories.

Minimal ACLs

In a file with minimal ACLs, name does not appear, and the ACLs with type “user” and “group” correspond to Unix user and group permissions, respectively.

When name is omitted from a “user” type ACL entry, it applies to the file owner.

28

28

28

ACL Commands

ACLs are read with the getfacl command and set with the setfacl command.

Changing the ACLs corresponding to Unix permissions shows up in ls -l output, and changing the Unix permissions with chmod changes those ACLs.

Example of getfacl:

29

jimmy@techhouse:~/test$ ls -l

total 4

drwxr-x--- 2 jimmy jimmy 4096 2005-12-02 04:13 dir

jimmy@techhouse:~/test$ getfacl dir

# file: dir

# owner: jimmy

# group: jimmy

user::rwx

group::r-x

other::---

29

29

More ACL Command Examples

30

jimmy@techhouse:~/test$ setfacl -m group::rwx dir

jimmy@techhouse:~/test$ ls -l

total 4

drwxrwx--- 2 jimmy jimmy 4096 2005-12-02 04:13 dir

jimmy@techhouse:~/test$ chmod 755 dir

jimmy@techhouse:~/test$ getfacl dir

# file: dir

# owner: jimmy

# group: jimmy

user::rwx

group::r-x

other::r-x

30

30

Note that in the first example, the setfacl command changed the permissions just like chmod would. In the second, chmod's permissions change is reflected in the getfacl output.

Extended ACLs

ACLs that say more than Unix permissions are extended ACLs

Specific users and groups can be named and given permissions via ACLs, which fall under the group class (even for for ACLs naming users and not groups)

With extended ACLs, mapping to and from Unix permissions is a bit complicated.

User and other classes map directly to the corresponding Unix permission bits

Group class contains named users and groups as well as owning group permissions. How to map?

31

31

31

Mask-type ACLs

Unix group permissions now map to an ACL of type “mask”, which is an upper bound on permissions for all group class ACLs.

All group class ACLs are logically and-ed with the mask before taking effect

rw-—xrw- & r-x—x--- = r----x--

The ACL of type “group” with no name still refers to the Unix owning group

Mask ACLs are created automatically with the necessary bits such that they do not restrict the other ACLs at all, but this can be changed

32

32

32

Extended ACL Example

33

jimmy@techhouse:~/test$ ls -l

total 4

drwxr-xr-x 2 jimmy jimmy 4096 2005-12-02 04:13 dir

jimmy@techhouse:~/test$ setfacl -m user:joe:rwx dir

jimmy@techhouse:~/test$ getfacl dir

# file: dir

# owner: jimmy

# group: jimmy

user::rwx

user:joe:rwx

group::r-x

mask::rwx

other::r-x

jimmy@techhouse:~/test$ ls -l

total 8

drwxrwxr-x+ 2 jimmy jimmy 4096 2005-12-02 04:13 dir

33

33

Extended ACL Example Explained

The preceding slide grants the named user joe read, write, and execute access to dir.

dir now has extended rather than minimal ACLs.

The mask is set to rwx, the union of the two group class ACLs (named user joe and the owning group).

In ls -l output, the group permission bits show the mask, not the owning group ACL

Effective owning group permissions are the logical and of the owning group ACL and the mask, which still equals r-x.

This could reduce the effective owning group permissions if the mask is changed to be more restrictive.

The + in the ls -l output after the permission bits indicates that there are extended ACLs, which can be viewed with getfacl.

34

34

34

Default ACLs

The kind of ACLs we've mentioned so far are access ACLs.

A directory can have an additional set of ACLs, called default ACLs, which are inherited by files and subdirectories created within that directory.

Subdirectories inherit the parent directory's default ACLs as both their default and their access ACLs.

Files inherit the parent directory's default ACLs only as their access ACLs, since they have no default ACLs.

The inherited permissions for the user, group, and other classes are logically and-ed with the traditional Unix permissions specified to the file creation procedure.

35

35

35

Default ACL Example

36

jimmy@techhouse:~/test$ setfacl -d -m group:webmaster:rwx dir

jimmy@techhouse:~/test$ getfacl dir

# file: dir

# owner: jimmy

# group: jimmy

user::rwx

user:joe:rwx

group::r-x

mask::rwx

other::r-x

default:user::rwx

default:group::r-x

default:group:webmaster:rwx

default:mask::rwx

default:other::r-x

Note how this starts the default ACLs out as equal to the existing access ACLs plus the specified changes.

36

36

Default ACL Example Continued

37

jimmy@techhouse:~/test$ mkdir dir/subdir

jimmy@techhouse:~/test$ getfacl dir/subdir

# file: dir/subdir

# owner: jimmy

# group: jimmy

user::rwx

group::r-x

group:webmaster:rwx

mask::rwx

other::r-x

default:user::rwx

default:group::r-x

default:group:webmaster:rwx

default:mask::rwx

default:other::r-x

The default ACLs from the parent directory are both the access and default ACLs for this directory. Group webmaster has full access.

37

37

Default ACL Example Continued

38

jimmy@techhouse:~/test$ touch dir/file

jimmy@techhouse:~/test$ ls -l dir/file

-rw-rw-r--+ 1 jimmy jimmy 0 2005-12-02 11:36 dir/file

jimmy@techhouse:~/test$ getfacl dir/file

# file: dir/file

# owner: jimmy

# group: jimmy

user::rw-

group::r-x #effective:r--

group:webmaster:rwx #effective:rw-

mask::rw-

other::r--

The default ACLs from the parent directory are the basis for the access ACLs on this file, but since touch creates files without any execute bit set, the user and other classes, and the group class as well via the mask ACL, have their execute bits removed to match.

38

38

NTFS Permissions

39

NTFS Partition

ACL

User 1

User 2

Read

Group 1

User 1

Read

Group 1

Full Control

Full Control

ACE

ACE

39

Basic NTFS Permissions

40

Group A

User 1

Multiple NTFS permissions

41

NTFS permissions are cumulative

File permissions override folder permissions

Deny overrides Allow

File1

File2

Group B

Group A

Write denied

User 1

Read

Read/Write

Folder A

Group B

Write

NTFS: permission inheritance

42

Folder A

Access allowed for File 1

Access denied for File 1

Block of Inheritance

Permission Inheritance

File1

Read/Write

Read/Write

Folder A

File1

42

NTFS File Permissions

Explicit: set by the owner for each user/group.

Inherited: dynamically inherited from the explicit permissions of ancestor folders.

Effective: obtained by combining the explicit and inherited permission.

43

Rules

inherited

explicit

effective

Determining effective permissions:

By default, a user/group has no privileges.

Explicit permissions override conflicting inherited permissions.

Denied permissions override conflicting allowed permissions.

43

Access Control Algorithm

The DACL of a file or folder is a sorted list of ACEs

Local ACEs precede inherited ACEs

ACEs inherited from folder F precede those inherited from parent of F

Among those with same source, Deny ACEs precede Allow ACEs

Algorithm for granting access request (e.g., read and execute):

ACEs in the DACL are examined in order

Does the ACE refer to the user or a group containing the user?

If so, do any of the accesses in the ACE match those of the request?

If so, what type of ACE is it?

Deny: return ACCESS_DENIED

Allow: grant the specified accesses and if there are no remaining accesses to grant, return ACCESS_ALLOWED

If we reach the end of the DACL and there are remaining requested accesses that have not been granted yet, return ACCESS_DENIED

44

Example

45

Customers Group Write Folder1

Marketing Group Read Folder1

Customers Group Read Folder1

Marketing Group Write Folder2

Customers Group Modify Folder1

File2 should only be accessible to Marketing Group, and only for read access

File2

Folder1

Folder2

File1

User1

NTFS

Customers Group

Marketing Group

45

NTFS move vs. copy in same volume

If you move a file or a folder inside the same volume your permission will be the same of the source folder

If you copy a file or a folder inside the same volume your permission will be the same of the destination folder

46

NTFS E:\

Copy

Move

NTFS move vs. copy across volumes

If you copy or move a file or a folder on different volumes your permission will be the same of the destination folder

47

NTFS D:\

NTFS E:\

NTFS C:\

Copy

Move

Setting File Permissions in Win XP

48

NTFS permissions in Windows XP Pro are disabled by default.

Using Folder Options… from Tools menu inside Windows Explorer is possible to activate NTFS permission in windows by unchecking Use simple file sharing

Qui devo cambiare le immagini dalla versione in inglese di windows

48

Windows Tools

Access control management tools provide detailed information and controls, across multiple dialogs.

Focus on single file/folders.

It is challenging for an inexperienced user, or a system administrator dealing with very large file structures, to gain a global view of permissions within the file system

49

Treemap Access Control Evaluator (TrACE)

50

Alexander Heitzmann, Bernardo Palazzi, Charalampos Papamanthou, Roberto Tamassia. Effective Visualization of File System Access Control, VizSEC 2008

Sponsors:

TrACE Highlights

At a glance, determine the explicit, inherited, and effective permissions of files and folders.

Understand access control relationships between files and their ancestors

Quickly evaluate large directory structures and find problem areas

Layout based on treemaps

51

What is a Treemap?

A visualization method to display large hierarchical data structures (trees)

Layout based on nested rectangles.

Treemaps were introduced by Ben Shneiderman in “Tree visualization with tree-maps: 2-d space-filling approach”; TOG 1991

52

A

B

C

F

E

D

53

53

54

Acknowledgment

Much of these POSIX ACL slides are adapted (and some pictures are taken) from Andreas Grünbacher’s paper POSIX Access Control Lists on Linux, available online at: http://www.suse.de/~agruen/acl/linux-acls/

55

55

55

Read

Open files and subfolders

Open files

List Folder Contents

Read and Execute

Write

Modify

Full Control

NTFS Permission

Folders

Files

Not applicable

List contents of folder, traverse

folder to open subfolders

Create subfolders and add files

Not applicable

Open files, execute

programs

All the above + delete

All the above +

change permissions

and take ownership,

delete subfolders

All the above

Modify files

All the above +

change permissions

and take ownership

Ch06-Firewalls.pptx

Firewalls, Tunnels, and Network Intrusion Detection

1

1

Firewalls

A firewall is an integrated collection of security measures designed to prevent unauthorized electronic access to a networked computer system.

A network firewall is similar to firewalls in building construction, because in both cases they are intended to isolate one "network" or "compartment" from another.

2

Firewall Policies

To protect private networks and individual machines from the dangers of the greater Internet, a firewall can be employed to filter incoming or outgoing traffic based on a predefined set of rules called firewall policies.

3

Trusted internal network

Firewall

Firewall policies

Untrusted

Internet

Policy Actions

Packets flowing through a firewall can have one of three outcomes:

Accepted: permitted through the firewall

Dropped: not allowed through with no indication of failure

Rejected: not allowed through, accompanied by an attempt to inform the source that the packet was rejected

Policies used by the firewall to handle packets are based on several properties of the packets being inspected, including the protocol used, such as:

TCP or UDP

the source and destination IP addresses

the source and destination ports

the application-level payload of the packet (e.g., whether it contains a virus).

4

Blacklists and White Lists

There are two fundamental approaches to creating firewall policies (or rulesets) to effectively minimize vulnerability to the outside world while maintaining the desired functionality for the machines in the trusted internal network (or individual computer).

Blacklist approach

All packets are allowed through except those that fit the rules defined specifically in a blacklist.

This type of configuration is more flexible in ensuring that service to the internal network is not disrupted by the firewall, but is naïve from a security perspective in that it assumes the network administrator can enumerate all of the properties of malicious traffic.

Whitelist approach

A safer approach to defining a firewall ruleset is the default-deny policy, in which packets are dropped or rejected unless they are specifically allowed by the firewall.

5

Firewall Types

packet filters (stateless)

If a packet matches the packet filter's set of rules, the packet filter will drop or accept it

"stateful" filters

it maintains records of all connections passing through it and can determine if a packet is either the start of a new connection, a part of an existing connection, or is an invalid packet.

application layer

It works like a proxy it can “understand” certain applications and protocols.

It may inspect the contents of the traffic, blocking what it views as inappropriate content (i.e. websites, viruses, vulnerabilities, ...)

6

Stateless Firewalls

A stateless firewall doesn’t maintain any remembered context (or “state”) with respect to the packets it is processing. Instead, it treats each packet attempting to travel through it in isolation without considering packets that it has processed previously.

7

Trusted internal

network

SYN

Seq = x

Port=80

SYN-ACK

Seq = y

Ack = x + 1

ACK

Seq = x + 1

Ack = y + 1

Allow outbound SYN packets, destination port=80

Allow inbound SYN-ACK packets, source port=80

Client

Server

Firewall

Stateless Restrictions

Stateless firewalls may have to be fairly restrictive in order to prevent most attacks.

8

Trusted internal

network

SYN

Seq = y

Port=80

Allow outbound SYN packets, destination port=80

Drop inbound SYN packets,

Allow inbound SYN-ACK packets, source port=80

Client

Attacker

(blocked)

Firewall

Statefull Firewalls

Stateful firewalls can tell when packets are part of legitimate sessions originating within a trusted network.

Stateful firewalls maintain tables containing information on each active connection, including the IP addresses, ports, and sequence numbers of packets.

Using these tables, stateful firewalls can allow only inbound TCP packets that are in response to a connection initiated from within the internal network.

9

Statefull Firewall Example

Allow only requested TCP connections:

10

Trusted internal

network

SYN

Seq = x

Port=80

SYN-ACK

Seq = y

Ack = x + 1

ACK

Seq = x + 1

Ack = y + 1

Allow outbound TCP sessions,

destination port=80

Client

SYN-ACK

Seq = y

Port=80

Attacker

(blocked)

Established TCP session:

(128.34.78.55, 76.120.54.101)

128.34.78.55

76.120.54.101

Firewall state table

Server

Firewall

Tunnels

The contents of TCP packets are not normally encrypted, so if someone is eavesdropping on a TCP connection, he can often see the complete contents of the payloads in this session.

One way to prevent such eavesdropping without changing the software performing the communication is to use a tunneling protocol.

In such a protocol, the communication between a client and server is automatically encrypted, so that useful eavesdropping is infeasible.

11

Tunneling Prevents Eavesdropping

Packets sent over the Internet are automatically encrypted.

12

Server

Client

Tunneling protocol

(does end-to-end encryption and decryption)

Payloads are encrypted here

TCP/IP

TCP/IP

Untrusted Internet

Secure Shell (SSH)

A secure interactive command session:

The client connects to the server via a TCP session.

The client and server exchange information on administrative details, such as supported encryption methods and their protocol version, each choosing a set of protocols that the other supports.

The client and server initiate a secret-key exchange to establish a shared secret session key, which is used to encrypt their communication (but not for authentication). This session key is used in conjunction with a chosen block cipher (typically AES, 3DES) to encrypt all further communications.

The server sends the client a list of acceptable forms of authentication, which the client will try in sequence. The most common mechanism is to use a password or the following public-key authentication method:

If public-key authentication is the selected mechanism, the client sends the server its public key.

The server then checks if this key is stored in its list of authorized keys. If so, the server encrypts a challenge using the client’s public key and sends it to the client.

The client decrypts the challenge with its private key and responds to the server, proving its identity.

Once authentication has been successfully completed, the server lets the client access appropriate resources, such as a command prompt.

13

IPSec

IPSec defines a set of protocols to provide confidentiality and authenticity for IP packets

Each protocol can operate in one of two modes, transport mode or tunnel mode.

In transport mode, additional IPsec header information is inserted before the data of the original packet, and only the payload of the packet is encrypted or authenticated.

In tunnel mode, a new packet is constructed with IPsec header information, and the entire original packet, including its header, is encapsulated as the payload of the new packet.

14

Virtual Private Networking (VPN)

Virtual private networking (VPN) is a technology that allows private networks to be safely extended over long physical distances by making use of a public network, such as the Internet, as a means of transport.

VPN provides guarantees of data confidentiality, integrity, and authentication, despite the use of an untrusted network for transmission.

There are two primary types of VPNs, remote access VPN and site-to-site VPN.

15

Types of VPNs

Remote access VPNs allow authorized clients to access a private network that is referred to as an intranet.

For example, an organization may wish to allow employees access to the company network remotely but make it appear as though they are local to their system and even the Internet itself.

To accomplish this, the organization sets up a VPN endpoint, known as a network access server, or NAS. Clients typically install VPN client software on their machines, which handle negotiating a connection to the NAS and facilitating communication.

Site-to-site VPN solutions are designed to provide a secure bridge between two or more physically distant networks.

Before VPN, organizations wishing to safely bridge their private networks purchased expensive leased lines to directly connect their intranets with cabling.

16

Intrusion Detection Systems

Intrusion

Actions aimed at compromising the security of the target (confidentiality, integrity, availability of computing/networking resources)

Intrusion detection

The identification through intrusion signatures and report of intrusion activities

Intrusion prevention

The process of both detecting intrusion activities and managing automatic responsive actions throughout the network

17

IDS Components

The IDS manager compiles data from the IDS sensors to determine if an intrusion has occurred.

This determination is based on a set of site policies, which are rules and conditions that define probable intrusions.

If an IDS manager detects an intrusion, then it sounds an alarm.

18

Untrusted Internet

IDS Manager

IDS Sensor

router

router

router

IDS Sensor

Firewall

Intrusions

An IDS is designed to detect a number of threats, including the following:

masquerader: an attacker who is falsely using the identity and/or credentials of a legitimate user to gain access to a computer system or network

Misfeasor: a legitimate user who performs actions he is not authorized to do

Clandestine user: a user who tries to block or cover up his actions by deleting audit files and/or system logs

In addition, an IDS is designed to detect automated attacks and threats, including the following:

port scans: information gathering intended to determine which ports on a host are open for TCP connections

Denial-of-service attacks: network attacks meant to overwhelm a host and shut out legitimate accesses

Malware attacks: replicating malicious software attacks, such as Trojan horses, computer worms, viruses, etc.

ARP spoofing: an attempt to redirect IP traffic in a local-area network

DNS cache poisoning: a pharming attack directed at changing a host’s DNS cache to create a falsified domain-name/IP-address association

19

Possible Alarm Outcomes

Alarms can be sounded (positive) or not (negative)

20

Intrusion Attack

No Intrusion Attack

Alarm

Sounded

No

Alarm

Sounded

True Positive

False Positive

True Negative

False Negative

The Base-Rate Fallacy

It is difficult to create an intrusion detection system with the desirable properties of having both a high true-positive rate and a low false-negative rate.

If the number of actual intrusions is relatively small compared to the amount of data being analyzed, then the effectiveness of an intrusion detection system can be reduced.

In particular, the effectiveness of some IDSs can be misinterpreted due to a statistical error known as the base-rate fallacy.

This type of error occurs when the probability of some conditional event is assessed without considering the “base rate” of that event.

21

Base-Rate Fallacy Example

Suppose an IDS is 99% accurate, having a 1% chance of false positives or false negatives. Suppose further…

An intrusion detection system generates 1,000,100 log entries.

Only 100 of the 1,000,100 entries correspond to actual malicious events.

Because of the success rate of the IDS, of the 100 malicious events, 99 will be detected as malicious, which means we have 1 false negative.

Nevertheless, of the 1,000,000 benign events, 10,000 will be mistakenly identified as malicious. That is, we have 10,000 false positives!

Thus, there will be 10,099 alarms sounded, 10,000 of which are false alarms. That is, roughly 99% of our alarms are false alarms.

22

IDS Data

In an influential 1987 paper, Dorothy Denning identified several fields that should be included in IDS event records:

Subject: the initiator of an action on the target

Object: the resource being targeted, such as a file, command, device, or network protocol

Action: the operation being performed by the subject towards the object

Exception-condition: any error message or exception condition that was raised by this action

Resource-usage: quantitative items that were expended by the system performing or responding to this action

Time-stamp: a unique identifier for the moment in time when this action was initiated

23

Types of Intrusion Detection Systems

Rule-Based Intrusion Detection

Rules identify the types of actions that match certain known profiles for an intrusion attack, in which case the rule would encode a signature for such an attack. Thus, if the IDS manager sees an event that matches the signature for such a rule, it would immediately sound an alarm, possibly even indicating the particular type of attack that is suspected.

Statistical Intrusion Detection

A profile is built, which is a statistical representation of the typical ways that a user acts or a host is used; hence, it can be used to determine when a user or host is acting in highly unusual, anomalous ways.

Once a user profile is in place, the IDS manager can determine thresholds for anomalous behaviors and then sound an alarm any time a user or host deviates significantly from the stored profile for that person or machine.

24

Ch05-NetworksTCP-IP.pptx

Networks: IP and TCP

11/1/2010

Networks: IP and TCP

1

1

Internet Protocol

Connectionless

Each packet is transported independently from other packets

Unreliable

Delivery on a best effort basis

No acknowledgments

Packets may be lost, reordered, corrupted, or duplicated

IP packets

Encapsulate TCP and UDP packets

Encapsulated into link-layer frames

11/1/2010

Networks: IP and TCP

2

Data link frame

IP packet

TCP or UDP packet

IP Addresses and Packets

IP addresses

IPv4: 32-bit addresses

IPv6: 128-bit addresses

Address subdivided into network, subnet, and host

E.g., 128.148.32.110

Broadcast addresses

E.g., 128.148.32.255

Private networks

not routed outside of a LAN

10.0.0.0/8

172.16.0.0/12

192.168.0.0/16

IP header includes

Source address

Destination address

Packet length (up to 64KB)

Time to live (up to 255)

IP protocol version

Fragmentation information

Transport layer protocol information (e.g., TCP)

11/1/2010

Networks: IP and TCP

3

fragmentation info

source

destination

TTL

prot.

length

v

3

IP Address Space and ICANN

Hosts on the internet must have unique IP addresses

Internet Corporation for Assigned Names and Numbers

International nonprofit organization

Incorporated in the US

Allocates IP address space

Manages top-level domains

Historical bias in favor of US corporations and nonprofit organizations

Examples

003/8 May 94 General Electric

009/8 Aug 92 IBM

012/8 Jun 95 AT&T Bell Labs

013/8 Sep 91 Xerox Corporation

015/8 Jul 94 Hewlett-Packard

017/8 Jul 92 Apple Computer

018/8 Jan 94 MIT

019/8 May 95 Ford Motor

040/8 Jun 94 Eli Lily

043/8 Jan 91 Japan Inet

044/8 Jul 92 Amateur Radio Digital

047/8 Jan 91 Bell-Northern Res.

048/8 May 95 Prudential Securities

054/8 Mar 92 Merck

055/8 Apr 95 Boeing

056/8 Jun 94 U.S. Postal Service

11/1/2010

Networks: IP and TCP

4

A Typical University’s IP Space

Most universities separate their network connecting dorms and the network connecting offices and academic buildings

Dorms

Class B network 138.16.0.0/16 (64K addresses)

Academic buildings and offices

Class B network 128.148.0.0/16 (64K addresses)

CS department

Several class C (/24) networks, each with 254 addresses

11/1/2010

Networks: IP and TCP

5

IP Routing

A router bridges two or more networks

Operates at the network layer

Maintains tables to forward packets to the appropriate network

Forwarding decisions based solely on the destination address

Routing table

Maps ranges of addresses to LANs or other gateway routers

11/1/2010

Networks: IP and TCP

6

Internet Routes

Internet Control Message Protocol (ICMP)

Used for network testing and debugging

Simple messages encapsulated in single IP packets

Considered a network layer protocol

Tools based on ICMP

Ping: sends series of echo request messages and provides statistics on roundtrip times and packet loss

Traceroute: sends series ICMP packets with increasing TTL value to discover routes

11/1/2010

Networks: IP and TCP

7

ICMP Attacks

Ping of death

ICMP specifies messages must fit a single IP packet (64KB)

Send a ping packet that exceeds maximum size using IP fragmentation

Reassembled packet caused several operating systems to crash due to a buffer overflow

Smurf

Ping a broadcast address using a spoofed source address

11/1/2010

Networks: IP and TCP

8

Smurf Attack

11/1/2010

Networks: IP and TCP

9

Attacker

Victim

Amplifying

Network

echo request

echo response

echo response

echo response

IP Vulnerabilities

Unencrypted transmission

Eavesdropping possible at any intermediate host during routing

No source authentication

Sender can spoof source address, making it difficult to trace packet back to attacker

No integrity checking

Entire packet, header and payload, can be modified while en route to destination, enabling content forgeries, redirections, and man-in-the-middle attacks

No bandwidth constraints

Large number of packets can be injected into network to launch a denial-of-service attack

Broadcast addresses provide additional leverage

11/1/2010

Networks: IP and TCP

10

Denial of Service Attack

Send large number of packets to host providing service

Slows down or crashes host

Often executed by botnet

Attack propagation

Starts at zombies

Travels through tree of internet routers rooted

Ends at victim

IP source spoofing

Hides attacker

Scatters return traffic from victim

11/1/2010

Networks: IP and TCP

11

Source:

M.T. Goodrich, Probabalistic Packet Marking for Large-Scale IP Traceback, IEEE/ACM Transactions on Networking 16:1, 2008.

IP Traceback

Problem

How to identify leaves of DoS propagation tree

Routers next to attacker

Issues

There are more than 2M internet routers

Attacker can spoof source address

Attacker knows that traceback is being performed

Approaches

Filtering and tracing (immediate reaction)

Messaging (additional traffic)

Logging (additional storage)

Probabilistic marking

11/1/2010

Networks: IP and TCP

12

Probabilistic Packet Marking

Method

Random injection of information into packet header

Changes seldom used bits

Forward routing information to victim

Redundancy to survive packet losses

Benefits

No additional traffic

No router storage

No packet size increase

Can be performed online or offline

11/1/2010

Networks: IP and TCP

13

Transmission Control Protocol

TCP is a transport layer protocol guaranteeing reliable data transfer, in-order delivery of messages and the ability to distinguish data for multiple concurrent applications on the same host

Most popular application protocols, including WWW, FTP and SSH are built on top of TCP

TCP takes a stream of 8-bit byte data, packages it into appropriately sized segment and calls on IP to transmit these packets

Delivery order is maintained by marking each packet with a sequence number

Every time TCP receives a packet, it sends out an ACK to indicate successful receipt of the packet.

TCP generally checks data transmitted by comparing a checksum of the data with a checksum encoded in the packet

11/1/2010

Networks: IP and TCP

14

Ports

TCP supports multiple concurrent applications on the same server

Accomplishes this by having ports, 16 bit numbers identifying where data is directed

The TCP header includes space for both a source and a destination port, thus allowing TCP to route all data

In most cases, both TCP and UDP use the same port numbers for the same applications

Ports 0 through 1023 are reserved for use by known protocols.

Ports 1024 through 49151 are known as user ports, and should be used by most user programs for listening to connections and the like

Ports 49152 through 65535 are private ports used for dynamic allocation by socket libraries

11/1/2010

Networks: IP and TCP

15

TCP Packet Format

11/1/2010

Networks: IP and TCP

16

Bit Offset 0-3 4-7 8-15 16-18 19-31
0 Source Port Destination Port
32 Sequence Number
64 Acknowledgment Number
96 Offset Reserved Flags Window Size
128 Checksum Urgent Pointer
160 Options
>= 160 Payload

Establishing TCP Connections

TCP connections are established through a three way handshake.

The server generally has a passive listener, waiting for a connection request

The client requests a connection by sending out a SYN packet

The server responds by sending a SYN/ACK packet, indicating an acknowledgment for the connection

The client responds by sending an ACK to the server thus establishing connection

11/1/2010

Networks: IP and TCP

17

SYN

Seq = x

SYN-ACK

Seq = y

Ack = x + 1

ACK

Seq = x + 1

Ack = y + 1

SYN Flood

Typically DOS attack, though can be combined with other attack such as TCP hijacking

Rely on sending TCP connection requests faster than the server can process them

Attacker creates a large number of packets with spoofed source addresses and setting the SYN flag on these

The server responds with a SYN/ACK for which it never gets a response (waits for about 3 minutes each)

Eventually the server stops accepting connection requests, thus triggering a denial of service.

Can be solved in multiple ways

One of the common way to do this is to use SYN cookies

11/1/2010

Networks: IP and TCP

18

18

SYN cookies: Instead of allocating space on the connection table, the sequence number on the SYN/ACK packet is a carefully calculated hash of the connection requestors details, and when the server receives a response it adds the connection to the connection table after verifying information in the cookie.

TCP Data Transfer

During connection initialization using the three way handshake, initial sequence numbers are exchanged

The TCP header includes a 16 bit checksum of the data and parts of the header, including the source and destination

Acknowledgment or lack thereof is used by TCP to keep track of network congestion and control flow and such

TCP connections are cleanly terminated with a 4-way handshake

The client which wishes to terminate the connection sends a FIN message to the other client

The other client responds by sending an ACK

The other client sends a FIN

The original client now sends an ACK, and the connection is terminated

11/1/2010

Networks: IP and TCP

19

19

Sequence numbers are 32 bit numbers, wrapping to 0. ACKs include sequence number for the received package so sender can keep track of packets received by the receiver.

TCP Data Transfer and Teardown

11/1/2010

Networks: IP and TCP

20

Data seq=x

Ack seq=x+1

Data seq=y

Ack seq=y+1

Client

Server

Client

Server

Fin seq=x

Ack seq=x+1

Fin seq=y

Ack seq=y+1

TCP Congestion Control

During the mid-80s it was discovered that uncontrolled TCP messages were causing large scale network congestion

TCP responded to congestion by retransmitting lost packets, thus making the problem was worse

What is predominantly used today is a system where ACKs are used to determine the maximum number of packets which should be sent out

Most TCP congestion avoidance algorithms, avoid congestion by modifying a congestion window (cwnd) as more cumulative ACKs are received

Lost packets are taken to be a sign of network congestion

TCP begins with an extremely low cwnd and rapidly increases the value of this variable to reach bottleneck capacity

At this point it shifts to a collision detection algorithm which slowly probes the network for additional bandwidth

TCP congestion control is a good idea in general but allows for certain attacks.

11/1/2010

Networks: IP and TCP

21

Optimistic ACK Attack

An optimistic ACK attack takes advantage of the TCP congestion control

It begins with a client sending out ACKs for data segments it hasn’t yet received

This flood of optimistic ACKs makes the servers TCP stack believe that there is a large amount of bandwidth available and thus increase cwnd

This leads to the attacker providing more optimistic ACKs, and eventually bandwidth use beyond what the server has available

This can also be played out across multiple servers, with enough congestion that a certain section of the network is no longer reachable

There are no practical solutions to this problem

11/1/2010

Networks: IP and TCP

22

Session Hijacking

Also commonly known as TCP Session Hijacking

A security attack over a protected network

Attempt to take control of a network session

Sessions are server keeping state of a client’s connection

Servers need to keep track of messages sent between client and the server and their respective actions

Most networks follow the TCP/IP protocol

IP Spoofing is one type of hijacking on large network

11/1/2010

Networks: IP and TCP

23

IP Spoofing

IP Spoofing is an attempt by an intruder to send packets from one IP address that appear to originate at another

If the server thinks it is receiving messages from the real source after authenticating a session, it could inadvertently behave maliciously

There are two basic forms of IP Spoofing

Blind Spoofing

Attack from any source

Non-Blind Spoofing

Attack from the same subnet

11/1/2010

Networks: IP and TCP

24

Blind IP Spoofing

The TCP/IP protocol requires that “acknowledgement” numbers be sent across sessions

Makes sure that the client is getting the server’s packets and vice versa

Need to have the right sequence of acknowledgment numbers to spoof an IP identity

11/1/2010

Networks: IP and TCP

25

25

Used to be that programs such as Rlogin used extremely predictable patterns of acknowledgment numbers

Simply by sending packets to the server and getting responses, one could decode the pattern of acknowledgment numbers

Once an intruder had the acknowledgment number algorithm, it was a simple matter of sending packets with the correct numbers to spoof a client

Most modern systems make acknowledgment sequences random so this cannot be done

Non-Blind IP Spoofing

IP Spoofing without inherently knowing the acknowledgment sequence pattern

Done on the same subnet

Use a packet sniffer to analyze the sequence pattern

Packet sniffers intercept network packets

Eventually decodes and analyzes the packets sent across the network

Determine the acknowledgment sequence pattern from the packets

Send messages to server with actual client's IP address and with validly sequenced acknowledgment number

11/1/2010

Networks: IP and TCP

26

Packet Sniffers

Packet sniffers “read” information traversing a network

Packet sniffers intercept network packets, possibly using ARP cache poisoning

Can be used as legitimate tools to analyze a network

Monitor network usage

Filter network traffic

Analyze network problems

Can also be used maliciously

Steal information (i.e. passwords, conversations, etc.)

Analyze network information to prepare an attack

Packet sniffers can be either software or hardware based

Sniffers are dependent on network setup

11/1/2010

Networks: IP and TCP

27

Detecting Sniffers

Sniffers are almost always passive

They simply collect data

They do not attempt “entry” to “steal” data

This can make them extremely hard to detect

Most detection methods require suspicion that sniffing is occurring

Then some sort of “ping” of the sniffer is necessary

It should be a broadcast that will cause a response only from a sniffer

Another solution on switched hubs is ARP watch

An ARP watch monitors the ARP cache for duplicate entries of a machine

If such duplicates appear, raise an alarm

Problem: false alarms

Specifically, DHCP networks can have multiple entires for a single machine

11/1/2010

Networks: IP and TCP

28

Stopping Packet Sniffing

The best way is to encrypt packets securely

Sniffers can capture the packets, but they are meaningless

Capturing a packet is useless if it just reads as garbage

SSH is also a much more secure method of connection

Private/Public key pairs makes sniffing virtually useless

On switched networks, almost all attacks will be via ARP spoofing

Add machines to a permanent store in the cache

This store cannot be modified via a broadcast reply

Thus, a sniffer cannot redirect an address to itself

The best security is to not let them in in the first place

Sniffers need to be on your subnet in a switched hub in the first place

All sniffers need to somehow access root at some point to start themselves up

11/1/2010

Networks: IP and TCP

29

Port Knocking

Broadly port knocking is the act of attempting to make connections to blocked ports in a certain order in an attempt to open a port

Port knocking is fairly secure against brute force attacks since there are 65536k combinations, where k is the number of ports knocked

Port knocking however if very susceptible to replay attacks. Someone can theoretically record port knocking attempts and repeat those to get the same open port again

One good way of protecting against replay attacks would be a time dependent knock sequence.

11/1/2010

Networks: IP and TCP

30

30

Port knocking proceeds as follows:

Client wants to connect to port n on server, port n on server is blocked

Client tries to connect to ports a, b, c and d, not receiving any response while doing so, since the firewall blocks all responses

A port knocking daemon on the server keeps track of all the attempts

Once the correct knocking sequence is received it opens port n.

User Datagram Protocol

UDP is a stateless, unreliable datagram protocol built on top of IP, that is it lies on level 4

It does not provide delivery guarantees, or acknowledgments, but is significantly faster

Can however distinguish data for multiple concurrent applications on a single host.

A lack of reliability implies applications using UDP must be ready to accept a fair amount of error packages and data loss. Some application level protocols such as TFTP build reliability on top of UDP.

Most applications used on UDP will suffer if they have reliability. VoIP, Streaming Video and Streaming Audio all use UDP.

UDP does not come with built in congestion protection, so while UDP does not suffer from the problems associated with optimistic ACK, there are cases where high rate UDP network access will cause congestion.

11/1/2010

Networks: IP and TCP

31

Network Address Translation

Introduced in the early 90s to alleviate IPv4 address space congestion

Relies on translating addresses in an internal network, to an external address that is used for communication to and from the outside world

NAT is usually implemented by placing a router in between the internal private network and the public network.

Saves IP address space since not every terminal needs a globally unique IP address, only an organizationally unique one

While NAT should really be transparent to all high level services, this is sadly not true because a lot of high level communication uses things on IP

11/1/2010

Networks: IP and TCP

32

32

Whenever the router encounters a datagram it translates the address depending on what way the packet is headed

Usually any given internal IP address is bound to one of many IP addresses dynamically when it creates a session

NAT often needs to handle certain protocols like FTP in a special manner

While most NAT routers can handle popular protocols well, even when they need special attention, well, there are protocols which these routers cannot handle, and hence not all applications can run transparently through NAT.

Translation

Router has a pool of private addresses 192.168.10.0/24

33

NAT route

global realm

private realm

192.168.10.237

s=192.168.10.237 d=128.148.36. 11

s=128.148.36.179

d=128.148.36.11

s=128.148.36.11

d=128.148.36.179

s=128.148.36.11

d=192.168.10.237

128.148.36.11

11/1/2010

Networks: IP and TCP

33

IP Packet Modifications

34

source IP address

type of service

total length

ident

header checksum

destination IP address

options

data

vers

len

flags

fragment offset

time to live

proto

padding

0

31

Modified on input

Modified on output

????

Computed

11/1/2010

Networks: IP and TCP

34

Ch02-Locks.pptx

Section 2.2 – Locks and Keys

Digital security often begins with physical security…

1

1

Legal Notice

Laws regarding lock picking vary significantly state-by-state

In most states purchase and possession of dedicated lock picking tools is legal

Penalties are raised significantly if you get caught using them in the commission of a crime

2

Public domain image from http://commons.wikimedia.org/wiki/File:Madame_Restell_in_jail.jpg

What Is Physical Security?

Any physical object that creates a barrier to unauthorized access

This includes: locks, latches, safes, alarms, guards, guard dogs, doors, windows, walls, ceilings, floors, fences, door strikes, door frames and door closers

3

Is Physical Security An IT Concern?

You have been working hard to secure your network from cyber attacks

Redundant layers of antivirus programs, firewalls and intrusion detection systems should protect against every possible electronic method of entry

But what if an attacker gains access to the server room or network wiring closet ...

Is you network still safe?

4

Destructive vs. Nondestructive Entry

Destructive entry

Involves using force to defeat physical security

Methods involve crowbars, bolt cutters and sledge hammers

Negative impact on IT resources is apparent

Remediation steps also obvious

Nondestructive entry

Compromises security without leaving signs of a breach

Defeats intrusion detection

Greater and long-term threat

5

Compromising Locks

For centuries, the lock has been one of the cornerstones of physical security

We rely on dozens of them every day to protect people and assets

The trust most people place in locks is unwarranted

Most locks can be easily compromised with nondestructive methods

Sometimes within seconds and with readily available tools

“Locks keep honest people honest”

6

Lock Picking

Lock picking had been the exclusive art of locksmiths, professional thieves, spies and magicians for hundreds of years

However, with the advent of the Internet, information about lock picking methods and tools has become readily available

E.g., YouTube has many lock picking videos

7

Lock Picking in Movies

Genuine lock picking in movies used to be prohibited

Before 1967, the Hays code (Motion Picture Production Code) required censorship of Hollywood movies

“All detailed (that is, imitable) depiction of crime must be removed, such as lock picking or mixing of chemicals to make explosives”

8

Public domain image from http://commons.wikimedia.org/wiki/File:Motion_Picture_Production_Code.gif

LOCK TYPES

9

Image from http://commons.wikimedia.org/wiki/File:Ancient_warded_lock_open.jpg used with permission under Gnu Free Documentation License 1.2

TSA Lock

The U.S. government has established a set of rules for the inspection of baggage without the presence of passengers

Special TSA-approved locks allow both inspection and protection against theft

An important element is that the inspection must be easily verifiable by the user

10

Public domain government image

Warded Locks

Locks of this type were used in ancient times

The key moves the bolt assisted by a support spring

Security relies on the fact that not all keys pass through the key hole

11

Usually in old style doors or desks

Different concentric obstructions

Easy to lock pick with Skeleton keys

11

Skeleton Key

Usually in old style doors or desks

Different concentric obstructions

Easy to lock pick with Skeleton keys

They come from ancient Rome

12

Images from http://en.wikipedia.org/wiki/File:Warded_locked.png used by permission under Gnu free documentation license 1.2

12

Pick vs. Bypass

Break open a lock in a nondestructive manner can be achieved either through:

Pick: acting on the lock mechanism simulating the operation of the key

Bypass: manipulation of the bolt without using the lock

13

1860: Yale Pin Tumbler Lock

Double-detainer theory of locking

Created shear line

14

Modern version of the Egyptian single-pin design

Utilizes two pins for locking

Public domain image of Linus Yale, Jr.

Image from http://en.wikipedia.org/wiki/File:Pin_tumbler_with_key.svg used with permission under Gnu Free Documentation License 1.2

14

How Does a Pin Tumbler Lock Work?

When a key is not present, the pin stacks are pushed down by the springs so that the driver (top) pins span the plug and the outer casing, preventing the plug from rotating.

When the correct key is inserted, the ridges of the key push up the pin stacks so that the cuts of the pin stacks are aligned with the shear line.

The alignment of the cuts with the shear line allows the plug to be rotated.

15

Images from http://en.wikipedia.org/wiki/File:Pin_tumbler_with_key.svg used with permission under Gnu Free Documentation License 1.2

How Does a Pin Tumbler Lock Work?

If an inappropriate key is insered, then the pins do not align along the shear line and the lock does not turn.

16

Image from http://en.wikipedia.org/wiki/File:Pin_tumbler_with_key.svg used with permission under Gnu Free Documentation License 1.2

LOCK PICKING

17

Photo by Dan Rosenberg included with permission.

Terminology

shell or hull

18

pin

tumbler spring

sheer line

cylinder or plug

keyway

top or driver

bottom or key

driver

Image from http://en.wikipedia.org/wiki/File:Pin_tumbler_with_key.svg used with permission under Gnu Free Documentation License 1.2

Lockpicking Tools

Feelers

Scrubbers

Tension tools

19

Photo by Jennie Rogers included with permission.

Feeler Picking

Apply light tension

Lift one pin at a time

Identify binding pin

Lift binding pin until it reaches the shear line

Setting the binding pin will rotate the lock slightly

Find next pin and repeat the process

20

Image from http://commons.wikimedia.org/wiki/File:Pin_and_tumbler_lock_picking.PNG used with permission under Gnu Free Documentation License 1.2

Scrubbing / Raking

Apply light tension

Work over pins back to front in a circular motion

attempting to pop them into the shear line with the combination of tension

Good for beginners

Usually employ snake pick or half diamond

21

Photo by Jennie Rogers included with permission.

The Math of Lock Picking

Suppose we have

40 different kinds of key blanks

7 pin positions

8 different possible pin heights

Then the total number of possible locks is

40 x 87 = 83,886,080

Not all these are possible, however, as it is difficult to put long teeth next to small teeth.

22

23

Rights Amplification in

Master Keyed Systems

Reverse engineer master key from change key

Each lock has P pins, with D potential cut heights

Create D-1 test keys for each pin position p

Cut all pin positions except p as known change key

Published by Matt Blaze at Penn

24

Rights Amplification (continued)

Query the lock until you find each pin position

i.e. To determine first key cut depth insert each of the D-1 test keys and determine which one does not bind to the pin

Repeat for each pin

25

Rights Amplification Statistics

Consumes P(D-1) blanks

Can reduce to P blanks and file down on the fly

But this looks suspicious

Search space is practically pruned by manufacturer specs

maximum distance limit in legal adjacent cuts

Older installations sometimes require MKs to be higher on the pin stack

Tubular lock

Usually on car alarms or vending machines

6-8 pins

Easy to pick with special tool

The tool could become a new key

26

Images from http://en.wikipedia.org/wiki/File:Tubular_locked.png used with permission under Gnu Free Documentation License 1.2

26

Statistics

4-6 pins, 4-10 levels

106 = 1,000,000 possible keys!

The angular positions of the cylinders allow to obtain about 180 different positions (18010)6 = 3.4012224 × 1019

(Un) fortunately there is a need for some tolerance in locks

27

27

27

Combination Locks

There are locks that do not require a physical key to be opened but a code

Number of combinations is

Number of digits

times

Length of combination

28

Images from http://en.wikipedia.org/wiki/File:Combination_unlocked.png and

http://commons.wikimedia.org/wiki/File:Electronic_lock_yl88.jpg used with permission under Gnu Free Documentation License 1.2

28

Combination Locks

Inexpensive combination padlocks allow attacks based on reducing the space of possible combinations to try

The gears have a higher tolerance of the external disk combination

Nominal number of combinations is 403 = 64,000

Possibilities can be reduced to about 80 by detecting critical gear points

29

Public domain image from http://commons.wikimedia.org/wiki/File:Lock.JPG

E.g., see http://www.wikihow.com/Crack-a-%22Master-Lock%22-Combination-Lock

29

Bumping

A different way of picking locks

Virtually all traditional Yale and similar locks can be opened by bumping

What lock pickers say about bumping:

RELIABLE

REPEATABLE

SIMPLE TO LEARN

30

Photo by Jennie Rogers included with permission.

30

Bump Keys

Driver pins “jump” higher than the cylinder just for an instant

If a light rotational force is applied, the cylinder will turn

Lock bumping is a very fast method for opening the lock

The lock is not damaged in any way

Few key-pin locks cannot be bumped

31

Photo by Jennie Rogers included with permission.

Pick Gun

Manual and electronic pick guns are a popular method for quick and easy ways of opening up doors

The pick gun is used in a similar way but usually has a trigger that creates an upward movement that must be repeated rapidly to open the lock

32

Public domain image from http://en.wikipedia.org/wiki/File:IDET2007_lock_picking_device.jpg

Side Channel Attacks

Rather than attempting to directly bypass security measures, an attacker instead goes around them by exploiting other vulnerabilities not protected by the security mechanisms.

Side channel attacks are sometimes surprisingly simple to perform.

33

High security lock

Cheap hinges

Public domain image by Pearson Scott Foresman from http://en.wikipedia.org/wiki/File:Screen2_%28PSF%29.png

Ch03-OSSec.pptx

Operating Systems Security

1

1

10/13/10

Introduction

The Boot Sequence

The action of loading an operating system into memory from a powered-off state is known as booting or bootstrapping.

When a computer is turned on, it first executes code stored in a firmware component known as the BIOS (basic input/output system).

On modern systems, the BIOS loads into memory the second-stage boot loader, which handles loading the rest of the operating system into memory and then passes control of execution to the operating system.

2

BIOS Passwords

A malicious user could potentially seize execution of a computer at several points in the boot process.

To prevent an attacker from initiating the first stages of booting, many computers feature a BIOS password that does not allow a second-stage boot loader to be executed without proper authentication.

3

Hibernation

Modern machines have the ability to go into a powered-off state known as hibernation.

While going into hibernation, the OS stores the contents of machine’s memory into a hibernation file (such as hiberfil.sys) on disk so the computer can be quickly restored later.

But… without additional security precautions, hibernation exposes a machine to potentially invasive forensic investigation.

4

1. User closes a laptop computer,

putting it into hibernation.

2. Attacker copies the hiberfil.sys

file to discover any unencrypted

passwords that were stored

in memory when the computer

was put into hibernation.

Event Logging

Keeping track of what processes are running, what other machines have interacted with the system via the Internet, and if the operating system has experienced any unexpected or suspicious behavior can often leave important clues not only for troubleshooting ordinary problems, but also for determining the cause of a security breach.

5

Process Explorer

6

Memory and Filesystem Security

7

The contents of a computer are encapsulated in its memory and filesystem.

Thus, protection of a computer’s content has to start with the protection of its memory and its filesystem.

Password Security

The basic approach to guessing passwords from the password file is to conduct a dictionary attack, where each word in a dictionary is hashed and the resulting value is compared with the hashed passwords stored in the password file.

A dictionary of 500,000 “words” is often enough to discover most passwords.

8

Password Salt

One way to make the dictionary attack more difficult to launch is to use salt.

Associate a random number with each userid.

Rather than comparing the hash of an entered password with a stored hash of a password, the system compares the hash of an entered password and the salt for the associated userid with a stored hash of the password and salt.

9

How Password Salt Works

10

Without salt:

With salt:

1. User types userid, X, and password, P.

2. System looks up H, the stored hash of X’s password.

3. System tests whether h(P) = H.

1. User types userid, X, and password, P.

2. System looks up S and H, where S is the random salt for userid X and H is stored hash of S and X’s password.

3. System tests whether h(S||P) = H.

X: H

Password file:

X: S, H

Password file:

How Salt Increases Search Space Size

Assuming that an attacker cannot find the salt associated with a userid he is trying to compromise, then the search space for a dictionary attack on a salted password is of size

2B*D,

where B is the number of bits of the random salt and D is the size of the list of words for the dictionary attack.

For example, if a system uses a 32-bit salt for each userid and its users pick passwords in a 500,000 word dictionary, then the search space for attacking salted passwords would be

232 * 500,000 = 2,147,483,648,000,000,

which is over 2 quadrillion.

Also, even if an attacker can find a salt password for a userid, he only learns one password.

11

Secondary Loader

Operating System

CPU

BIOS

Ch02-Direct.pptx

Direct Attacks on Computational Devices

1

1

10/1/2010

Introduction

Environmental Attacks

Electricity. Computing equipment requires electricity to function; hence, it is vital that such equipment has a steady uninterrupted power supply.

Temperature. Computer chips have a natural operating temperature and exceeding that temperature significantly can severely damage them.

Limited conductance. Because computing equipment is electronic, it relies on there being limited conductance in its environment. If random parts of a computer are connected electronically, then that equipment could be damaged by a short circuit (e.g., in a flood).

2

Eavesdropping

Eavesdropping is the process of secretly listening in on another person’s conversation.

Protection of sensitive information must go beyond computer security and extend to the environment in which this information is entered and read.

Simple eavesdropping techniques include

Using social engineering to allow the attacker to read information over the victim’s shoulder

Installing small cameras to capture the information as it is being read

Using binoculars to view a victim’s monitor through an open window.

These direct observation techniques are commonly referred to as shoulder surfing.

3

Wiretapping

Many communication networks employ the use of inexpensive coaxial copper cables, where information is transmitted via electrical impulses that travel through the cables.

Relatively inexpensive means exist that measure these impulses and can reconstruct the data being transferred through a tapped cable, allowing an attacker to eavesdrop on network traffic.

These wiretapping attacks are passive, in that there is no alteration of the signal being transferred, making them extremely difficult to detect.

4

Signal Eminations

Computer screens emit radio frequencies that can be used to detect what is being displayed.

Visible light reflections can also be used to reconstruct a display from its reflection on a wall, coffee mug, or eyeglasses.

Both of these require the attacker to have a receiver close enough to detect the signal.

5

Acoustic Emissions

6

Dmitri Asonov and Rakesh Agrawal published a paper in 2004 detailing how an attacker could use an audio recording of a user typing on a keyboard to reconstruct what was typed.

microphone to

capture keystroke

sounds

sound recording

device

Each keystroke has minute differences in the sound it produces, and certain keys are known to be pressed more often than others.

After training an advanced neural network to recognize individual keys, their software recognized an average 79% of all keystrokes.

Hardware Keyloggers

A keylogger is any means of recording a victim’s keystrokes, typically used to eavesdrop passwords or other sensitive information.

Hardware keyloggers are typically small connectors that are installed between a keyboard and a computer.

For example, a USB keylogger is a device containing male and female USB connectors, which allow it to be placed between a USB port on a computer and a USB cable coming from a keyboard.

7

USB Keylogger

TEMPEST

TEMPEST is a U.S. government code word for a set of standards for limiting information-carrying electromagnetic emanations from computing equipment.

TEMPEST establishes three zones or levels of protection:

An attacker has almost direct contact with the equipment, such as in an adjacent room or within a meter of the device in the same room.

An attacker can get no closer than 20 meters to the equipment or is blocked by a building to have an equivalent amount of attenuation.

An attacker can get no closer than 100 meters to the equipment or is blocked by a building to have an equivalent amount of attenuation.

8

Emanation Blockage

To block visible light emanations, we can enclose sensitive equipment in a windowless room.

To block acoustic emanations, we can enclose sensitive equipment in a room lined with sound-dampening materials.

To block electromagnetic emanations in the electrical cords and cables, we can make sure every such cord and cable is well grounded and insulated.

9

Faraday Cages

To block electromagnetic emanations in the air, we can surround sensitive equipment with metallic conductive shielding or a mesh of such material, where the holes in the mesh are smaller than the wavelengths of the electromagnetic radiation we wish to block.

Such an enclosure is known as a Faraday cage.

10

Computer Forensics

Computer forensics is the practice of obtaining information contained on an electronic medium, such as computer systems, hard drives, and optical disks, usually for gathering evidence to be used in legal proceedings.

Unfortunately, many of the advanced techniques used by forensic investigators for legal proceedings can also be employed by attackers to uncover sensitive information.

11

Computer Forensics

Forensic analysis typically involves the physical inspection of the components of a computer, sometimes at the microscopic level, but it can also involve electronic inspection of a computer’s parts as well.

12

ATMs

An automatic teller machine (ATM) is any device that allows customers of financial institutions to complete withdrawal and deposit transactions without human assistance.

Typically, customers insert a magnetic stripe credit or debit card, enter a PIN, and then deposit or withdraw cash from their account.

The ATM has an internal cryptographic processor that encrypts the entered PIN and compares it to an encrypted PIN stored on the card (only for older systems that are not connected to a network) or in a remote database.

13

ATM

ATMs

To ensure the confidentiality of customer transactions, each ATM has a cryptographic processor that encrypts all incoming and outgoing information, starting the moment a customer enters their PIN.

The current industry standard for ATM transactions is the Triple DES (3DES) cryptosystem, a legacy symmetric cryptosystem with up to 112 bits of security.

The 3DES secret keys installed on an ATM are either loaded on-site by technicians or downloaded remotely from the ATM vendor.

14

ATM

3DES Encryption

Bank

Attacks on ATMs

Lebanese loop: A perpetrator inserts this sleeve into the card slot of an ATM. When a customer attempts to make a transaction and inserts their credit card, it sits in the sleeve, out of sight from the customer, who thinks that the machine has malfunctioned. After the customer leaves, the perpetrator can then remove the sleeve with the victim’s card.

Skimmer: a device that reads and stores magnetic stripe information when a card is swiped. An attacker can install a skimmer over the card slot of an ATM and store customers’ credit information without their knowledge. Later, this information can be retrieved and used to make duplicates of the original cards.

Fake ATMs: capture both credit/debit cards and PINs at the same time.

15

Ch05-NetworkModelsARP.pptx

10/25/2010

Computer Networks

1

Computer Networks

Circuit and Packet Switching

Circuit switching

Legacy phone network

Single route through sequence of hardware devices established when two nodes start communication

Data sent along route

Route maintained until communication ends

Packet switching

Internet

Data split into packets

Packets transported independently through network

Each packet handled on a best efforts basis

Packets may follow different routes

10/25/2010

Computer Networks

2

2

Packet Switching

10/25/2010

3

Computer Networks

A

C

B

D

F

D

3

2

1

Packet Switching

10/25/2010

4

Computer Networks

A

C

B

D

F

D

3

2

1

Packet Switching

10/25/2010

5

Computer Networks

A

C

B

D

F

D

3

2

1

Packet Switching

10/25/2010

6

Computer Networks

A

C

B

D

F

D

3

2

1

Protocols

A protocol defines the rules for communication between computers

Protocols are broadly classified as connectionless and connection oriented

Connectionless protocol

Sends data out as soon as there is enough data to be transmitted

E.g., user datagram protocol (UDP)

Connection-oriented protocol

Provides a reliable connection stream between two nodes

Consists of set up, transmission, and tear down phases

Creates virtual circuit-switched network

E.g., transmission control protocol (TCP)

10/25/2010

Computer Networks

7

7

Encapsulation

A packet typically consists of

Control information for addressing the packet: header and footer

Data: payload

A network protocol N1 can use the services of another network protocol N2

A packet p1 of N1 is encapsulated into a packet p2 of N2

The payload of p2 is p1

The control information of p2 is derived from that of p1

10/25/2010

Computer Networks

8

Header

Payload

Footer

Header

Payload

Footer

8

Network Layers

Network models typically use a stack of layers

Higher layers use the services of lower layers via encapsulation

A layer can be implemented in hardware or software

The bottommost layer must be in hardware

A network device may implement several layers

A communication channel between two nodes is established for each layer

Actual channel at the bottom layer

Virtual channel at higher layers

10/25/2010

Computer Networks

9

9

Internet Layers

10/25/2010

10

Computer Networks

Application

Transport

Network

Link

Application

Transport

Network

Link

Network

Link

Network

Link

Ethernet

Fiber Optics

Wi-Fi

Physical Layer

Intermediate Layers

Link layer

Local area network: Ethernet, WiFi, optical fiber

48-bit media access control (MAC) addresses

Packets called frames

Network layer

Internet-wide communication

Best efforts

32-bit internet protocol (IP) addresses in IPv4

128-bit IP addresses in IPv6

Transport layer

16-bit addresses (ports) for classes of applications

Connection-oriented transmission layer protocol (TCP)

Connectionless user datagram protocol (UDP)

10/25/2010

Computer Networks

11

Internet Packet Encapsulation

10/25/2010

Computer Networks

12

Application Packet

TCP Data

TCP

Header

IP

Header

Frame

Header

Frame

Footer

Link Layer

Network Layer

Transport Layer

IP Data

Frame Data

Application Layer

Internet Packet Encapsulation

10/25/2010

13

Computer Networks

Data link frame

IP packet

TCP or UDP packet

Application packet

Data link header

IP header

TCP or UDP header

Application packet

Data link footer

The OSI Model

The OSI (Open System Interconnect) Reference Model is a network model consisting of seven layers

Created in 1983, OSI is promoted by the International Standard Organization (ISO)

10/25/2010

Computer Networks

14

14

Network Interfaces

Network interface: device connecting a computer to a network

Ethernet card

WiFi adapter

A computer may have multiple network interfaces

Packets transmitted between network interfaces

Most local area networks, (including Ethernet and WiFi) broadcast frames

In regular mode, each network interface gets the frames intended for it

Traffic sniffing can be accomplished by configuring the network interface to read all frames (promiscuous mode)

10/25/2010

Computer Networks

15

MAC Addresses

Most network interfaces come with a predefined MAC address

A MAC address is a 48-bit number usually represented in hex

E.g., 00-1A-92-D4-BF-86

The first three octets of any MAC address are IEEE-assigned Organizationally Unique Identifiers

E.g., Cisco 00-1A-A1, D-Link 00-1B-11, ASUSTek 00-1A-92

The next three can be assigned by organizations as they please, with uniqueness being the only constraint

Organizations can utilize MAC addresses to identify computers on their network

MAC address can be reconfigured by network interface driver software

10/25/2010

Computer Networks

16

16

MAC addresses can be permanently burned in (BIA), or be a locally administered address (LAA) set by an administrator. A MAC address starting out with 00-08-74 for instance is assigned by Dell, while one starting out with 00-0a-95 is assigned by Apple. Despite the IEEE limitations on LAAs, most OSs allow you to specify an arbitrary MAC for an interface.

Switch

A switch is a common network device

Operates at the link layer

Has multiple ports, each connected to a computer

Operation of a switch

Learn the MAC address of each computer connected to it

Forward frames only to the destination computer

10/25/2010

Computer Networks

17

Combining Switches

Switches can be arranged into a tree

Each port learns the MAC addresses of the machines in the segment (subtree) connected to it

Fragments to unknown MAC addresses are broadcast

Frames to MAC addresses in the same segment as the sender are ignored

10/25/2010

Computer Networks

18

MAC Address Filtering

A switch can be configured to provide service only to machines with specific MAC addresses

Allowed MAC addresses need to be registered with a network administrator

A MAC spoofing attack impersonates another machine

Find out MAC address of target machine

Reconfigure MAC address of rogue machine

Turn off or unplug target machine

Countermeasures

Block port of switch when machine is turned off or unplugged

Disable duplicate MAC addresses

10/25/2010

Computer Networks

19

Viewing and Changing MAC Addresses

Viewing the MAC addresses of the interfaces of a machine

Linux: ifconfig

Windows: ipconfig /all

Changing a MAC address in Linux

Stop the networking service: /etc/init.d/network stop

Change the MAC address: ifconfig eth0 hw ether <MAC-address>

Start the networking service: /etc/init.d/network start

Changing a MAC address in Windows

Open the Network Connections applet

Access the properties for the network interface

Click “Configure …”

In the advanced tab, change the network address to the desired value

Changing a MAC address requires administrator privileges

10/25/2010

Computer Networks

20

In other derivatives like FreeBSD, MacOSX and others stopping the network service is not required, and the hw flag is dropped, leading to a single command ifconfig eth0 ether <MAC-address>

20

ARP

The address resolution protocol (ARP) connects the network layer to the data layer by converting IP addresses to MAC addresses

ARP works by broadcasting requests and caching responses for future use

The protocol begins with a computer broadcasting a message of the form

who has <IP address1> tell <IP address2>

When the machine with <IP address1> or an ARP server receives this message, its broadcasts the response

<IP address1> is <MAC address>

The requestor’s IP address <IP address2> is contained in the link header

The Linux and Windows command arp - a displays the ARP table

Internet Address Physical Address Type

128.148.31.1 00-00-0c-07-ac-00 dynamic

128.148.31.15 00-0c-76-b2-d7-1d dynamic

128.148.31.71 00-0c-76-b2-d0-d2 dynamic

128.148.31.75 00-0c-76-b2-d7-1d dynamic

128.148.31.102 00-22-0c-a3-e4-00 dynamic

128.148.31.137 00-1d-92-b6-f1-a9 dynamic

10/25/2010

Computer Networks

21

CS166: Computer Networks

21

IPv6 does not use ARP, and ARP is instead replaced by Neighbor Discovery Protocol.

ARP Spoofing

The ARP table is updated whenever an ARP response is received

Requests are not tracked

ARP announcements are not authenticated

Machines trust each other

A rogue machine can spoof other machines

10/25/2010

Computer Networks

22

ARP Poisoning (ARP Spoofing)

According to the standard, almost all ARP implementations are stateless

An arp cache updates every time that it receives an arp reply… even if it did not send any arp request!

It is possible to “poison” an arp cache by sending gratuitous arp replies

Using static entries solves the problem but it is almost impossible to manage!

10/25/2010

Computer Networks

23

Telnet Protocol (RFC 854)

Telnet is a protocol that provides a general, bi-directional, not encrypted communication

telnet is a generic TCP client

Allows a computer to connect to another one

Provides remote login capabilities to computers on the Internet

Sends whatever you type

Prints whatever comes back

Useful for testing TCP servers (ASCII based protocols)

10/25/2010

Computer Networks

24

One computer can connect to another to use its services

24

Wireshark

Wireshark is a packet sniffer and protocol analyzer

Captures and analyzes frames

Supports plugins

Usually required to run with administrator privileges

Setting the network interface in promiscuous mode captures traffic across the entire LAN segment and not just frames addressed to the machine

Freely available on www.wireshark.org

10/25/2010

Computer Networks

25

 menu

 main toolbar

 filter toolbar

 packet list pane

 packet details pane

 packet bytes pane

 status bar

26

26

DEMO 1: Configuration using Telnet

10/25/2010

Computer Networks

27

Alice

Bob

Cracker

LAN: 192.168.1.x

.10

.100

CLIENT

SERVER

switch

<< link >>

<< link >>

<< link >>

.1

RJ 45

Ethernet UTP

In a switched network,

packets are sent only

to the destination

computer

One would think that

another computer plugged to the switch cannot sniff traffic

Add a user on server:

adduser user

and then follow program instructions

27

DEMO 1: ARP Spoofing

10/25/2010

Computer Networks

28

Alice

Bob

Cracker

gratuitous arp reply

Bob’s IP→ Cracker’s MAC

arpspoof 192.168.1.10 192.168.1.100

Regular traffic

Using arp poisoning

LAN: 192.168.1.x

.10

.100

CLIENT

SERVER

switch

.1

MAC: 00:0A:E4:2E:9B:11

MAC: 00:22:64:34:60:88

gratuitous arp reply

Alice’s IP→ Cracker’s MAC

arpspoof 192.168.1.100 192.168.1.10

MAC: 00:0A:E4:3B:47:7E

victim ip

victim ip

gateway ip

gateway ip

DEMO 1: catch telnet password

10/25/2010

Computer Networks

29

Alice

Bob

Cracker

Regular traffic

Using arp poisoning

LAN: 192.168.1.x

.10

.100

CLIENT

SERVER

switch

Acts as a router

.1

With dsniff, we catch the passwords used to log in to a telnet service:

dsniff -n

ARP Caches

10/25/2010

Computer Networks

30

IP: 192.168.1.1

MAC: 00:11:22:33:44:01

IP: 192.168.1.105

MAC: 00:11:22:33:44:02

ARP Cache
192.168.1.105 00:11:22:33:44:02
ARP Cache
192.168.1.1 00:11:22:33:44:01

Data

192.168.1.1 is at 00:11:22:33:44:01

192.168.1.105 is at 00:11:22:33:44:02

Poisoned ARP Caches

10/25/2010

Computer Networks

31

192.168.1.105 is at 00:11:22:33:44:03

Poisoned ARP Cache
192.168.1.1 00:11:22:33:44:03
Poisoned ARP Cache
192.168.1.105 00:11:22:33:44:03

Data

Data

192.168.1.1 is at 00:11:22:33:44:03

192.168.1.1

00:11:22:33:44:01

192.168.1.105

00:11:22:33:44:02

192.168.1.106

00:11:22:33:44:03

DEMO 2: network DOS using ARP

10/25/2010

Computer Networks

32

192.168.1.101

switch

192.168.1.102

Cable Loop

Ping 192.168.1.101

arp request

ping

How can it be avoided?

Broadcast storm

Ch02-Authentication.pptx

Section 2.3 – Authentication Technologies

1

1

9/30/2010

Introduction

Authentication

The determination of identity, usually based on a combination of

something the person has (like a smart card or a radio key fob storing secret keys),

something the person knows (like a password),

something the person is (like a human with a fingerprint).

2

Something you are

Something you know

Something you have

radio token with

secret keys

password=ucIb()w1V

mother=Jones

pet=Caesar

human with fingers

and eyes

Barcodes

Developed in the 20th century to improve efficiency in grocery checkout.

First-generation barcodes represent data as a series of variable-width, vertical lines of ink, which is essentially a one-dimensional encoding scheme.

Some more recent barcodes are rendered as two-dimensional patterns using dots, squares, or other symbols that can be read by specialized optical scanners, which translate a specific type of barcode into its encoded information.

3

Authentication via Barcodes

Since 2005, the airline industry has been incorporating two-dimensional barcodes into boarding passes, which are created at flight check-in and scanned before boarding.

In most cases, the barcode is encoded with an internal unique identifier that allows airport security to look up the corresponding passenger’s record with that airline.

Staff then verifies that the boarding pass was in fact purchased in that person’s name (using the airline’s database), and that the person can provide photo identification.

In most other applications, however, barcodes provide convenience but not security. Since barcodes are simply images, they are extremely easy to duplicate.

4

Public domain image from http://commons.wikimedia.org/wiki/File:Bpass.jpg

Two-dimensional

barcode

Magnetic Stripe Cards

Plastic card with a magnetic stripe containing personalized information about the card holder.

The first track of a magnetic stripe card contains the cardholder’s full name in addition to an account number, format information, and other data.

The second track may contain the account number, expiration date, information about the issuing bank, data specifying the exact format of the track, and other discretionary data.

5

Public domain image by Alexander Jones from http://commons.wikimedia.org/wiki/File:CCardBack.svg

Magnetic Stripe Card Security

One vulnerability of the magnetic stripe medium is that it is easy to read and reproduce.

Magnetic stripe readers can be purchased at relatively low cost, allowing attackers to read information off cards.

When coupled with a magnetic stripe writer, which is only a little more expensive, an attacker can easily clone existing cards.

So, many uses require card holders to enter a PIN to use their cards (e.g., as in ATM and debit cards in the U.S.).

6

Public domain image by Alexander Jones from http://commons.wikimedia.org/wiki/File:CCardBack.svg

Smart Cards

Smart cards incorporate an integrated circuit, optionally with an on-board microprocessor, which microprocessor features reading and writing capabilities, allowing the data on the card to be both accessed and altered.

Smart card technology can provide secure authentication mechanisms that protect the information of the owner and are extremely difficult to duplicate.

7

Public domain image from http://en.wikipedia.org/wiki/File:Carte_vitale_anonyme.jpg

Circuit interface

Smart Card Authentication

They are commonly employed by large companies and organizations as a means of strong authentication using cryptography.

Smart cards may also be used as a sort of “electronic wallet,” containing funds that can be used for a variety of services, including parking fees, public transport, and other small retail transactions.

8

SIM Cards

Many mobile phones use a special smart card called a subscriber identity module card (SIM card).

A SIM card is issued by a network provider. It maintains personal and contact information for a user and allows the user to authenticate to the cellular network of the provider.

9

SIM Card Security

SIM cards contain several pieces of information that are used to identify the owner and authenticate to the appropriate cell network.

Each SIM card corresponds to a record in the database of subscribers maintained by the network provider.

A SIM card features an integrated circuit card ID (ICCID),

which is a unique 18-digit number used for hardware identification.

Next, a SIM card contains a unique international mobile subscriber identity (IMSI), which identifies the owner’s country, network, and personal identity.

SIM cards also contain a 128-bit secret key. This key is used for authenticating a phone to a mobile network.

As an additional security mechanism, many SIM cards require a PIN before allowing any access to information on the card.

10

GSM Challenge-Response Protocol

When a cellphone wishes to join a cellular network it connects to a local base station owned by the network provider and transmits its IMSI.

If the IMSI matches a subscriber’s record in the network provider’s database, the base station transmits a 128-bit random number to the cellphone.

This random number is then encoded by the cellphone with the subscriber’s secret key stored in the SIM card using a proprietary encryption algorithm known as A3, resulting in a ciphertext that is sent back to the base station.

The base station then performs the same computation, using its stored value for the subscriber’s secret key. If the two ciphertexts match, the cellphone is authenticated to the network and is allowed to make and receive calls.

11

IMSI = (this phone’s ID)

R = a 128-bit random number (the challenge)

EK(R) = the 128-bit random number encrypted

using the subscriber’s secret key K

(the response)

RFIDs

Radio frequency identification, or RFID, is a rapidly emerging technology that relies on small transponders to transmit identification information via radio waves.

RFID chips feature an integrated circuit for storing information, and a coiled antenna to transmit and receive a radio signal.

12

RFID Technology

RFID tags must be used in conjunction with a separate reader or writer.

While some RFID tags require a battery, many are passive and do not.

The effective range of RFID varies from a few centimeters to several meters, but in most cases, since data is transmitted via radio waves, it is not necessary for a tag to be in the line of sight of the reader.

13

RFID Technology

This technology is being deployed in a wide variety of applications.

Many vendors are incorporating RFID for consumer-product tracking.

Car key fobs.

Electronic toll transponders.

14

Passports

Modern passports of several countries, including the United States, feature an embedded RFID chip that contains information about the owner, including a digital facial photograph that allows airport officials to compare the passport’s owner to the person who is carrying the passport.

15

e-Passport

symbol

RFID chip and

antenna is embedded

in the cover

Passport Security

In order to protect the sensitive information on a passport, all RFID communications are encrypted with a secret key.

In many instances, however, this secret key is merely the passport number, the holder’s date of birth, and the expiration date, in that order.

All of this information is printed on the card, either in text or using a barcode or other optical storage method.

While this secret key is intended to be only accessible to those with physical access to the passport, an attacker with information on the owner, including when their passport was issued, may be able to easily reconstruct this key, especially since passport numbers are typically issued sequentially.

16

Biometrics

Biometric refers to any measure used to uniquely identify a person based on biological or physiological traits.

Generally, biometric systems incorporate some sort of sensor or scanner to read in biometric information and then compare this information to stored templates of accepted users before granting access.

17

Image from http://commons.wikimedia.org/wiki/File:Fingerprint_scanner_in_Tel_Aviv.jpg used with permission under the Creative Commons Attribution 3.0 Unported license

Requirements for Biometric Identification

Universality. Almost every person should have this characteristic.

Distinctiveness. Each person should have noticeable differences in the characteristic.

Permanence. The characteristic should not change significantly over time.

Collectability. The characteristic should have the ability to be effectively determined and quantified.

18

Biometric Identification

19

Feature vector

Reference vector

Comparison algorithm

matches

doesn’t match

Biometric

Reader

Candidates for Biometric IDs

Fingerprints

Retinal/iris scans

DNA

“Blue-ink” signature

Voice recognition

Face recognition

Gait recognition

Let us consider how each of these scores in terms of universality, distinctiveness, permanence, and collectability…

20

Public domain image from

http://commons.wikimedia.org/wiki/File:Retinal_scan_securimetrics.jpg

Public domain image from

http://commons.wikimedia.org/wiki/File:CBP_chemist_reads_a_DNA_profile.jpg

Public domain image from

http://commons.wikimedia.org/wiki/File:Fingerprint_Arch.jpg

Ch02-RFIDSecurity.pptx

RFID Security

Materials from the FIRB SAT lecture slides by Massimo Rimondini included with permission.

2

Architecture

0100101110100...

reader

communication interface & protocol

tag

data format

middleware

Object Naming Service

2

Who

Supply chain management

Benetton

Wal-Mart

Procter & Gamble

Gillette

U.S. Department of Defense

Tires

Michelin (truck tires)

Goodyear (racing tires)

Volkswagen

3

Why

Unique identification and tracking of goods

Manufacturing

Supply chain

Inventory

Retail

Unique identification and tracking of people and animals

Access control & Authorization

Medical applications (drugs, blood banks, mother‑baby pairing, etc.)

Tracking of livestock, endangered species, and pets

Anti-theft systems

Toll systems

Passports

Sports event timing

4

Sam Polniak. The RFID Case Study Book: RFID Application Stories from Around the Globe. Abhisam Software.

Operating Frequency

The operating frequency of an RFID tag affects several parameters

Range

LF (9-135KHz): a few cms

HF (13.56MHz): up to 1m

UHF (0.3-1.2GHz): >1m

MW (2.45-5.8GHz)

Data exchange speed

Signal attenuation through materials

(Cross-country) Interoperability

FCC

ETSI

5

Types of Tags

Passive

Operational power scavenged

from reader radiated power

Semi-passive

Operational power provided by battery

Active

Operational power provided by battery - transmitter built into tag

Reading Multiple Tags

SDMA (Space-Division Multiple Access)

Multiple antennas with non-overlapping fields

FDMA (Frequency-division multiple access)

Multiple frequencies

TDMA (Time-division multiple access)

“Speak” at different times

7

What to Protect

ISO 18000 (supply chain)

UID: 64 bit

Memory: max 256 blocks of 32 bits each

Total: 1KB

Writable tags

8

Translate to English

EPCglobal è stata fondata dalla fusione di EAN International e Uniform Code Council (EAN-UCC, ora sostituite da GS1) nel 2003

What to Protect

EPC global was founded by the union of EAN International and Uniform Code Council in 2003

Class 0

read-only, factory-programmed identifier

Class 1 Gen 1

write-once identifier

lock, kill (with 8 bit password)

9

With 96 bit code, 268 million companies can each categorize 16 million different products where each product category contains up to 687 billion individual units

What to Protect (cont.)

Class 1 Gen 2

=ISO/IEC 18000-6 Type C

writable tags

4 memory blocks

Reserved: access, kill passwords (32 bits each) reversible/one-way read/write lock

EPC ID (up to 304 bits)

TID: incremental serial number written by the vendor (64 bits)

User (up to 512 bits)

10

Threats & Countermeasures

Eavesdropping

Passive monitoring of the air interface

Encryption, shielding, range reduction

Relaying

Man-in-the-middle (allows legitimate authentication)

Shielding, range reduction, distance bounding protocols

Unauthorized tag reading

Fake reader with extended range

Reader authentication, on-demand tag enabling, sensitive data in the backend, tag killing

11

Pawel Rotter. A Framework for Assessing RFID System Security and Privacy

Risks. IEEE Pervasive Computing, 7(2):70–77, June 2008.

Threats & Countermeasures

Cloning

Duplication of tag contents and functionality

Authentication, manufacturing-stage countermeasures against reverse engineering

Tracking

Rogue readers in doors or near legitimate ones

Authentication, range reduction, shielding tags, tag disabling, pseudonyms

Replaying

Repeated authentication sequences

Authentication [see eavesdropping]

12

Pawel Rotter. A Framework for Assessing RFID System Security and Privacy

Risks. IEEE Pervasive Computing, 7(2):70–77, June 2008.

Threats & Countermeasures

Tag content changes

Insertion or modification of data in the tag's memory

Lock, permalock, smarter malware-proof readers

Tag destruction

Burn in a microwave oven, slam with a hammer, etc.

...?

Blocking

Reader awaits response from several non-existent tags

Detection is possible

Jamming

Radio noise

Detection is possible

13

Pawel Rotter. A Framework for Assessing RFID System Security and Privacy

Risks. IEEE Pervasive Computing, 7(2):70–77, June 2008.

14

Threats (reprise)

Breakdown of business processes

Handling of crucial and strategical information

Privacy violations

External risks

e.g., exposure to RF radiation, middleware hacking

Tom Karygiannis, Bernard Eydt, Greg Barber, Lynn Bunn, and Ted Phillips. Guidelines for securing radio frequency identification (RFID) systems. Recommendations of the National Institute of Standards and Technology, NIST 800-98, 2007.

15

Security coordinates

Service availability

Cloning

Security of read operations

Security of write operations

Security of information

16

Risks vs. Security

Risks (NIST)
Business processes Strategical information Privacy violation Others
Service availability
Cloning
Read
Write
Information

17

Focus

0100101110100...

17

Denial of Service

18

19

Denial of Service

Impair communication with valid tag

Jamming

oscillator+audio amplifier

Faraday cage

aluminium leaf

Fool the reader with counterfeit tags

Confuse the singulation tree walking

Blocker tag

Interposing metals

Detaching tag antennas

Physical destruction (of anti-shoplifting tags)

camera’s flash circuit

20

Singulation Tree Walking

Reader tries to read several tags

Electromagnetic noise (jamming) is possible

Avoids jamming in the presence of multiple tags

Performance: up to 1000 tags/s

Blocker tag (fully/selectively) “spoofs” the walk

A. Juels, R. L. Rivest, and M. Szydlo. The Blocker Tag: Selective Blocking of RFID Tags for Consumer Privacy. In V. Atluri, ed. 8th ACM Conference on Computer and Communications Security, pp. 103-111. ACM Press. 2003.

Reader broadcasts

current prefix

Each tag with this prefix

responds with its next bit

If responses don’t collide,

reader adds 1 bit to current

prefix, otherwise tries both

possibilities

Explain in more detail

Tag Singulation Process

Read individual tag from group of all tags in range of reader:

All tags within range of reader backscatter their MSB (most significant bit) to the reader

Reader responds with either a 1 or a 0

If tag bit == reader bit, tag sends the next bit in it is ID code; else, tag goes mute for remainder of singulation

Process continues until reader has completely read a single tag

Reader conducts consecutive singulations until all tags in its range are read

Reader can interrupt the singulation process to send commands to a single tag, a subset of all tags in range, or globally to all tags in range

Read sa solo un prefisso

21

Cloning

22

23

Cloning

Violates information integrity

Breaks stock availability (rather than money gain)

Allows spoofing & theft

Made possible by writable memories

Possible even just with a PDA+PC card

Countermeasures:

Killing

Read-only memories

(Mutual) Authentication protocols

PUFs

Annalee Newitz. The rfid hacking underground. WIRED, 14(05):72, 77, May 2006.

Challenge-Response Protocol

Function f is public

Secret key K is known only to the tag and reader

The reader sends challenge X and the tag responds with Y, computed from K and X

The reader computes Y’ = f(K,X) and verifies that Y=Y’

24

Response : Y = f (K,X)

Challenge : nonce X

RFID TAG

RFID reader

Y’ = f (K,X)

24

Physically Unclonable Function

PUF

Easy to calculate and difficult to characterize

Lightweight

Safer alternative to storing keys on tag

Challenge response protocol

Binary vector X sent to tag

Tag computes vector Y=f(K, X)

“Hardwired” vector K different for each tag, due to random manufacturing variations

Repeating the same challenge results in responses with small Hamming distance

25

Major revision: check for accuracy

How many bits do the challenge and response have?

64 or 128

Is K a constant for a given tag or are small variations possible for the same tag and different challenges?

Explain difference between a PUF and a MAC (message authentication code)?

26

A PUF uses variations in the production of the circuit to generate a bit different response for each challenge presented

The same challenge response generally produces different tags on different PUF

PUF: Architecture

Switch

c

i

=0

Switch Operations

The operation of arbiter includes:

a race between the signals in which the arbiter keeps the outcome

c

0

c

1

c

2

c

61

c

62

c

63

0

1

Arbiter

0

Arbiter

Arbiter

1

c

i

=1

26

Merge with previous slide

Explain better input/output behavior

Hardware details and block diagram can be omitted

This is achieved by starting a race between a rising edge that is fed into a series of switches. The signal is routed depending on the challenge bit at each switch and depending on whether the signal on the top rail or the bottom rail arriving first the arbiter outputs a 1 or a 0. Same challenge on most occations will not produce the same response from chip to chip due to propagations and delay variations in the circuit components.

Thus a PUF circuit can be used to characterise each label IC and the fabrications variation tend to from the secret key. Thus it is possible to authenticate each IC by observing the response of the PUF circuit to a set of challenges.

It has been evaluated that around 800 challenges reponse pairs are enough to uniquely identify around a billions chips.

PUF

Function on the unpredictable behavior that allows for creating challenge-response pairs

The set of challenge-response pairs of DNA is a kind of electronic RFID tags

27

Per un PUF dal comportamento ideale è possibile pubblicare un hash del response per evitare la clonazione tramite tag virtuale

Il tag Vera X512H, dell’americana Verayo, se sfidato più volte con lo stesso challenge risponde con response che sono tra loro a distanza di Hamming minore di 17 bit

27

PUF vs. MAC

Builds challenge response pairs (CRPs) table of the PUF Tag

Send the object with the Tag

Send securely to Alice the PUF CRP table

Alice can verify using CRPs that the object has not been tampered

Hashes of the data

Encrypts hash with a crypto key

data and the encrypted hash are sent to Alice

Alice knows the crypto key and hash function so she can verify data integrity and source

Bob sends Alice some data

Bob sends Alice an object

28

29

PUF: Security Infrastructure

To ensure security in PUF is necessary :

A database backend to keep challenge response pair (CRP)

A method for secure distribution of CRPs

Build a CRP table for each tag before distribution (after verification of the TAG may be extended)

29

Encryption controlled by the label owner.

Hence it is independent of the other parties in the supply chain. Individual establishments can define a security policy that suits them. Such as when encryption is performed how to handle the tag contents at point of sale. Level of security to commensurate the data/ item being protected.

30

Information Security

Security of Read Operations

31

Ranges

Depend on the frequency

nominal

back channel

eavesdropping

rogue skimming/scanning

rogue command

traffic analysis

(without interpreting transmission)

forward channel eavesdropping

32

Power Analysis

ICs introduce electrical noise

Tag power consumption depends on internal operations

Submitting bits of kill passwords reveals whether they are correct

Limited application to EPC Gen 2 Tags

Countermeasures

Random noise

Tag redesign

Yossi Oren. Remote power analysis of rfid tags. Master’s thesis, Computer Network and Security Lab, Tel-Aviv University, 2006.

33

Power Analysis

34

Relaying

Pawel Rotter. A Framework for Assessing RFID System Security and Privacy

Risks. IEEE Pervasive Computing, 7(2):70–77, June 2008.

out of range

dedicated network

ghost

leech

Relaying

Mafia fraud

Man-in-the-middle

Additional fraudulent reader & tag

No data alteration

Cannot be prevented by application level cryptographic protocols!

Terrorist fraud

No malicious reader

Tag is not honest and cooperates with malicious tag

Malicious tag is not aware of tag’s secrets

35

Chong Hee Kim, Gildas Avoine, François Koeune, Fran¸ois-Xavier Standaert, and Olivier Pereira. The swiss-knife RFID distance bounding protocol. In Proc. ICISC 2008, 2008.

36

Counter{feit,measures}

On labels: holographies, watermarks

In RFID: authentication protocols

Privacy

Computational constraints

Power

Space

Cost

Traceability

Forward: predict future information

Backward: successful identification based on past information

Standards compliance

Il problema Learning Parity without Noise:

sono date diverse sequenze di bit e, per ciascuna, un valore di parità (XOR) calcolato con una funzione f. Determinare f

37

Cryptography on tags

Three approaches

Standard cryptographic primitives

(Ultra)light cryptographic primitives

Hardware implementations (FPGA)

Block ciphers

Simplified AES

Public key

Security by obscurity

Karsten Nohl, David Evans, Starbug, and Henryk Plotz. Reverse-Engineering a Cryptographic RFID Tag. In 17th USENIX Security Symposium, July 2008.

Standard compliance

Daniel Bailey and Ari Juels. Shoehorning Security into the EPC Standard. International Conference on Security in Communication Networks – SCN 2006, September 2006.

38

Physical destruction

More relevant for privacy issues

Kill command

Clipped tags

Guenter Karjoth and Paul Moskowitz. Disabling RFID tags with visible

confirmation: Clipped tags are silenced. Technical Report RC23710, IBM, 2005.

39

Exchanging keys securely

Narrowband radio frequencies are subject to

eavesdropping

jamming

side-channel attacks

Solutions:

Advanced modulation scheme

Ultra-wideband

Spreading code is kept secret

Key sharing across time and/or space

Noisy tags

Eavesdroppers cannot differentiate their signals from those of the queried tag

P. Yu, P. Schaumont, D. Ha. Securing RFID with Ultra-Wideband Modulation. RFIDSec 06, July 2006.

A. Juels, R. Pappu, B. Parno. Unidirectional Key Distribution Across Time and Space with Applications to RFID Security. In 17th USENIX Security Symposium, July 2008.

C. Castelluccia, G. Avoine. Noisy Tags: A Pretty Good Key Exchange Protocol for RFID Tags. CARDIS, April 2006.

40

Hash lock

Tags can operate in two states:

unlocked

locked

always reply with the metaID

To lock, store the metaID

To unlock, retrieve k from the backend and send it to the tag

Tags are unlocked for a short while

Stephen Weis, Sanjay Sarma, Ronald Rivest, and Daniel Engels. Security and

Privacy Aspects of Low-Cost Radio Frequency Identification Systems. International Conference on Security in Pervasive Computing – SPC 2003, March

2003. Springer-Verlag.

41

Unauthorized changes

Private memory on the tags

Readers can access it

Only the tag can write to it

Records changes to tag information

Akira Yamamoto, Shigeya Suzuki, Hisakazu Hada, Jin Mitsugi, Fumio Teraoka, and Osamu Nakamura. A Tamper Detection Method for RFID Tag Data. IEEE International Conference on RFID, pages 51–57, April 2008.

42

Prevent eavesdropping

In EPC tags can “mask” (XOR) responses with a random 16-bit value

Weak security

Combine RFID with optical memory

Optical communication is more secure

Optical memory may store access keys

Mikko Lehtonen, Thorsten Staake, Florian Michahelles, and Elgar Fleisch. Strengthening the Security of Machine Readable Documents by Combining RFID and Optical Memory Devices. In Ambient Intelligence Developments Conference – AmI.d, September 2006.

43

Prevent server impersonation

RFID memory is not tamper-proof

Too costly

Compromised tags can cause desynchronization with database

Countermeasures:

Digital signature

Not viable

Additional tag storing most recently used secret

Not viable

Tags authenticate the server

44

Information Security

Security of Write Operations

45

Security of write operations

Recycle solutions for read operations

46

Timings

Writes may take longer than reads

Some skimming-like scenarios vanish

47

Faulty writes

Tags may confirm faulty writes

Wrong data has been written

Data has not been written at all

Caused by

Temporary antenna failure

Radio interference

Laser radiation

Michael Hutter, Jörn-Marc Schmidt, and Thomas Plos. RFID and Its Vulnerability to Faults. Proceedings of the 10th International Workshop Cryptographic Hardware and Embedded Systems, CHES 2008, August 2008. Springer.

48

Focus

0100101110100...

48

49

Information Security

Security of Data (and Infrastructure)

50

Backend vulnerabilities

Each component of an RFID systems may be vulnerable

Compromising a component reflects on others

Compromising tags may affect the backend!

51

Backend vulnerabilities

0100101110100...

51

52

Malware

The world's First RFID chip infected with a virus

Melanie Rieback, Bruno Crispo, and Andrew Tanenbaum. Is your cat infected

with a computer virus? In Proc. IEEE PerCom 2006, 2006.

53

Security of existing applications

54

Security of existing applications

e-Passports

ICAO (International Civil Aviation Organization) requires:

compulsory authentication of passport data, signed by the issuer

(optionally) access control based on cryptographic keys

(optionally) public key authentication of the passport

Vulnerabilities still exist

Transferability (verifier becomes prover)

Reset attacks (same coin toss by resetting internal state of one party)

Carlo Blundo, Giuseppe Persiano, Ahmad-Reza Sadeghi, and Ivan Visconti. Resettable and Non-Transferable Chip Authentication for ePassports. In Conference on RFID Security, Budaperst, Hongria, July 2008.

Reset attacks: reset the internal state of a protocol

55

Security of existing applications

Car ignition: Keeloq

Manufacturer has master secret

Cars have unique ID

MASTER ⊕ ID = car’s secret key

Finding 1 key leads to the master secret!!

~2 days on a cluster of 50 Dual-Cores

“Soon, cryptographers will all drive expensive cars” :-)

Sebastian Indesteege, Nathan Keller, Orr Dunkelman, Eli Biham, and Bart

Preneel. A practical attack on keeloq. In Proc. Eurocrypt 2008, 2008.

56

Security of existing applications

Credit cards

First-generation

Holder, number, expire date are transmitted in clear text

Thomas S. Heydt-Benjamin, Dan V. Bailey, Kevin Fu, Ari Juels, and Tom O’Hare. Vulnerabilities in First-Generation RFID-Enabled Credit Cards. Manuscript, October 2006.

57

Security of existing applications

Medical implants

Some defibrillators are vulnerable

175KHz ⇒ low range!

Daniel Halperin, Thomas S. Heydt-Benjamin, Benjamin Ransford, Shane S. Clark, Benessa Defend, Will Morgan, Kevin Fu, Tadayoshi Kohno, and William H. Maisel. Pacemakers and Implantable Cardiac Defibrillators: Software Radio Attacks and Zero-Power Defenses. In Proceedings of the 29th Annual IEEE Symposium on Security and Privacy, May 2008.

58

Security of existing applications

MIFARE

Widespread for contactless smart cards

ISO 14443 type A (HF, 13.56MHz)

~10cm operating distance

About 16KB memory, fragmented in sectors

Buggy pseudorandom generator

The 1st sector can be overwritten!

Each sector for which one block is known can be overwritten!

Based on active attack, requires eavesdropping response from legitimate tag

Secret keys still inaccessible

59

Skimmer

“Would you be comfortable wearing your name, your credit card number and your card expiration date on your T-shirt?”

Skim ~ quick eavesdrop

As cheap as $150 to build

Readily available computer & radio components

Solution: shield

http://www.difrwear.com/

http://www.idstronghold.com/

Thomas S. Heydt-Benjamin, Dan V. Bailey, Kevin Fu, Ari Juels, and Tom O’Hare. Vulnerabilities in First-Generation RFID-Enabled Credit Cards. Manuscript, October 2006.

Ilan Kirschenbaum and Avishai Wool. How to Build a Low-Cost, Extended-Range RFID Skimmer. Cryptology ePrint Archive, Report 2006/054, 2006.

60

References

http://www.avoine.net/rfid/

B. Palazzi, M. Rimondini. Survey su RFID e Sicurezza. TR. Feb 2009. (in Italian)

http://mifare.net/

http://www.rfidjournal.com/

http://www.verayo.com/

Ch01-Introduction.pptx

Chapter 1 - Introduction

1

1

5/29/2019

Introduction

Defining Security

The security of a system, application, or protocol is always relative to

A set of desired properties

An adversary with specific capabilities

For example, standard file access permissions in Linux and Windows are not effective against an adversary who can boot from a CD

2

Introduction

5/29/2019

2

Security Goals

3

Integrity

Confidentiality

Availability

C.I.A.

Confidentiality

Confidentiality is the avoidance of the unauthorized disclosure of information.

confidentiality involves the protection of data, providing access for those who are allowed to see it while disallowing others from learning anything about its content.

4

Tools for Confidentiality

Encryption: the transformation of information using a secret, called an encryption key, so that the transformed information can only be read using another secret, called the decryption key (which may, in some cases, be the same as the encryption key).

5

encrypt

decrypt

ciphertext

plaintext

shared

secret

key

shared

secret

key

Communication channel

Sender

Recipient

Attacker

(eavesdropping)

plaintext

Tools for Confidentiality

Access control: rules and policies that limit access to confidential information to those people and/or systems with a “need to know.”

This need to know may be determined by identity, such as a person’s name or a computer’s serial number, or by a role that a person has, such as being a manager or a computer security specialist.

6

Tools for Confidentiality

Authentication: the determination of the identity or role that someone has. This determination can be done in a number of different ways, but it is usually based on a combination of

something the person has (like a smart card or a radio key fob storing secret keys),

something the person knows (like a password),

something the person is (like a human with a fingerprint).

7

Something you are

Something you know

Something you have

radio token with

secret keys

password=ucIb()w1V

mother=Jones

pet=Caesar

human with fingers

and eyes

Tools for Confidentiality

Authorization: the determination if a person or system is allowed access to resources, based on an access control policy.

Such authorizations should prevent an attacker from tricking the system into letting him have access to protected resources.

Physical security: the establishment of physical barriers to limit access to protected computational resources.

Such barriers include locks on cabinets and doors, the placement of computers in windowless rooms, the use of sound dampening materials, and even the construction of buildings or rooms with walls incorporating copper meshes (called Faraday cages) so that electromagnetic signals cannot enter or exit the enclosure.

8

Integrity

Integrity: the property that information has not been altered in an unauthorized way.

Tools:

Backups: the periodic archiving of data.

Checksums: the computation of a function that maps the contents of a file to a numerical value. A checksum function depends on the entire contents of a file and is designed in a way that even a small change to the input file (such as flipping a single bit) is highly likely to result in a different output value.

Data correcting codes: methods for storing data in such a way that small changes can be easily detected and automatically corrected.

9

Availability

Availability: the property that information is accessible and modifiable in a timely fashion by those authorized to do so.

Tools:

Physical protections: infrastructure meant to keep information available even in the event of physical challenges.

Computational redundancies: computers and storage devices that serve as fallbacks in the case of failures.

10

Other Security Concepts

A.A.A.

11

Authenticity

Anonymity

Assurance

Assurance

Assurance refers to how trust is provided and managed in computer systems.

Trust management depends on:

Policies, which specify behavioral expectations that people or systems have for themselves and others.

For example, the designers of an online music system may specify policies that describe how users can access and copy songs.

Permissions, which describe the behaviors that are allowed by the agents that interact with a person or system.

For instance, an online music store may provide permissions for limited access and copying to people who have purchased certain songs.

Protections, which describe mechanisms put in place to enforce permissions and polices.

We could imagine that an online music store would build in protections to prevent people from unauthorized access and copying of its songs.

12

Authenticity

Authenticity is the ability to determine that statements, policies, and permissions issued by persons or systems are genuine.

Primary tool:

digital signatures. These are cryptographic computations that allow a person or system to commit to the authenticity of their documents in a unique way that achieves nonrepudiation, which is the property that authentic statements issued by some person or system cannot be denied.

13

Anonymity

Anonymity: the property that certain records or transactions not to be attributable to any individual.

Tools:

Aggregation: the combining of data from many individuals so that disclosed sums or averages cannot be tied to any individual.

Mixing: the intertwining of transactions, information, or communications in a way that cannot be traced to any individual.

Proxies: trusted agents that are willing to engage in actions for an individual in a way that cannot be traced back to that person.

Pseudonyms: fictional identities that can fill in for real identities in communications and transactions, but are otherwise known only to a trusted entity.

14

Threats and Attacks

Eavesdropping: the interception of information intended for someone else during its transmission over a communication channel.

15

Alice

Bob

Eve

Threats and Attacks

Alteration: unauthorized modification of information.

Example: the man-in-the-middle attack, where a network stream is intercepted, modified, and retransmitted.

16

encrypt

decrypt

ciphertext C

shared

secret

key

plaintext M

plaintext M′

shared

secret

key

Communication channel

Sender

Recipient

Attacker

(intercepting)

ciphertext C′

Threats and Attacks

Denial-of-service: the interruption or degradation of a data service or information access.

Example: email spam, to the degree that it is meant to simply fill up a mail queue and slow down an email server.

17

Alice

Threats and Attacks

Masquerading: the fabrication of information that is purported to be from someone who is not actually the author.

18

“From: Alice”

(really is from Eve)

Threats and Attacks

Repudiation: the denial of a commitment or data receipt.

This involves an attempt to back out of a contract or a protocol that requires the different parties to provide receipts acknowledging that data has been received.

19

Public domain image from http://commons.wikimedia.org/wiki/File:Plastic_eraser.jpeg

Threats and Attacks

Correlation and traceback: the integration of multiple data sources and information flows to determine the source of a particular data stream or piece of information.

20

Bob

The Ten Security Principles

21

Security Principles

Economy of mechanism

Fail-safe defaults

Complete mediation

Open design

Separation of privilege

Least privilege

Least common mechanism

Psychological acceptability

Work factor

Compromise recording

Economy of mechanism

This principle stresses simplicity in the design and implementation of security measures.

While applicable to most engineering endeavors, the notion of simplicity is especially important in the security domain, since a simple security framework facilitates its understanding by developers and users and enables the efficient development and verification of enforcement methods for it.

22

Fail-safe defaults

This principle states that the default configuration of a system should have a conservative protection scheme.

For example, when adding a new user to an operating system, the default group of the user should have minimal access rights to files and services. Unfortunately, operating systems and applications often have default options that favor usability over security.

This has been historically the case for a number of popular applications, such as web browsers that allow the execution of code downloaded from the web server.

23

Complete mediation

The idea behind this principle is that every access to a resource must be checked for compliance with a protection scheme.

As a consequence, one should be wary of performance improvement techniques that save the results of previous authorization checks, since permissions can change over time.

For example, an online banking web site should require users to sign on again after a certain amount of time, say, 15 minutes, has elapsed.

24

Open design

According to this principle, the security architecture and design of a system should be made publicly available.

Security should rely only on keeping cryptographic keys secret.

Open design allows for a system to be scrutinized by multiple parties, which leads to the early discovery and correction of security vulnerabilities caused by design errors.

The open design principle is the opposite of the approach known as security by obscurity, which tries to achieve security by keeping cryptographic algorithms secret and which has been historically used without success by several organizations.

25

Separation of privilege

This principle dictates that multiple conditions should be required to achieve access to restricted resources or have a program perform some action.

26

Least privilege

Each program and user of a computer system should operate with the bare minimum privileges necessary to function properly.

If this principle is enforced, abuse of privileges is restricted, and the damage caused by the compromise of a particular application or user account is minimized.

The military concept of need-to-know information is an example of this principle.

27

Least common mechanism

In systems with multiple users, mechanisms allowing resources to be shared by more than one user should be minimized.

For example, if a file or application needs to be accessed by more than one user, then these users should have separate channels by which to access these resources, to prevent unforeseen consequences that could cause security problems.

28

Psychological acceptability

This principle states that user interfaces should be well designed and intuitive, and all security-related settings should adhere to what an ordinary user might expect.

29

Work factor

According to this principle, the cost of circumventing a security mechanism should be compared with the resources of an attacker when designing a security scheme.

A system developed to protect student grades in a university database, which may be attacked by snoopers or students trying to change their grades, probably needs less sophisticated security measures than a system built to protect military secrets, which may be attacked by government intelligence organizations.

30

Compromise recording

This principle states that sometimes it is more desirable to record the details of an intrusion than to adopt more sophisticated measures to prevent it.

Internet-connected surveillance cameras are a typical example of an effective compromise record system that can be deployed to protect a building in lieu of reinforcing doors and windows.

The servers in an office network may maintain logs for all accesses to files, all emails sent and received, and all web browsing sessions.

31

Topic: Access Control

Users and groups

Authentication

Passwords

File protection

Access control lists

Which users can read/write which files?

Are my files really safe?

What does it mean to be root?

What do we really want to control?

5/29/2019

Introduction

32

Access Control Matrices

A table that defines permissions.

Each row of this table is associated with a subject, which is a user, group, or system that can perform actions.

Each column of the table is associated with an object, which is a file, directory, document, device, resource, or any other entity for which we want to define access rights.

Each cell of the table is then filled with the access rights for the associated combination of subject and object.

Access rights can include actions such as reading, writing, copying, executing, deleting, and annotating.

An empty cell means that no access rights are granted.

33

Example Access Control Matrix

34

Access Control Lists

It defines, for each object, o, a list, L, called o’s access control list, which enumerates all the subjects that have access rights for o and, for each such subject, s, gives the access rights that s has for object o.

35

/etc/passwd

/usr/bin/

/u/roberto/

/admin/

root: r,w,x

backup: r,x

root: r,w,x

roberto: r,w,x

backup: r,x

root: r,w,x

mike: r,x

roberto: r,x

backup: r,x

root: r,w

mike: r

roberto: r

backup: r

Capabilities

Takes a subject-centered approach to access control. It defines, for each subject s, the list of the objects for which s has nonempty access control rights, together with the specific rights for each such object.

36

/etc/passwd: r,w,x; /usr/bin: r,w,x;

/u/roberto: r,w,x; /admin/: r,w,x

root

/usr/passwd: r; /usr/bin: r;

/u/roberto: r,w,x

roberto

/usr/passwd: r; /usr/bin: r,x

mike

backup

/etc/passwd: r,x; /usr/bin: r,x;

/u/roberto: r,x; /admin/: r,x

Role-based Access Control

Define roles and then specify access control rights for these roles, rather than for subjects directly.

37

Department Member

Administrative Personnel

Accountant

Secretary

Administrative Manager

Faculty

Lab Technician

Lab Manager

Student

Undergraduate Student

Graduate Student

Department Chair

Technical Personnel

Backup Agent

System Administrator

Undergraduate TA

Graduate TA

Cryptographic Concepts

Encryption: a means to allow two parties, customarily called Alice and Bob, to establish confidential communication over an insecure channel that is subject to eavesdropping.

38

Alice

Bob

Eve

Encryption and Decryption

The message M is called the plaintext.

Alice will convert plaintext M to an encrypted form using an encryption algorithm E that outputs a ciphertext C for M.

39

encrypt

decrypt

ciphertext

plaintext

shared

secret

key

shared

secret

key

Communication channel

Sender

Recipient

Attacker

(eavesdropping)

plaintext

Encryption and Decryption

As equations:

C = E(M)

M = D(C)

The encryption and decryption algorithms are chosen so that it is infeasible for someone other than Alice and Bob to determine plaintext M from ciphertext C. Thus, ciphertext C can be transmitted over an insecure channel that can be eavesdropped by an adversary.

40

Cryptosystem

The set of possible plaintexts

The set of possible ciphertexts

The set of encryption keys

The set of decryption keys

The correspondence between encryption keys and decryption keys

The encryption algorithm to use

The decryption algorithm to use

41

Caesar Cipher

Replace each letter with the one “three over” in the alphabet.

42

Public domain image from http://commons.wikimedia.org/wiki/File:Caesar3.svg

Symmetric Cryptosystems

Alice and Bob share a secret key, which is used for both encryption and decryption.

43

encrypt

decrypt

ciphertext

plaintext

shared

secret

key

shared

secret

key

Communication channel

Sender

Recipient

Attacker

(eavesdropping)

plaintext

Symmetric Key Distribution

Requires each pair of communicating parties to share a (separate) secret key.

44

n (n-1)/2 keys

shared

secret

shared

secret

shared

secret

shared

secret

shared

secret

shared

secret

Public-Key Cryptography

Bob has two keys: a private key, SB, which Bob keeps secret, and a public key, PB, which Bob broadcasts widely.

In order for Alice to send an encrypted message to Bob, she need only obtain his public key, PB, use that to encrypt her message, M, and send the result, C = EPB (M), to Bob. Bob then uses his secret key to decrypt the message as M = DSB (C).

45

Public-Key Cryptography

Separate keys are used for encryption and decryption.

46

encrypt

decrypt

ciphertext

plaintext

public

key

private

key

Communication channel

Sender

Recipient

Attacker

(eavesdropping)

plaintext

plaintext

Public Key Distribution

Only one key is needed for each recipient

47

n key pairs

private

private

private

private

public

public

public

public

Digital Signatures

Public-key encryption provides a method for doing digital signatures

To sign a message, M, Alice just encrypts it with her private key, SA, creating C = ESA(M).

Anyone can decrypt this message using Alice’s public key, as M’ = DPA(C), and compare that to the message M.

48

Cryptographic Hash Functions

A checksum on a message, M, that is:

One-way: it should be easy to compute Y=H(M), but hard to find M given only Y

Collision-resistant: it should be hard to find two messages, M and N, such that H(M)=H(N).

Examples: SHA-1, SHA-256.

49

Message Authentication Codes

Allows for Alice and Bob to have data integrity, if they share a secret key.

Given a message M, Alice computes H(K||M) and sends M and this hash to Bob.

50

(attack detected) =?

MAC

h

shared

secret

key

Communication channel

Sender

Recipient

Attacker

(modifying)

MAC

6B34339

4C66809

4C66809

message M’

h

shared

secret

key

87F9024

received MAC

computed MAC

message M

Digital Certificates

certificate authority (CA) digitally signs a binding between an identity and the public key for that identity.

51

Passwords

A short sequence of characters used as a means to authenticate someone via a secret that they know.

Userid: _________________

Password: ______________

52

How a password is stored?

Password file

User

Butch:ASDSA

21QW3R50E

ERWWER323

hash function

Dog124

53

54

Strong Passwords

What is a strong password

UPPER/lower case characters

Special characters

Numbers

When is a password strong?

Seattle1

M1ke03

P@$$w0rd

TD2k5secV

54

54

54

Spostare in altra sezione

Password Complexity

A fixed 6 symbols password:

Numbers 106 = 1,000,000

UPPER or lower case characters 266 = 308,915,776

UPPER and lower case characters 526 = 19,770,609,664

32 special characters (&, %, $, £, “, |, ^, §, etc.) 326 = 1,073,741,824

94 practical symbols available

946 = 689,869,781,056

ASCII standard 7 bit 27 =128 symbols

1286 = 4,398,046,511,104

55

55

56

Password Length

26 UPPER/lower case characters = 52 characters

10 numbers

32 special characters

=> 94 characters available

5 characters: 945 = 7,339,040,224

6 characters: 946 = 689,869,781,056

7 characters: 947 = 64,847,759,419,264

8 characters: 948 = 6,095,689,385,410,816

9 characters: 949 = 572,994,802,228,616,704

56

56

56

57

Password Validity: Brute Force Test

Password does not change for 60 days

how many passwords should I try for each second?

5 characters: 1,415 PW /sec

6 characters: 133,076 PW /sec

7 characters: 12,509,214 PW /sec

8 characters: 1,175,866,008 PW /sec

9 characters: 110,531,404,750 PW /sec

57

57

57

Secure Passwords

A strong password includes characters from at least three of the following groups:

Use pass phrases eg. "I re@lly want to buy 11 Dogs!"

58

58

Social Engineering

Pretexting: creating a story that convinces an administrator or operator into revealing secret information.

Baiting: offering a kind of “gift” to get a user or agent to perform an insecure action.

Quid pro quo: offering an action or service and then expecting something in return.

59

Ch02-ComputerForensics.pptx

Computer Forensics

What is Computer Forensics?

Scientific process of preserving, identifying, extracting, documenting, and interpreting data on a computer

Used to obtain potential legal evidence

Computer Forensics Procedures

The Forensic Paradigm

Identify specific objects that store important data for the case analysis

Establish a chain of custody and document all steps to prove that the collected data remains intact and unaltered

Determine the type of information stored on digital evidence and conduct a thorough analysis of the media

Prepare and deliver an official report

Collection

Reporting

Analysis and

Evaluation

Identification

3

Identification: Common Mistakes …

You are the investigator, which objects do you think will be useful for investigations?

Computer (case and power supply)

Just the hard drive (without computer)

Monitor

Keyboard and mouse

Media (CD, DVD, USB drives, etc.)

Printer

Digital forensics does not replace traditional forensic analysis

Any action that modifies the crime scene could invalidate evidence in court

Collection

To collect computer evidence, care must be taken not to change the evidence

Imaging media using a write-blocking tool to ensure the suspect device is not be modified

Establishing and maintaining the chain of custody

Documenting everything that has been done

Using only tools and methods that have been tested and evaluated to validate their accuracy and reliability

Forensic Constraints

Chain of custody

Maintain possession of all objects

Must be able to trace evidence back to source

“Prove” source integrity

Priority by volatility

Some data is more volatile

RAM > swap > disk > CDs/DVDs

Idea: capture more volatile evidence first

6

Image Evidence: Laptop

LAPTOP at Crime Scene

USB ADAPTER

EVIDENCE DISK

DATA CABLE

Why Use Images

Information on digital media is easily changed.

Once changed it is usually impossible to detect that a change has taken place (or to revert the data back to its original state) unless other measures have been taken

A common practice is calculate a cryptographic hash to establish a check point

Examining a live file system changes state of the evidence

The computer/media is the “crime scene”

Protecting the crime scene is paramount as once evidence is contaminated, it cannot be decontaminated

Really only one chance to do it right!

Collection: Common Mistakes …

What is the first step to collect evidence, when you find:

A computer turned on

A computer turned off

A computer on a crime scene should be considered fully adversarial

Analysis and Evaluation

Know where evidence can be found

Understand techniques used to hide or “destroy” digital data

Toolbox of techniques to discover hidden data and recover “destroyed” data

Cope with HUGE quantities of digital data…

Ignore the irrelevant, target the relevant

Thoroughly understand circumstances which may make “evidence” unreliable

If you have a hard drive with a broken sector that gives different result, what happens when you hash the entire drive?

Where is the Evidence?

Undeleted files, expect some names to be incorrect

Deleted files

Windows registry

Print spool files

Hibernation files

Temp files (all those .TMP files in Windows!)

Slack space

Swap files

Internet browsing histories

Alternate or “hidden” partitions

On a variety of removable media (USB drives, backup tapes, …)

11

12

Hidden Data in the Hard Drive Slack Space

Slack space is the space between

The logical end of the file (i.e., the end of the data actually in the file) and

The physical end of the file (i.e., the end of the last sector devoted to the file).

13

Digital Forensics Tools

Forensics tools are typically command line tools that are guaranteed not to alter the disk:

HELIX a live cd with a plenty of forensic tools ready to be used

ENCASE a series of proprietary forensic software products produced by Guidance Software

Open Source vs. Closed Source

21/01/2008

14 di 7

Commercial products such as EnCase are recognized by law. What is the best approach?

14

15

How to Hide Data?

Cryptography

Steganography

The process of hiding data inside other data (e.g. image files).

Change file names and extensions

E.g. rename a .doc file to a .tmp file

Hidden tracks

most hard disks have # of tracks hidden (i.e. track 0)

They can be used to hide/read data by using a hex editor

Deleted Files

not truly deleted, merely marked for deletion.

During Forensic is important to do not use any tools that write to the disk

Why Create a Duplicate Image?

A file copy does not recover all data areas of the device for examination

Working from a duplicate image

Preserves the original evidence

Prevents inadvertent alteration of original evidence during examination

Allows recreation of the duplicate image if necessary

CCSP Fall 2005

10/25/2005

Scott L. Ksander

16

Never do anything that might inadvertently cause something to be written to the suspect’s original media.

Bitstream vs. Backups

Forensic copies (Bitstream)

Bit for bit copying captures all the data on the copied media

Including hidden and residual data (e.g., slack space, swap, residue, unused space, deleted files etc.)

Often the “smoking gun” is found in the residual data.

Logical vs. physical image

Reporting

Accurately describe the details of an incident

Be understandable to decision makers

Be able to withstand legal scrutiny

Be unambiguous and not open to misinterpretation

Be easily referenced

Contain all information required to explain the conclusions

Offer valid conclusions, opinions, or recommendations when needed

Create report in a timely manner

Anti-Forensic and Data Security

Anti-forensic techniques try to frustrate forensic investigators and their techniques

Securely deleting data, so that it cannot be restored with forensic methods

Prevent the creation of certain data in the first place

Data which was never there, obviously cannot be restored with forensic methods.

Privacy Through Media Destruction

Degausser Magnetic Field

or

or

thermite…

shredder

21

Disk Wiping

Simple erase

The data is still on the drive but the segment has been marked as available

Next time data is written to the drive it MAY overwrite the segment

Destructive erase

First overwrites all data in the file with random data

Next marks the segment as available

It may be possible to find ghost images of what was previously on the disk surface

Overwriting Hard Drive Data: The Great Wiping Controversy, ICISS 2008