CS 683 - Security and Privacy Spring 2018 Instructor: Karim - - PowerPoint PPT Presentation

cs 683 security and privacy spring 2018
SMART_READER_LITE
LIVE PREVIEW

CS 683 - Security and Privacy Spring 2018 Instructor: Karim - - PowerPoint PPT Presentation

CS 683 - Security and Privacy Spring 2018 Instructor: Karim Eldefrawy University of San Francisco http://www.cs.usfca.edu/~kelde frawy/teaching/spring2018/cs6 83/cs683_main.htm (https://goo.gl/t396Fw) 1 Ba Basi sics s of of Bl Bloc


slide-1
SLIDE 1

CS 683 - Security and Privacy Spring 2018

Instructor: Karim Eldefrawy

University of San Francisco

http://www.cs.usfca.edu/~kelde frawy/teaching/spring2018/cs6 83/cs683_main.htm (https://goo.gl/t396Fw)

1

slide-2
SLIDE 2

Ba Basi sics s of

  • f Bl

Bloc

  • ckchain-bas

based d Cr Cryptoc

  • curr

rrencies s and Systems

slide-3
SLIDE 3

A A good d so sour urce for more information

Slides of this lecture are largely based on those presented in accompanying videos (for lectures 1 and 2) at: http://bitcoinbook.cs.princeton.edu/

slide-4
SLIDE 4

Crypto Back ckground: Hash Funct ctions, Hash Po Pointers, and Hash Po Pointer-ba based d Data Struct ctures

slide-5
SLIDE 5

Has Hash h Func Functio tions ns

  • Functional requirements:
  • Takes any string or arbitrary length as input
  • Fixed-size output (we will use 256 bits as an example)
  • Efficiently computable
  • Security requirements:
  • Collision-free
  • Hiding
  • Puzzle-friendly
slide-6
SLIDE 6

Pr Property 1 of Hash Functions: Collision-fr free

  • No adversary can find x and y such that

x ≠ y and H(x) = H(y)

X H(X) = H(y) Y

slide-7
SLIDE 7

Ho How w to find ind a a collis llisio ion? n?

  • Try 2130 randomly chosen inputs

(for a 256 bit hash output)

  • 99.8% chance two of them will

collide This works no matter how H is constructed … but takes long to be a serious attack that matters

slide-8
SLIDE 8

Appl Application: n: ha hash sh as s messa ssage di digest

slide-9
SLIDE 9

Pr Property 2 of Hash Functions: Hiding

slide-10
SLIDE 10

Pr Property 2 of Has Hash h Func Functio tions ns: Hiding Hiding

slide-11
SLIDE 11

Appl Application: n: Co Commitment

X X

Commit Open

slide-12
SLIDE 12

Co Commi mmitme ment AP API 1/ 1/3

slide-13
SLIDE 13

Co Commi mmitme ment AP API 2/ 2/3

slide-14
SLIDE 14

Co Commi mmitme ment AP API 3/ 3/3

slide-15
SLIDE 15

Pr Property 3 3 of

  • f H

Hash F Function

  • ns :

: Pu Puzzle-fr friendly

slide-16
SLIDE 16

Appl Application: n: Search h puz puzzle

slide-17
SLIDE 17

SH SHA-256 256

slide-18
SLIDE 18

Has Hash h Poin inter ers

slide-19
SLIDE 19

Ka Kay Idea

Utilize hash pointers to build efficient integrity ensuring data-structures

slide-20
SLIDE 20

Has Hash h po poin inter er chaining haining

slide-21
SLIDE 21

Has Hash h po poin inter er chaining haining

slide-22
SLIDE 22

Has Hash h po poin inter er chaining haining

slide-23
SLIDE 23

Tr Tree using hash pointers

Root Hash

We have seen this before; in what context?

slide-24
SLIDE 24

Adv Advantages s of f Merkel Trees

slide-25
SLIDE 25

Mo More generally …

Can use hash pointer in any pointer-based data structure that has no cycles

  • Hash pointers will ensure integrity of

information stored/used in the data structure

slide-26
SLIDE 26

Dig Digit ital S al Sig ignatures in in t the C Context o

  • f

Cr Cryp yptocurr rrencies

slide-27
SLIDE 27

Re Requirements of a digital signature scheme

slide-28
SLIDE 28

AP API for di digi gital si signa gnatur ures

slide-29
SLIDE 29

Re Requirements for signatures

slide-30
SLIDE 30

Se Securi rity game me for r a signature scheme me

slide-31
SLIDE 31

Se Securi rity game me for r a signature scheme me

slide-32
SLIDE 32

Se Securi rity game me for r a signature scheme me

slide-33
SLIDE 33

Se Securi rity game me for r a signature scheme me

slide-34
SLIDE 34

Se Securi rity game me for r a signature scheme me

slide-35
SLIDE 35

Addi Additiona nal issue ssues

slide-36
SLIDE 36

