1 The Fortuna PRNG Niels Ferguson. 2 The problem We need to make “random” choices in cryptographic protocols. Computers are deterministic. Standard “random”

Slides:



Advertisements
Similar presentations
Ulams Game and Universal Communications Using Feedback Ofer Shayevitz June 2006.
Advertisements

An Introduction to Stream Ciphers Zahra Ahmadian Electrical Engineering Department Sahrif University of Technology
Lecture 19 Page 1 CS 111 Online Protecting Operating Systems Resources How do we use these various tools to protect actual OS resources? Memory? Files?
David Evans CS588: Security and Privacy University of Virginia Computer Science Lecture 11: Birthday Paradoxes.
Query Evaluation. An SQL query and its RA equiv. Employees (sin INT, ename VARCHAR(20), rating INT, age REAL) Maintenances (sin INT, planeId INT, day.
Session 5 Hash functions and digital signatures. Contents Hash functions – Definition – Requirements – Construction – Security – Applications 2/44.
© 2003 School of Computing, University of Leeds SY32 Secure Computing, Lecture 15 Implementation Flaws Part 3: Randomness and Timing Issues.
CMSC 414 Computer and Network Security Lecture 21 Jonathan Katz.
Chapter 4  Hash Functions 1 Overview  Cryptographic hash functions are functions that: o Map an arbitrary-length (but finite) input to a fixed-size output.
CS 104 Introduction to Computer Science and Graphics Problems
CMSC 414 Computer and Network Security Lecture 9 Jonathan Katz.
1 Analysis of the Linux Random Number Generator Zvi Gutterman, Benny Pinkas, and Tzachy Reinman.
ITIS 6200/8200. time-stamping services Difficult to verify the creation date and accurate contents of a digital file Required properties of time-stamping.
Building Secure Software Chapter 9 Race Conditions.
CMSC 414 Computer (and Network) Security Lecture 24 Jonathan Katz.
Session 6: Introduction to cryptanalysis part 1. Contents Problem definition Symmetric systems cryptanalysis Particularities of block ciphers cryptanalysis.
Random numbers in Python Nobody knows what’s next...
Computer Security CS 426 Lecture 3
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
CS255 Programming Project 1. Programming Project 1 Due: Friday Feb 8 th (11:59pm)‏ – Can use extension days Can work in pairs – One solution per pair.
CMSC 414 Computer and Network Security Lecture 3 Jonathan Katz.
Cryptography and Network Security Chapter 11 Fifth Edition by William Stallings Lecture slides by Lawrie Brown.
1 Physical Clocks need for time in distributed systems physical clocks and their problems synchronizing physical clocks u coordinated universal time (UTC)
Virtual Memory.
Lecture 7 Page 1 CS 236 Online Password Management Limit login attempts Encrypt your passwords Protecting the password file Forgotten passwords Generating.
Security and Random Number Generators
Lecture 18 Page 1 CS 111 Online Design Principles for Secure Systems Economy Complete mediation Open design Separation of privileges Least privilege Least.
Simulation II IE 2030 Lecture 18. Outline: Simulation II Advanced simulation demo Review of concepts from Simulation I How to perform a simulation –concepts:
1 CIS 5371 Cryptography 3. Private-Key Encryption and Pseudorandomness B ased on: Jonathan Katz and Yehuda Lindel Introduction to Modern Cryptography.
GOLD UNIT 4 - IT SECURITY FOR USERS (2 CREDITS) Thomas Jenkins.
Chapter X When can I consider my personal data secure?
Computer Security Preventing and Detecting Unauthorized Use of Your Computer.
Making a great Project 2 OCR 1994/2360. Analysis This is the key to getting it right. Too many candidates skip through this section. It’s worth 20% of.
CS555Spring 2012/Topic 51 Cryptography CS 555 Topic 5: Pseudorandomness and Stream Ciphers.
André Seznec Caps Team IRISA/INRIA HAVEGE HArdware Volatile Entropy Gathering and Expansion Unpredictable random number generation at user level André.
WEP Protocol Weaknesses and Vulnerabilities
Viruses Hackers Backups Stuxnet Portfolio Computer viruses are small programs or scripts that can negatively affect the health of your computer. A.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP.
Attacks on PRNGs - By Nupura Neurgaonkar CS-265 (Prof. Mark Stamp)
Lecture 12 Page 1 CS 236, Spring 2008 Virtual Private Networks VPNs What if your company has more than one office? And they’re far apart? –Like on opposite.
Week 4 - Friday.  What did we talk about last time?  Snow day  But you should have read about  Key management.
Lecture 14 Page 1 CS 236 Online Race Conditions A common cause of security bugs Usually involve multiprogramming or multithreaded programs Caused by different.
Chapter 5 Files and Exceptions I. "The Practice of Computing Using Python", Punch & Enbody, Copyright © 2013 Pearson Education, Inc. What is a file? A.
Random numbers in C++ Nobody knows what’s next....
Google Chrome OS: A New Frontier in the World of OS.
Introduction to Information Retrieval Introduction to Information Retrieval Lecture 4: Index Construction Related to Chapter 4:
Network Security. Three tools Hash Function Block Cipher Public Key / Private Key.
Lecture 5 Page 1 Advanced Network Security Review of Cryptography: Cryptographic Keys Advanced Network Security Peter Reiher August, 2014.
Lecture 15 Page 1 CS 236 Online Evaluating Running Systems Evaluating system security requires knowing what’s going on Many steps are necessary for a full.
NETW3005 Virtual Memory. Reading For this lecture, you should have read Chapter 9 (Sections 1-7). NETW3005 (Operating Systems) Lecture 08 - Virtual Memory2.
Slide 1 Vitaly Shmatikov CS 378 Stream Ciphers. slide 2 Stream Ciphers uRemember one-time pad? Ciphertext(Key,Message)=Message  Key Key must be a random.
Real-life cryptography Pfeiffer Alain.  Types of PRNG‘s  History  General Structure  User space  Entropy types  Initialization process  Building.
Key Wrap Algorithm.
Analysis. This involves investigating what is required from the new system and what facilities are available. It would probably include:
24/06/20161 Hardware Processor components & ROM. 224/06/2016 Learning Objectives Describe the function and purpose of the control unit, memory unit and.
หัวข้อบรรยาย Stream cipher RC4 WEP (in)security LFSR CSS (in)security.
Outline The basic authentication problem
Outline Properties of keys Key management Key servers Certificates.
Dynamic Domain Allocation
Introduction To Computers
Topic 14: Random Oracle Model, Hashing Applications
Digital Signature Schemes and the Random Oracle Model
Random numbers Taken from notes by Dr. Neil Moore
Cryptography Lecture 4.
Cryptography Lecture 6.
The Seduction of the One-Time Pad
Cryptography and Network Security Chapter 7
Cryptography Lecture 4.
Pseudorandom Numbers Network Security.
Presentation transcript:

1 The Fortuna PRNG Niels Ferguson

2 The problem We need to make “random” choices in cryptographic protocols. Computers are deterministic. Standard “random” functions are completely inadequate. Must be unpredictable for an attacker!

3 “Real” RNG Random Number Generator. A “real” RNG is a specialised hardware device that produces random numbers. Difficult and expensive. Prone to undetected failures. Not included in my PC.

4 PRNG Pseudo-Random Number Generator. Deterministic algorithm. Produces “random-looking” numbers. Widely used. Most of them cryptographically useless.

5 CSPRNG Cryptographically Strong Pseudo-Random Number Generator. Deterministic algorithm. Can’t predict one output given other output values. Don’t ever use anything else.

6 PRNG internals Internal state. State initialised with a random seed. Generator function that produces some output bits plus a new state. Generator Old stateNew state Output

7 Generator function Can be built from existing cryptographic primitives: Block ciphers. Hash functions. Stream ciphers.

8 Fortuna generator State consists of 256-bit key K bit counter C. AES C Output K +1 new C

9 State compromise What happens if an attacker manages to break into the machine and retrieve the PRNG state? This reveals all past outputs! It also reveals all future outputs.

10 Forward security Generate as many output blocks as required for the request. Generate two more blocks. Wipe key K. Set K to the two extra generated blocks. Protects against future state compromise.

11 Initialising the generator Set (C,K) = (0,0). Refuse to generate any output if C = 0. (Re)seed operation is required for first output.

12 (Re)seeding the generator Add seed material to the existing state. K = SHA d -256( K || seed string ) C = C + 1

13 The big problem Where does the seed come from?

14 Solution 1 Let the application choose the seed.

15 Problem 1 This is not a solution. It just moves the problem to someone else, who is less well equipped to handle it.

16 Solution 2 Use the current time as the seed.

17 Problem 2 This is not a secret. Attacker can guess the time value. Guess can be verified by looking at some random data. Correct guess reveals all random data.

18 Solution 3 Construct the seed from the current time, the process ID, the value of the windows handle, etc.

19 Problem 3 Still not a secret. Requires a bit more guessing, but not a whole lot.

20 Seed requirements Seed must be unpredictable to the attacker. Measure of unpredictability: entropy

21 Entropy Unit of information. Formal definitions exist. A bit that will be set with probability 0.5 has 1 bit of entropy. A bit that will be set with probability 0.75 has 0.811… bits of entropy. A bit that will be set with probability 0.9 has 0.469… bits of entropy

22 Entropy (continued) Entropy of a variable depends on how many possible values it can have. Entropy depends on the probability distribution of those values. Entropy also depends on the knowledge we already have. Entropy is always relative to someone’s knowledge.

23 White lie There are several different kinds of entropy. Shannon entropy: from information theory. Renyi entropy: used to analyse probability of duplicate values. Guessing entropy: most appropriate here. I will ignore these complications.

24 Back to reseeding Seed must have high entropy with respect to the knowledge that the attacker has. We don’t know how much the attacker knows. We can’t know how much effective entropy any particular value has.

25 Solution 4 Ask the user to type some random text.

26 Problem 4 Low entropy: many users produce something like “fdsajkl;fdsjkl;fsdajkl;fsdaj” Attacker can try to stuff keystrokes into the keyboard buffer. Or maybe she can sniff the keystrokes in some way.

27 Fundamental problem Entropy is not available in sufficient quantities when we want it. Initial reseed must come from external source. Let’s leave this problem for now.

28 Recovery from compromise Assume that attacker knows our PRNG state. Irregular stream of “random events”. Can we evict the attacker and recover to an unknown state?

29 Typical event sources Mouse movements & detailed timings. Keyboard data & timings. Disk response speed. Clock jitter. Network packet timing. …

30 Assumption Together, the events contain at least some entropy w.r.t. the attacker. Otherwise there is no hope of recovery.

31 Reseed on every event Simple solution. Reseed sets K = SHA d -256( K || event data). Harmless to reseed with non-random event.

32 Problem Does not work. Attacker knows old state, and can guess the event data. Asks for some random data from generator, and verify the guess.

33 Pooling Save up events in a pool. Reseed with whole pool at once. Attacker has to guess the whole pool. Recovers from state compromise if entropy of pool is large enough.

34 How large a pool Should pool events until we have, say, 128 bits of entropy. But we don’t know the entropy of the events. Can’t decide how many events to pool. Need to estimate the entropy.

35 Entropy estimators Don’t even try. Impossible: depends on knowledge of the attacker. Various estimator systems have been proposed. All are ad-hoc, and heuristic.

36 Fortuna pooling Keep 32 pools: P 0, …, P 31. Each event source distributes its events over the pools. Entropy flows into pools at approximately the same rate. But we don’t know at which rate.

37 Fortuna reseeding Reseed whenever P 0 is large enough to be interesting. Include pool P k every 2 k reseeds.

38 Heuristic analysis T = Time between reseeds. R = rate at which entropy flows into each pool. Pool k is used in a reseed every T · 2 k seconds. In that time it has collected R · T · 2 k bits of entropy.

39 One “good” pool As long as R and T are reasonable, there is at least one pool that collects 128 bits of entropy before it is used. We don’t know which pool. But we don’t care! Within a factor of 64 of optimal.

40 Further tricks Require that T  0.1 s. Don’t store the pools, but hash the pools.

41 Back to the initial seed We still need to have a starting seed value.

42 Seed file “Random” data on persistent storage. Read at startup and use to seed the PRNG. Danger: using the same seed file twice. Danger: compromise of the seed file.

43 At startup Read the seed file. Use contents to seed the PRNG. Generate new contents for seed file using PRNG. Write new seed file. Wait until write is permanent. (How?) Allow PRNG to be used.

44 Regularly Write new seed file. This incorporates the events that were used during the reseeds into the seed file state.

45 On shutdown Reseed with all the data from all the pools. Write a new seed file. Beware: losing the seed file is far worse than not writing a new one. Maybe use two files?

46 Initial seed file Unsolved problem. We need an external source for the seed file. Require factory to provide one? Ask user help during installation of OS?

47 Don’t ignore the problem The first thing you (should) do on a new computer is to generate cryptographic keys for various purposes. Those have to be secure. This needs a good PRNG… which requires a good initial seed file.

48 Seed file details Closely look at the atomicity of file updates. Most operating systems don’t promise anything. Even disk drives might buffer writes. Do the best you can.

49 Three parts of Fortuna Generator to service the requests. Pools & reseed control to recover from state compromise. Seed file & logic to provide starting seed. Required: initial seed file.

50 Where? Operating system has access to all events that can be used in a PRNG. Therefore, PRNG should be part of the operating system. It isn’t in most cases. Work to be done!

51 Hardware RNG Don’t use it directly. Use it as an event source for Fortuna. Keeps you safe if your RNG breaks (which happens more often than you’d like). Can use it for initialisation.

52 Warning Some systems have “real random” RNGs. Try to extract entropy from the events. Have to use entropy estimators. Pure heuristics, and therefore dangerous.

53 Conclusion A good PRNG is vital for good cryptographic systems. Fortuna is the state of the art. Relatively easy to implement, except for the parts that are inherently hard. Don’t settle for anything less.