Randomness Some content taken from Silence on the Wire by Michal - - PowerPoint PPT Presentation

randomness
SMART_READER_LITE
LIVE PREVIEW

Randomness Some content taken from Silence on the Wire by Michal - - PowerPoint PPT Presentation

Randomness Some content taken from Silence on the Wire by Michal Zalewski Todays Agenda Randomness in Private Key Generation Randomness in Election (fraud) Randomness in Coin Flipping What is random? Chosen without method


slide-1
SLIDE 1

Randomness

Some content taken from “Silence on the Wire” by Michal Zalewski

slide-2
SLIDE 2

Today’s Agenda

  • Randomness in Private Key Generation
  • Randomness in Election (fraud)
  • Randomness in Coin Flipping
slide-3
SLIDE 3

What is random?

  • Chosen without method
slide-4
SLIDE 4

Random beacons

  • Atmospheric noise
  • random.org
  • Radioactive Decay
  • http://www.fourmilab.ch/hotbits/
  • Lava lamps
  • Cloudflare
  • Thunderstorms
  • Seismic data in earthquake-prone areas
slide-5
SLIDE 5

Pseudorandom vs. random

Characteristics Psuedorandom Random Efficiency Excellent Poor Determinism Deterministic Nondeterministic Periodicity Periodic Aperiodic

https://www.random.org/randomness/

slide-6
SLIDE 6

How computers use randomness

  • Blinky lights
  • Quicksort
  • Computer games
  • Cryptographic keys
slide-7
SLIDE 7
slide-8
SLIDE 8
slide-9
SLIDE 9

Randomness in Private Key Generation

  • Applied cryptography relies on randomness in key

generation.

  • Lack of randomness —> somebody else can

guess your private key

slide-10
SLIDE 10
slide-11
SLIDE 11

Pseudorandom Number Generation

  • Pick a (random) seed
  • Algorithmically pick the next number.
slide-12
SLIDE 12

Netscape PRNG

global variable seed; RNG_CreateContext() (seconds, microseconds) = time of day; /* Time elapsed since 1970 */ pid = process ID; ppid = parent process ID; a = mklcpr(microseconds); b = mklcpr(pid + seconds + (ppid << 12)); seed = MD5(a, b); RNG_GenerateRandomBytes() x = MD5(seed); seed = seed + 1; return x;

slide-13
SLIDE 13

Netscape’s Crypto Issues

  • 40 bit keys
  • seeded PRNG with time
  • can get process info with ps
slide-14
SLIDE 14

Feeding /dev/urandom

  • There can be no general method for determining

an outcome of any computer procedure or algorithm in a finite time.

  • paraphrasing of Alan Turing
slide-15
SLIDE 15

Feeding /dev/urandom

slide-16
SLIDE 16

Feeding /dev/urandom

  • Entropy from running a computer enters the

entropy pool

  • Process reads from that pool
slide-17
SLIDE 17

Using randomness to create keys

  • Algorithms for creating prime number candidates

(pseudoprimes)

  • Algorithms for detecting if a number could be

prime quickly (verify pseudoprimes)

slide-18
SLIDE 18

DJB quoting Mark Twain

  • Behold, the fool saith, "Put not all thine eggs in the
  • ne basket"—which is but a manner of saying,

"Scatter your money and your attention;" but the wise man saith, "Put all your eggs in the one basket and—WATCH THAT BASKET."

  • http://blog.cr.yp.to/20140205-entropy.html
slide-19
SLIDE 19
slide-20
SLIDE 20

Weak Keys (2008)

  • At least 5.23% of TLS hosts use default keys
  • 0.75% of TLS certificates share keys (bad entropy in

key gen)

  • 1.70% come from the same faulty implementations

(susceptible to compromise)

  • Obtained RSA private keys for 0.50% of TLS hosts and

0.03% of SSH hosts (shared p or q)

  • Vast majority found in embedded systems
slide-21
SLIDE 21

RSA: Recall from last class

  • Choose two large, distinct prime numbers p, q.
  • Compute the modulus n=pq
  • φ(n) = φ(p)×φ(q) = (p−1)×(q−1)
  • φ(n): Number of integers less than n that aren’t coprime
  • coprime: x,y are coprime if the only common factor they have is 1.
  • Pick a number, e, such that e<φ(n) and e,φ(n) are coprime.
  • Determine d such that de ≡ 1 (mod φ(n))
  • Public key is (n,e). Private key is (n,d).
slide-22
SLIDE 22

How did they factor?

  • Pairwise GCD of all distinct RSA moduli
  • N1=p1*q1, N2=p2*q2
  • If no factors are common, than GCD(N1,N2)=1
  • Otherwise, if p1=p2, then GCP(N1, N2)=p1
  • 5.5 hours for over 11 million RSA keys
slide-23
SLIDE 23

Commonly Repeated Keys

slide-24
SLIDE 24

Visualizing RSA Common Factors

slide-25
SLIDE 25

Generating Keys from Boot

slide-26
SLIDE 26

2009 Iranian Election

  • Mahmoud Ahmadinejad ran against three others
  • 85% turnout
  • Mahmoud Ahmadinejad “won” with 64% of the vote
  • Caused massive protests “Green Revolution”
slide-27
SLIDE 27
slide-28
SLIDE 28

Benford's Law

slide-29
SLIDE 29
slide-30
SLIDE 30

Methodology

  • Look at election results
  • Ask NYU undergrads to make up numbers
  • Compare least significant digits
slide-31
SLIDE 31
slide-32
SLIDE 32
slide-33
SLIDE 33

Runs Test

  • A sequence with n heads and m tails
  • A run is a sequence of coin flips with the same side
  • 11000100010000101110111101001000101110111
slide-34
SLIDE 34

Runs Test

  • Given a sequence of n heads; m tails; R runs
  • E(R) = (2nm / (n+m)) + 1
  • V(R) = ( 2nm(2nm – n – m )) / ((n + m)2 (n + m – 1))
  • Z score: (x - E(R)) / √(V(R))
slide-35
SLIDE 35