Wha What si signa gnatur ure sc sche heme is s use used d in n Bitcoin

ECDSA is the elliptic curve version of the DSA standard which is similar to El-Gamal signature scheme.

slide-37
SLIDE 37

Us Useful l tr tric ick: use e public lic key as as an an id iden entity tity

slide-38
SLIDE 38

Ho How w to gener enerate e a a ne new w iden identity tity

In practice: use H(pk) as identity as it is smaller than pk

slide-39
SLIDE 39

De Dece centraliz alized id identit ity m man anag agement

slide-40
SLIDE 40

Pr Privacy is complicate ated

Addresses not directly connected to real-world identity. (Un)linkability: But observer can link together an address’s activity over time, and make inferences.

slide-41
SLIDE 41

Si Simp mple Examp mples of Cr Cryptocurr rrency Designs

slide-42
SLIDE 42

At Attempt #1: Goofy Coin

slide-43
SLIDE 43

Op Operation of f Goofy y Co Coin 1/3

Rule #1:

slide-44
SLIDE 44

Op Operation of f Goofy y Co Coin 2/3

Rule #2:

slide-45
SLIDE 45

Op Operation of f Goofy y Co Coin 3/ 3/3

Rule #3:

slide-46
SLIDE 46

Bi Big se securi rity y issu ssue with Goofy y Co Coin

Double-Spending

Double-spending is one of the hardest security challenges to solve when developing a cryptocurrency

slide-47
SLIDE 47

At Attempt #2: Scrooge Coin

slide-48
SLIDE 48

Op Operation of f Scrooge Co Coin 1/3

slide-49
SLIDE 49

Op Operation of f Scrooge Co Coin 2/ 2/3

Transaction Type #1:

slide-50
SLIDE 50

Op Operation of f Scrooge Co Coin 3/3 /3

Transaction Type #2:

slide-51
SLIDE 51

Im Immut utable able Coins ins

slide-52
SLIDE 52

Th The main problem with Scrooge Coin

Crucial question: Can we descroogify the currency, and

  • perates without any central, trusted

party?

slide-53
SLIDE 53

Ho How w Bit itcoin in solv lves es the the dec decen entr traliz alizatio tion n is issue ue

slide-54
SLIDE 54

Bi Bitcoin’s s Peer-to to-Pe Peer Network

  • A peer-to-peer network without any “central” authority for

ensuring integrity of transactions and keeping track of

  • wnership of (Bit)coins (and minting them)
  • Ledger and history of ALL transactions are public and

available for anyone to inspect

slide-55
SLIDE 55

Ce Centralizations s vs s Decentralizations

  • Competing paradigms that underlie many digital technologies

Sir Tim Berners-Lee (inventor of the Web)

slide-56
SLIDE 56

De Dece centraliz alizatio ion is is n not all all-or

  • r-no

nothi hing ng

  • Email:

Decentralized protocol, but dominated by centralized webmail services.

slide-57
SLIDE 57

Aspe Aspects s of f de decentralization n in n Bi Bitcoin

  • Who maintains the ledger?
  • Who has authority over which transactions are valid?
  • Who creates new bitcoins?
  • Who determines how the rules of the system change?
  • How do bitcoins acquire exchange value?
  • Beyond the protocol:

Exchanges, wallet software, service providers …

slide-58
SLIDE 58

Aspe Aspects s of f de decentralization n in n Bi Bitcoin

slide-59
SLIDE 59

Bi Bitcoin’s s key y challenge: distri ributed conse sensu sus

slide-60
SLIDE 60

Wh Why y conse nsensus nsus pr protocols? s?

  • Traditional motivation: reliability in distributed systems.
  • Distributed key-value store enables various applications:

DNS, public-key directory, stock trades, databases … etc.

Good target for Altcoins!

slide-61
SLIDE 61

De Defin inin ing d dis istrib ibuted c consensus

  • Assume N servers/processors/processes.
  • The protocol terminates and all correct nodes decide on the same

value (V).

  • The value V must have been proposed by some correct node.
  • Typically assume honest majority, e.g., less than N/3 or N/2 are

misbehaving.

slide-62
SLIDE 62

Bi Bitcoin is s a peer-to to-peer peer system em

Note: Bob’s computer is not in the picture

coin’s history Alice’s transaction is broadcast/flooded throughout the Bitcoin network

slide-63
SLIDE 63

Ho How w cons nsens ensus us co could wo work in Bitcoin

At any given time:

  • All nodes have a sequence of blocks of transactions they’ve reached

consensus on

  • Each node has a set of outstanding transactions it’s heard about (but

consensus has not happened for them yet)

slide-64
SLIDE 64

Ho How w cons nsens ensus us co could wo work in Bitcoin

Consensus reached on these blocks

slide-65
SLIDE 65

How consensus could work in Bitcoin

slide-66
SLIDE 66

Ho How w cons nsens ensus us co could wo work in Bitcoin

