47
CS363 Week 5 - Friday

Week 5 - Friday. What did we talk about last time? Hash functions Birthday paradox Digital signatures

Embed Size (px)

Citation preview

Page 1: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

CS363Week 5 - Friday

Page 2: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Last time

What did we talk about last time? Hash functions Birthday paradox Digital signatures

Page 3: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Questions?

Page 4: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Assignment 2

Page 5: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Project 2

Page 6: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Security tidbit 2016 National Threat Assessment was

released on February 9, 2016 This 33-page report from the US intelligence

organizations explains what they think are threats All threats, not just cyber stuff

However, cyber and technology threats are listed first

Russia, China, Iran, North Korea, and nonstate actors are listed as leading threat actors

Page 7: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Security tidbit continued 33 pages is not a very long read It's a good way to catch up on all the problems in

the world Even climate change is mentioned

However, the discussion is pretty general You don't expect the CIA, FBI, and NSA to tell us all

the dark stuff they know that their enemies don't know they know

Also, the guy who wrote the report, James Clapper, lied about spying on Americans, as revealed by Snowden

Read the report: http://www.dni.gov/files/documents/SASC_Unclassified_2016_ATA_SFR_FINAL.pdf

Page 8: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Quantum Cryptography

Page 9: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Quantum cryptography

When people talk about quantum computers in the context of cryptography, they're usually talking about one of two very different things: Breaking cryptography with quantum

computers Using quantum mechanics to send

secret messages

Page 10: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Quantum computers A quantum computer is built using qubits

instead of classical bits for memory A qubit is not necessary 1 or 0

Instead, it can be a superposition of them (both at the same time)

A quantum computer may be able to explore many possible answers at the same time

After computation is complete, the qubits are measured

Measuring collapses their quantum states into either 1's or 0's

Page 11: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Shor's algorithm

Shor's algorithm is an algorithm invented by Peter Shor in 1994 to factor integers

With enough qubits, Shor's algorithm can factor an integer in O((log N)2(log log N)(log log log N)) time In other words, polynomial in the length of

the number N that is being factored RSA depends on the difficulty of factoring Shor's algorithm can be adapted to solve

the discrete log problem as well

Page 12: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

What a quantum computer could do Break all popular public key cryptography

The RSA, El Gamal, and Elliptic Curve public key systems can all be broken by Shor's algorithm

But there are some other systems out there that are not known to be vulnerable to quantum algorithms

Get a quadratic speedup when trying to brute force symmetric ciphers like AES Meaning that attempts might be needed

instead of Suggests that key lengths should be doubled

Page 13: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

What quantum computers have done 2001: Factor 15 into 3 x 5 2012: Factor 21 into 3 x 7 2012: Factor 143 into 11 x 13 2012: Factor 56153 into 241 x 233

(although not realized until 2014) There is some progress! The bigger ones are using a different

approach to quantum computing than Shor's algorithm

A breakthrough could be soon…

Page 14: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Technical problems There are lots of approaches for making quantum

computers But none of them look very good yet

It's hard to make qubits that behave right It's hard to make algorithms that efficiently query the

qubits A phenomenon called quantum decoherence causes

qubits to lose their superposition Some quantum computers have to be cooled to almost

absolute zero to reduce decoherence D-Wave is the best known quantum computer

manufacturer So far, none of their computers outperform classical computers

Page 15: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Quantum communication

The other (and possibly more profitable) way to use quantum mechanics is as a way to send secret information

To do so, Sam (the sender) sends Ruth (the receiver) photons

What's really remarkable about this kind of quantum cryptography is that no one can eavesdrop on it

Page 16: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

The setup Light travels with a certain orientation, called

its polarization Real polarization can be between 0° and