slide-67
SLIDE 67

Ho How w cons nsens ensus us co could wo work in Bitcoin

The green block is chosen as a result of consensus and is added to the agreed-upon blockchain. This is close to how Bitcoin cloud work, but not exactly. Why? Consensus reached on these blocks

slide-68
SLIDE 68

Wh Why y conse nsensus nsus is s ha hard

No notion of global time!

slide-69
SLIDE 69

Ma Many imp mpossibility results

  • Byzantine generals problem:

https://en.wikipedia.org/wiki/Byzantine_fault_tolerance#B yzantine_Generals'_Problem

  • Fischer-Lynch-Paterson (deterministic nodes): consensus

impossible with a single faulty note

slide-70
SLIDE 70

So Some me well-kn known conse sensu sus s protocols

http://www.cs.yale.edu/homes/aspnes/pinewiki/Paxos.html

slide-71
SLIDE 71

Un Under erstan andin ing im impossib ibility ility res esults lts

slide-72
SLIDE 72

Bi Bitcoin conse sensu sus: s: theory y vs s practice

slide-73
SLIDE 73

So Some me things Bi Bitcoin does differently

Bitcoin does not solve the (large-scale) consensus problem in the general sense, but only in the context of a digital currency system.

slide-74
SLIDE 74

Wh Why y ide dentity? y?

Why don’t Bitcoin nodes have identities?

  • Identity is hard in a P2P system – Sybil attack
  • Pseudonymity is a goal of Bitcoin
slide-75
SLIDE 75

We Weaker assumption: select random nodes

slide-76
SLIDE 76

Ke Key idea: implicit consensus

slide-77
SLIDE 77

Bi Bitcoin conse sensu sus s algori rithm m (si (simp mplifi fied)

slide-78
SLIDE 78

Wha What can n a malicious us no node de do do?

slide-79
SLIDE 79

Wha What can n a malicious us no node de do do?

slide-80
SLIDE 80

Wha What can n a malicious us no node de do do?

slide-81
SLIDE 81

Wha What can n a malicious us no node de do do?

slide-82
SLIDE 82

Wha What can n a malicious us no node de do do?

slide-83
SLIDE 83

Wha What can n a malicious us no node de do do?

Honest nodes will extend the longest valid branch.

slide-84
SLIDE 84

Fr From Bob b the the mer erchan hant’s po poin int t of vie view

slide-85
SLIDE 85

Fr From Bob b the the mer erchan hant’s po poin int t of vie view

slide-86
SLIDE 86

Fr From Bob b the the mer erchan hant’s po poin int t of vie view

slide-87
SLIDE 87

Fr From Bob b the the mer erchan hant’s po poin int t of vie view

slide-88
SLIDE 88

Fr From Bob b the the mer erchan hant’s po poin int t of vie view

slide-89
SLIDE 89

Fr From Bob b the the mer erchan hant’s po poin int t of vie view

slide-90
SLIDE 90

Re Recap

slide-91
SLIDE 91

Assum Assumption n of f ho hone nesty y is s pr probl blematic

slide-92
SLIDE 92

Assum Assumption n of f ho hone nesty y is s pr probl blematic

slide-93
SLIDE 93

Pr Proof-of

  • f-Wo

Work (Po PoW) ) and Incentives s in Bi Bitcoin

  • PoW in Bitcoin is finding a value that when hashed (SHA-256)

the hash begins with a certain number of zeros (control of difficulty level)

  • Incentive for Mining/Ensuring Integrity of Blockchain: The first

transaction in a block is a special transaction that starts a new coin owned by the creator of the block.

Block Tx Tx … Previous Hash Nonce (to be found) Block Tx Tx … Previous Hash Nonce (to be found)

slide-94
SLIDE 94

Assum Assumption n of f ho hone nesty y is s pr probl blematic

slide-95
SLIDE 95

Su Summa mmary of Operation of

  • f B

Bitcoi

  • in’s N

Networ

  • rk

1) New transactions are broadcast to all nodes 2) Each node collects new transactions into a block 3) Each node works on finding a solution to a (somewhat) difficult proof-of-work puzzle for its block 4) When a node finds a solution to the proof-of-work puzzle, it broadcasts the block to all nodes 5) Nodes accept block only if all transactions in it are valid and not already spent 6) Nodes express their acceptance of the block by working on creating the next block in the chain, using the hash of the accepted block as the previous hash

slide-96
SLIDE 96

Exploring recent Bitcoin blocks/transactions 1/4

https://blockchain.info/block/00000000000000000042e9d461887fbfcd65d70d436f9c825031f8fc7ce09809

slide-97
SLIDE 97

Exploring recent Bitcoin blocks/transactions 2/4

slide-98
SLIDE 98

Exploring recent Bitcoin blocks/transactions 3/4

slide-99
SLIDE 99

Exploring recent Bitcoin blocks/transactions 4/4