180° (the book says 360 °, but the wave goes up and down, so it doesn't really make sense to say that)

We can break it down into 4 directions by rounding:

It's critically important that it's hard to distinguish and and hard to distinguish and

Page 17: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Sending For each bit Sam wants to send, he

randomly decides if he's sending straight or diagonal

Ruth also randomly decides if she's receiving straight or diagonal If she uses the wrong filter, will be confused with

or will be confused with

Basis Filter 0 1Straight

Diagonal X

Page 18: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Receiving

Ruth receives symbols, but she isn't sure what she got

On a public channel, she tells Sam which basis she was using for each bit

Then Sam knows which ones she would have gotten right and which ones she would have gotten wrong

He tells her which ones she would have gotten right

Those are the ones that they keep

Page 19: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Why this works It's not a great way to send a message But it is a great way to agree on random bits

In other words, a session key for regular communication

If Eve is eavesdropping, quantum properties say that she'll disturb the polarization of the photons

Thus, Ruth will get garbage To make sure that no one is eavesdropping,

Sam and Ruth share some bits publically, to see if they agree

Page 20: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Technical problems Most importantly, the process is inefficient

On average, half of the bits are bad, since Ruth had the wrong filter

Even more bits have to be ignored in order to do error checking and testing to see if there was an eavesdropper

Making the actual photon guns isn't easy, although a kind of pulsed laser has been successfully used

Another problem is that you have to have an optical quantum channel with anyone you want to exchange a key with Either through the atmosphere or through fiber optics

Page 21: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Successes

This technology is moving from theory into practice

Government labs in the US and the UK have tested devices working through the atmosphere at up to 45 km

Businesses that want to send high security traffic may negotiate keys using quantum key distribution in our lifetimes

Page 22: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Program Security

Page 23: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Secure programs For now, we will be pretty broad in our

definition of programs OS Applications Databases Almost any other software

What is a secure program? How do we know? How do we keep programs free from flaws? How do we protect computing resources

against programs that contain flaws?

Page 24: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Fixing faults

We can judge security by the number of faults found in a program

Count the number of faults found and fixed Program is good if it has few faults to

begin with, right? But isn’t the program good if we’ve fixed

a lot of faults? Which is more meaningful?

Page 25: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Penetrate and patch In the early days, security was shown by finding

faults and patching them Unfortunately, patching a fault often led to

creating another one Why?

The patch fixed a narrow problem, but the cause was more general

The fault had non-obvious side effects Fixing one problem caused a problem somewhere

else The fault was poorly fixed because a proper fix might

impact functionality or performance

Page 26: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Terminology

We talk about software bugs, but the term is vague

The IEEE favors the following: Error: A human mistake in developing

software (bad design, bad implementation, typo… )

Fault: An incorrect step inside of a program (many faults can be caused by a single error)

Failure: A system departing from its required behavior (a failure might not happen if a particular fault is never executed)

Page 27: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Unexpected behavior

Unexpected behavior is called a program security flaw

The IEEE terminology is for software engineering and doesn’t match exactly

A program security flaw could be a fault or a failure

Intentional security incidents are called cyber attacks

Cyber attacks are not as common as the problems caused by unintentional flaws

Page 28: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Why is life so hard? It’s very difficult to eliminate program

security flaws for two reasons:1. Programs should do a long list of

operations correctly and shouldn’t do another (possibly infinite) list of operations

The number of combinations to test is staggering

2. Software engineering develops faster than computer security

We’re always playing catch-up

Page 29: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Non-malicious program errors

Page 30: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Flaws Landwehr et al. divided flaws into intentional and

inadvertent The inadvertent flaws were divided into six categories

1. Validation: Incomplete or inconsistent permission checks2. Domain: Poorly controlled access to data3. Serialization and aliasing: Mistakes in program flow order4. Identification and authentication: Incorrect basis for

authentication5. Boundary condition: Failure on the first or last case6. Logic: Any mistakes in logic not already covered

Other lists have been made, but this one is representative

The next slides will cover some common types

Page 31: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Buffer overflows A buffer overflow happens when data is written

past the end (or beginning) of an array Consider the following Java code:

In Java, this code will throw an ArrayIndexOutOfBoundsException, but it will not write memory where it shouldn’t

In C/C++, it would

char[] buffer = new char[10];

for( int i = 0; i < 10; i++ )buffer[i] = 'A';

buffer[10] = 'B';

Page 32: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Buffer overflow

It could overwrite: User data

User code

System data

System code

A A A A A A A A A A BUser Data

A A A A A A A A A A BUser Data User Code

A A A A A A A A A A BUser Data System Data

A A A A A A A A A A BUser Data System Code

Page 33: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Buffer overflow security Without the presence of malicious

attackers, buffer overflows can corrupt your data (or the system’s) or crash your program

A malicious attacker can exploit buffer overflows By inserting data into system data or code so

that the system does what he or she wants By overwriting the stack pointer to cause

arbitrary code in the attacker’s memory to be executed

Page 34: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Incomplete mediation

Incomplete mediation happens with a system does not have complete control over the data that it processes

Example URL: http://www.security.com/query.php?date=2012March20

Wrong URL: http://www.security.com/query.php?date=2000Hyenas

The HTML generates the URL, but the URL can be entered manually

Page 35: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Incomplete mediation security For a website, a carelessly altered

URL might just mean a 404 error For a program, bad data could cause

any number of faults and failures Malicious attackers could change

data or mount an SQL injection attack to destroy or reveal database internals

Values should always be checked and sanitized

Page 36: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Bobby Tables

Page 37: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Time-of-check to time-to-use A time-of-check to time-to-use flaw is

one where one action is requested, but before it can be performed, the data related to the action is changed

The book’s example is a man who promises to buy a painting for $100 who puts five $20 bills on the counter and pulls one back when the clerk is turning to wrap up the painting

In this flaw, the first action is authorized, but the second may not be

Page 38: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

File CommandMyFile.txt Change byte 4 to

'A'

File CommandYourFile.txt Delete file

Time-of-check to time-to-use It seems like things happen instantly in a computer Many operations, especially those on files, may be

put into a queue of work Imagine you give the OS a data structure with this

command:

After it is authorized but before it can be executed, you change it to:

Page 39: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Case Study: Therac-25

Page 40: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Therac-25 background Therac-25 was a radiation therapy machine built by

the Atomic Energy of Canada Limited It was the successor to the Therac-6 and Therac-20

machines The machine had low power and high power modes The low power mode shot a beam directly at the

patient The high power mode created X-rays by shooting

the beam at a target, spread these X-rays with a flattening filter, shaped the beam with movable blocks, and tested the strength of the beam with an X-ray ion chamber

Page 41: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Tragedies

In some situations, the high power beam was activated without the spreader in place

The software and hardware systems did not catch this particular problem

Over 100 times the intended dose was given

At least 2 people died and there were at least 6 overdoses total

Software bugs actually kill people!

Page 42: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Direct causes A certain unusual combination of keystrokes

had to happen within 8 seconds There were no hardware interlocks to prevent

the problem if the user overrode the error code

Error codes were not well-documented and were displayed as a number

Software was reused from previous models that did have hardware interlocks

Arithmetic overflow caused safety checks to fail in some cases

Page 43: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Indirect causes

The software/hardware combination had never been tested before use

Personnel did not believe complaints due to confidence in the system

Code was not independently reviewed

Errors were easily overridden

Page 44: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Quiz

Page 45: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Upcoming

Page 46: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Next time…

Finish non-malicious code Malicious code

Page 47: Week 5 - Friday.  What did we talk about last time?  Hash functions  Birthday paradox  Digital signatures

Reminders

Read section 3.2 Finish Assignment 2

Due next Monday Start on Project 2