SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
Gentle introductionto
BlockchainSecurityBELLAJ BADR
S
WHAT IS THE BLOCKCHAIN?
• A blockchain is a tamper-proof,
shared digital ledger that records
transactions(history) that take
place between the peers in a peer-
to-peer network.
• All the confirmed and validated
transaction blocks are linked and
chained from the beginning of the
chain to the most current block,
hence the name blockchain.
BLOCK CHAIN
SHA256(SHA256(80byte header of block k)).
data's integrity.
WHAT IS THE BLOCKCHAIN?
WHAT IS THE BLOCKCHAIN?
NO SPOF
In the Context of protocol stack, cryptocurrency is a blockchain service
5
• THE DIGITALCURRENCY
• CONSENSUS PROTOCOL
• TRANSACTIONPROTOCOL
• THE LEDGER : SHARED
DATA LAYER
• GMAIL
• SMTP – SIMPLE
MAIL TRANSFER
PROTOCOL
• TCP/IP –
TRANSMISSION
CONTROL
PROTOCOL/INTERNET
PROTOCOL
Application
Layer
Application
Protocol Layer
General
Protocol Layer
HOW IT WORKS?
STACK VUE (Blockchain System):
Security
layer
FEATURES
DECENTRALIZED
CONSENSUS
Ensure Consensus within a
decentralized Network.
TRANSPARENCE &
ANONYMITY
DATA is available to the
participants.
Users are anonymous
IMMUTABILITY
Data is stored for ever in the
blockchain and can’t be
altered
*The genesis blockchain
WHAT IS THE BLOCKCHAIN?
Blockchain is BFT.
POW : Byzantine general problem resolution.
Blockchain is Secure by design
Cryptography + Computationalshield
SHA256(Pow, address), RIPEMD-160(address), ECDSA
Variant of DSA that ECC(1992 by Vanstone)
.
secp256k1,from SECG (the "Standards for Efficient Cryptography Group", founded by Certicom)
Benefits Of ECC :
• Smaller key size provides
• Storage efficiencies
• Bandwidth savings
• Computational efficiencies
• Relatively newer field
Security Level
“256-bit ECC public key should provide comparable
security to a 3072-bit RSA public key”
51% Attack
The probabilityof a transaction
being reversed decreases
exponentiallywith the number
of confirmationsit has received.
Computationalshield
for an attacker to be able to successfully interfere
with the Bitcoin network and block and reverse
transactions
Bitcoin uses SHA-
256 encryption
for both its Proof-
of-Work (PoW)
system and
transaction
verification
3 ExaHash/S !!!
Computationalshield
The computing power of the Bitcoin
network is 7468 times higher than
the one of the cumulative 500 world
supercomputers.
X7500
Computationalshield
An Antminer S9 runs at 0.1 Joule per GH (109 hashes)
1026 hashes * 0.1 J / 109 hashes = 1015 joules
1015 joules = 2,777,777,778 kw hours * $0.10
kw/hour = $277,777,778 worth of electricity to
rewrite the entire blockchain
$3,028 worth of electricity per block
Computationalshield
Sybil Attack
(resistance)
Because the bitcoinprotocol
considers the true chain to be the
one with the most cumulative
proof of work (not the longest
chain as is often incorrectly
stated,)
it’s not possible for someone to launch an attack against a
node by creating many dishonest peers
Computationalshield
Bitcoin
Code Bugs
most real Blockchain
vulnerabilities do not
stem from a weakness
in the underlying
hardness assumption,
but rather from
implementation issues
Computationalshield
Human Factor
Zerocoin bug in the code allowedthe attacker
to reuse his existing validproofs to
generate additional Zerocoinspend
transactions(370,000 Zcoins=> 410 BTC).
Smart Contract Security
ETHEREUM BLOCKCHAIN
Code Issue Leads to $60M Theft
DAO Hack
DAO
Decentralized Autonomous Organization (DAO)
Organization without CA => No CEO => Smart contract
Decentralized fund manager
SMART
CONTRACT
• “A smart contract is a program
that runs on the blockchain
• and has its correct execution
enforced by the consensus
protocol”
• They enable trustless financial
services like loans,
micropayments, and more.
• Get rid of intermediariesand
thirdparties
SMART
CONTRACT
DAO
The DAO was the largest crowdfunding in history, having raised over
$150m from more than 11,000 enthusiastic members.
The DAO has lost 3.6m ether
1ether =17(60M) $ today =80(288M)
function splitDAO(...
...
withdrawRewardFor(msg.sender); // be nice, and get his rewards
totalSupply -= balances[msg.sender];
balances[msg.sender] = 0;
paidOut[msg.sender] = 0;
return true;
}
The Heist
the attacker managed to drain
more than 3.6 million Ether
into a “child DAO” that has the
same structure as The DAO
On 17th of June an attacker tried to rob ~3.5M ETH using the reentry exploit
// THIS CONTRACT CONTAINS A BUG - DO NOT USE contract Recipient {
contract Fund { uint counter;
/// Mapping of ether shares of the contract. function() {
mapping(address => uint) shares; if (counter < 10) {
/// Withdraw your share. Fund(msg.sender).withdraw();
function withdraw() { counter+=1;
if (msg.sender.call.value(shares[msg.sender])())
}
shares[msg.sender] = 0;
}
}
}
}
The attack (quite simple)
function getBalance(address user)
constant returns(uint) {
return userBalances[user];
}
function addToBalance() {
userBalances[msg.sender] +=
msg.amount;
}
function withdrawBalance() {
amountToWithdraw =
userBalances[msg.sender];
if
(!(msg.sender.call.value(amountToWith
draw)())) { throw; }
userBalances[msg.sender] = 0;
}
function () {
// To be called by a vulnerable
contract with a withdraw function.
// This will double withdraw.
vulnerableContract v;
uint times;
if (times == 0 && attackModeIsOn) {
times = 1;
v.withdrawBalance ();
} else { times = 0; }
}
vulnerableContract.withdraw run 1
attacker default function run 1
vulnerableContract.withdraw run 2
attacker default function run 2
reentry exploit
function withdrawBalance() {
amountToWithdraw =
userBalances[msg.sender];
userBalances[msg.sender] = 0;
if (amountToWithdraw > 0) {
if
(!(msg.sender.send(amountToWithdraw
))) { throw; }
}
}
Correction
Blockchain DDOS
• Sandboxing
• Repricing the opcodes.
• VM rearchitecting
Fight against DDOS A transaction or smart contract
execution takes too long
Security measures
● It’s early days - we lack experience:
○ Solidity version 0.4.11
○ Mist version 0.8.9
○ Geth version 1.6.1
○ Frontier has been launched ~ 2 year ago
○ Number of operating Dapps still very low
● Vitalik suggested 10M$ as cap in foundation blog
Cap contracts
Mathematically proof that a contract has a certain feature or invariant
http://dr-y.no-ip.net/
Formal proof verification
formal verificationis the act of proving or disproving the
correctness of intended algorithmsunderlying a system
with respect to a certain formal specificationor property,
using formal methods of mathematics.
● Stake Vote (X% of all Ether)
Going stepwise from centralization to decentralization
● Ethereum: Olympic - Frontier (canaries) - Homestead (difficulty increase)
-
Metropolis …
● DAO: Curators (except of “splitDAO”)
● DigixDAO, MakerDAO
Who could control it:
● token holders (The DAO)
● central trusted authority (DigixDAO)
● “Community multisig” ?
Centralization
DAO:
● 7 Days for splitDAO proposals
● 14 Days for regular proposals
● 27 days creation period
● …
Gives time for a central authority (if implemented in the contract) to act
Time Delays
Statistics: ~15-50 bugs per 1000 lines of code
Not everything needs decentralization and needs to be in the smart contract
● Only include in a smart contract the very core of a Dapp
● Reuse trusted proven code
○ Standard Token Contract
○ Foundation multisig
○ (Hopefully one day a DAO standard framework)
Minimal complexity
Statistics: ~15-50 bugs per 1000 lines of code
Not everything needs decentralization and needs to be in the smart contract
● Only include in a smart contract the very core of a Dapp
Source: https://eprint.iacr.org/2016/633.pdf
Code security flaws
● Formal proof verification (work in progress)
● Compiler warnings (work in progress)
● Improved IDEs (work in progress)
● Trusted Libraries (work in progress)
● Best practices literature (work in progress)
● Decentralized master keys / Decentralized escape hatches / trusted
community multisig to be used in smart contracts as centralized authorities
Better tools
Best practices
http://solidity.readthedocs.io/en/latest/security-considerations.html
● 1024 call stack depth -> always check return values of each call
● Block gas limit -> No arbitrary length loops
● Reentry exploit -> update state before executing CALLs
● Ether sent to contract without contract invocation -> be careful with Invariants
● Specify right amount of gas (SEND vs CALL)
● Block timestamp can be manipulated -> block.number are safer
● Tx.orgin vs msg.sender (pishing attacks)
● …
Literature: https://github.com/ConsenSys/smart-contract-best-practices
Establish security patterns
It’s early days, like the
internet in 90s
Conclusion
https://arxiv.org/pdf/1605.09193.pdf
Bitcoin’sSecurity Model Revisited

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Blockchain Introduction Presentation
Blockchain Introduction PresentationBlockchain Introduction Presentation
Blockchain Introduction Presentation
 
Blockchain in cyber security
Blockchain in cyber securityBlockchain in cyber security
Blockchain in cyber security
 
Blockchain in cyber security
Blockchain in cyber securityBlockchain in cyber security
Blockchain in cyber security
 
The DAO attack - Ethereum
The DAO attack - EthereumThe DAO attack - Ethereum
The DAO attack - Ethereum
 
Blockchain
BlockchainBlockchain
Blockchain
 
Blockchain Security Issues and Challenges
Blockchain Security Issues and Challenges Blockchain Security Issues and Challenges
Blockchain Security Issues and Challenges
 
Blockchain
BlockchainBlockchain
Blockchain
 
Blockchain: The New Technology and Its Applications for Libraries
Blockchain: The New Technology and Its Applications for LibrariesBlockchain: The New Technology and Its Applications for Libraries
Blockchain: The New Technology and Its Applications for Libraries
 
Overview of blockchain technology and architecture
Overview of blockchain technology and   architectureOverview of blockchain technology and   architecture
Overview of blockchain technology and architecture
 
Blockchain consensus algorithms
Blockchain consensus algorithmsBlockchain consensus algorithms
Blockchain consensus algorithms
 
Blockchain basics
Blockchain basicsBlockchain basics
Blockchain basics
 
BLOCK CHAIN
BLOCK CHAINBLOCK CHAIN
BLOCK CHAIN
 
What is Block chain
What is Block chain What is Block chain
What is Block chain
 
Blockchain 101 by imran bashir
Blockchain 101  by imran bashirBlockchain 101  by imran bashir
Blockchain 101 by imran bashir
 
01 - Introduction to Hyperledger : A Blockchain Technology for Business
01 - Introduction to Hyperledger : A Blockchain Technology for Business01 - Introduction to Hyperledger : A Blockchain Technology for Business
01 - Introduction to Hyperledger : A Blockchain Technology for Business
 
Cryptography in Blockchain
Cryptography in BlockchainCryptography in Blockchain
Cryptography in Blockchain
 
Ppt on blockchain technology
Ppt on blockchain technologyPpt on blockchain technology
Ppt on blockchain technology
 
Blockchain, cryptography, and consensus
Blockchain, cryptography, and consensusBlockchain, cryptography, and consensus
Blockchain, cryptography, and consensus
 
Blockchain - HyperLedger Fabric
Blockchain - HyperLedger FabricBlockchain - HyperLedger Fabric
Blockchain - HyperLedger Fabric
 
How does blockchain work
How does blockchain workHow does blockchain work
How does blockchain work
 

Ähnlich wie Security in the blockchain

Ähnlich wie Security in the blockchain (20)

Best practices to build secure smart contracts
Best practices to build secure smart contractsBest practices to build secure smart contracts
Best practices to build secure smart contracts
 
Ethereum Blockchain and DApps - Workshop at Software University
Ethereum Blockchain and DApps  - Workshop at Software UniversityEthereum Blockchain and DApps  - Workshop at Software University
Ethereum Blockchain and DApps - Workshop at Software University
 
Token platform based on sidechain
Token platform based on sidechainToken platform based on sidechain
Token platform based on sidechain
 
Hello world contract
Hello world contractHello world contract
Hello world contract
 
Chronicle accelerate building a digital currency
Chronicle accelerate   building a digital currencyChronicle accelerate   building a digital currency
Chronicle accelerate building a digital currency
 
Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018
Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018
Simone Bronzini - Weaknesses of blockchain applications - Codemotion Milan 2018
 
How to be a smart contract engineer
How to be a smart contract engineerHow to be a smart contract engineer
How to be a smart contract engineer
 
Blockchain, cryptography and tokens — NYC Bar presentation
Blockchain, cryptography and tokens — NYC Bar presentationBlockchain, cryptography and tokens — NYC Bar presentation
Blockchain, cryptography and tokens — NYC Bar presentation
 
Blockchain architected
Blockchain architectedBlockchain architected
Blockchain architected
 
Blockchain and Smart Contract Simulation
Blockchain and Smart Contract SimulationBlockchain and Smart Contract Simulation
Blockchain and Smart Contract Simulation
 
blockchain-and-trusted-computing
blockchain-and-trusted-computingblockchain-and-trusted-computing
blockchain-and-trusted-computing
 
Hyperledger Fabric Application Development 20190618
Hyperledger Fabric Application Development 20190618Hyperledger Fabric Application Development 20190618
Hyperledger Fabric Application Development 20190618
 
Ergo Presentation - Tokyo
Ergo Presentation - TokyoErgo Presentation - Tokyo
Ergo Presentation - Tokyo
 
Basics of Block Chain
Basics of Block ChainBasics of Block Chain
Basics of Block Chain
 
Robust Programming of Smart Contracts in Solidity+, RK Shyamasundar
Robust Programming of Smart Contracts in Solidity+, RK ShyamasundarRobust Programming of Smart Contracts in Solidity+, RK Shyamasundar
Robust Programming of Smart Contracts in Solidity+, RK Shyamasundar
 
Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices Architecture
 
New Business Models enabled by Blockchain
New Business Models enabled by BlockchainNew Business Models enabled by Blockchain
New Business Models enabled by Blockchain
 
2017 Microservices Practitioner Virtual Summit: Microservices at Squarespace ...
2017 Microservices Practitioner Virtual Summit: Microservices at Squarespace ...2017 Microservices Practitioner Virtual Summit: Microservices at Squarespace ...
2017 Microservices Practitioner Virtual Summit: Microservices at Squarespace ...
 
Programming smart contracts in solidity
Programming smart contracts in solidityProgramming smart contracts in solidity
Programming smart contracts in solidity
 
Smart contracts using web3.js
Smart contracts using web3.jsSmart contracts using web3.js
Smart contracts using web3.js
 

Mehr von Bellaj Badr

Mehr von Bellaj Badr (14)

Cours4.pptx
Cours4.pptxCours4.pptx
Cours4.pptx
 
0240-formation-ssh-secure-shell.pdf
0240-formation-ssh-secure-shell.pdf0240-formation-ssh-secure-shell.pdf
0240-formation-ssh-secure-shell.pdf
 
5-Authentification.2P.pdf
5-Authentification.2P.pdf5-Authentification.2P.pdf
5-Authentification.2P.pdf
 
Is web 3 an overengineered solution
Is web 3 an overengineered solutionIs web 3 an overengineered solution
Is web 3 an overengineered solution
 
create your own cryptocurrency
create your own cryptocurrencycreate your own cryptocurrency
create your own cryptocurrency
 
Blockchain and bitcoin in numbers
Blockchain and bitcoin in numbersBlockchain and bitcoin in numbers
Blockchain and bitcoin in numbers
 
Blockchain Tokenization
Blockchain TokenizationBlockchain Tokenization
Blockchain Tokenization
 
Blockchain demystification
Blockchain demystificationBlockchain demystification
Blockchain demystification
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
An introduction to AI (artificial intelligence)
An introduction to AI (artificial intelligence)An introduction to AI (artificial intelligence)
An introduction to AI (artificial intelligence)
 
Connected Car Platform (CC-p)
Connected Car Platform (CC-p) Connected Car Platform (CC-p)
Connected Car Platform (CC-p)
 
the age of cryptocurrency at Devoxx Morocco
the age of cryptocurrency at Devoxx  Moroccothe age of cryptocurrency at Devoxx  Morocco
the age of cryptocurrency at Devoxx Morocco
 
C from hello world to 010101
C from hello world to 010101C from hello world to 010101
C from hello world to 010101
 
beware of Thing Bot
beware of Thing Botbeware of Thing Bot
beware of Thing Bot
 

Kürzlich hochgeladen

💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
nirzagarg
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
nilamkumrai
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 

Kürzlich hochgeladen (20)

Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
💚😋 Bilaspur Escort Service Call Girls, 9352852248 ₹5000 To 25K With AC💚😋
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
( Pune ) VIP Pimpri Chinchwad Call Girls 🎗️ 9352988975 Sizzling | Escorts | G...
 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
Sarola * Female Escorts Service in Pune | 8005736733 Independent Escorts & Da...
 
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
Yerawada ] Independent Escorts in Pune - Book 8005736733 Call Girls Available...
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
Pirangut | Call Girls Pune Phone No 8005736733 Elite Escort Service Available...
 
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Prashant Vihar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 

Security in the blockchain

  • 2. S WHAT IS THE BLOCKCHAIN? • A blockchain is a tamper-proof, shared digital ledger that records transactions(history) that take place between the peers in a peer- to-peer network. • All the confirmed and validated transaction blocks are linked and chained from the beginning of the chain to the most current block, hence the name blockchain. BLOCK CHAIN
  • 3. SHA256(SHA256(80byte header of block k)). data's integrity. WHAT IS THE BLOCKCHAIN?
  • 4. WHAT IS THE BLOCKCHAIN? NO SPOF
  • 5. In the Context of protocol stack, cryptocurrency is a blockchain service 5 • THE DIGITALCURRENCY • CONSENSUS PROTOCOL • TRANSACTIONPROTOCOL • THE LEDGER : SHARED DATA LAYER • GMAIL • SMTP – SIMPLE MAIL TRANSFER PROTOCOL • TCP/IP – TRANSMISSION CONTROL PROTOCOL/INTERNET PROTOCOL Application Layer Application Protocol Layer General Protocol Layer HOW IT WORKS? STACK VUE (Blockchain System): Security layer
  • 6. FEATURES DECENTRALIZED CONSENSUS Ensure Consensus within a decentralized Network. TRANSPARENCE & ANONYMITY DATA is available to the participants. Users are anonymous IMMUTABILITY Data is stored for ever in the blockchain and can’t be altered *The genesis blockchain WHAT IS THE BLOCKCHAIN?
  • 7. Blockchain is BFT. POW : Byzantine general problem resolution.
  • 8. Blockchain is Secure by design Cryptography + Computationalshield SHA256(Pow, address), RIPEMD-160(address), ECDSA Variant of DSA that ECC(1992 by Vanstone) . secp256k1,from SECG (the "Standards for Efficient Cryptography Group", founded by Certicom)
  • 9. Benefits Of ECC : • Smaller key size provides • Storage efficiencies • Bandwidth savings • Computational efficiencies • Relatively newer field Security Level “256-bit ECC public key should provide comparable security to a 3072-bit RSA public key”
  • 10.
  • 11. 51% Attack The probabilityof a transaction being reversed decreases exponentiallywith the number of confirmationsit has received. Computationalshield for an attacker to be able to successfully interfere with the Bitcoin network and block and reverse transactions
  • 12. Bitcoin uses SHA- 256 encryption for both its Proof- of-Work (PoW) system and transaction verification 3 ExaHash/S !!! Computationalshield
  • 13. The computing power of the Bitcoin network is 7468 times higher than the one of the cumulative 500 world supercomputers. X7500 Computationalshield
  • 14. An Antminer S9 runs at 0.1 Joule per GH (109 hashes) 1026 hashes * 0.1 J / 109 hashes = 1015 joules 1015 joules = 2,777,777,778 kw hours * $0.10 kw/hour = $277,777,778 worth of electricity to rewrite the entire blockchain $3,028 worth of electricity per block Computationalshield
  • 15. Sybil Attack (resistance) Because the bitcoinprotocol considers the true chain to be the one with the most cumulative proof of work (not the longest chain as is often incorrectly stated,) it’s not possible for someone to launch an attack against a node by creating many dishonest peers Computationalshield
  • 16. Bitcoin Code Bugs most real Blockchain vulnerabilities do not stem from a weakness in the underlying hardness assumption, but rather from implementation issues
  • 17. Computationalshield Human Factor Zerocoin bug in the code allowedthe attacker to reuse his existing validproofs to generate additional Zerocoinspend transactions(370,000 Zcoins=> 410 BTC).
  • 19. Code Issue Leads to $60M Theft DAO Hack
  • 20. DAO Decentralized Autonomous Organization (DAO) Organization without CA => No CEO => Smart contract Decentralized fund manager
  • 21. SMART CONTRACT • “A smart contract is a program that runs on the blockchain • and has its correct execution enforced by the consensus protocol” • They enable trustless financial services like loans, micropayments, and more. • Get rid of intermediariesand thirdparties
  • 23. DAO The DAO was the largest crowdfunding in history, having raised over $150m from more than 11,000 enthusiastic members. The DAO has lost 3.6m ether 1ether =17(60M) $ today =80(288M)
  • 24. function splitDAO(... ... withdrawRewardFor(msg.sender); // be nice, and get his rewards totalSupply -= balances[msg.sender]; balances[msg.sender] = 0; paidOut[msg.sender] = 0; return true; } The Heist the attacker managed to drain more than 3.6 million Ether into a “child DAO” that has the same structure as The DAO
  • 25. On 17th of June an attacker tried to rob ~3.5M ETH using the reentry exploit // THIS CONTRACT CONTAINS A BUG - DO NOT USE contract Recipient { contract Fund { uint counter; /// Mapping of ether shares of the contract. function() { mapping(address => uint) shares; if (counter < 10) { /// Withdraw your share. Fund(msg.sender).withdraw(); function withdraw() { counter+=1; if (msg.sender.call.value(shares[msg.sender])()) } shares[msg.sender] = 0; } } } } The attack (quite simple)
  • 26. function getBalance(address user) constant returns(uint) { return userBalances[user]; } function addToBalance() { userBalances[msg.sender] += msg.amount; } function withdrawBalance() { amountToWithdraw = userBalances[msg.sender]; if (!(msg.sender.call.value(amountToWith draw)())) { throw; } userBalances[msg.sender] = 0; } function () { // To be called by a vulnerable contract with a withdraw function. // This will double withdraw. vulnerableContract v; uint times; if (times == 0 && attackModeIsOn) { times = 1; v.withdrawBalance (); } else { times = 0; } } vulnerableContract.withdraw run 1 attacker default function run 1 vulnerableContract.withdraw run 2 attacker default function run 2 reentry exploit
  • 27. function withdrawBalance() { amountToWithdraw = userBalances[msg.sender]; userBalances[msg.sender] = 0; if (amountToWithdraw > 0) { if (!(msg.sender.send(amountToWithdraw ))) { throw; } } } Correction
  • 29. • Sandboxing • Repricing the opcodes. • VM rearchitecting Fight against DDOS A transaction or smart contract execution takes too long
  • 31. ● It’s early days - we lack experience: ○ Solidity version 0.4.11 ○ Mist version 0.8.9 ○ Geth version 1.6.1 ○ Frontier has been launched ~ 2 year ago ○ Number of operating Dapps still very low ● Vitalik suggested 10M$ as cap in foundation blog Cap contracts
  • 32. Mathematically proof that a contract has a certain feature or invariant http://dr-y.no-ip.net/ Formal proof verification formal verificationis the act of proving or disproving the correctness of intended algorithmsunderlying a system with respect to a certain formal specificationor property, using formal methods of mathematics.
  • 33. ● Stake Vote (X% of all Ether) Going stepwise from centralization to decentralization ● Ethereum: Olympic - Frontier (canaries) - Homestead (difficulty increase) - Metropolis … ● DAO: Curators (except of “splitDAO”) ● DigixDAO, MakerDAO Who could control it: ● token holders (The DAO) ● central trusted authority (DigixDAO) ● “Community multisig” ? Centralization
  • 34. DAO: ● 7 Days for splitDAO proposals ● 14 Days for regular proposals ● 27 days creation period ● … Gives time for a central authority (if implemented in the contract) to act Time Delays
  • 35. Statistics: ~15-50 bugs per 1000 lines of code Not everything needs decentralization and needs to be in the smart contract ● Only include in a smart contract the very core of a Dapp ● Reuse trusted proven code ○ Standard Token Contract ○ Foundation multisig ○ (Hopefully one day a DAO standard framework) Minimal complexity
  • 36. Statistics: ~15-50 bugs per 1000 lines of code Not everything needs decentralization and needs to be in the smart contract ● Only include in a smart contract the very core of a Dapp Source: https://eprint.iacr.org/2016/633.pdf Code security flaws
  • 37. ● Formal proof verification (work in progress) ● Compiler warnings (work in progress) ● Improved IDEs (work in progress) ● Trusted Libraries (work in progress) ● Best practices literature (work in progress) ● Decentralized master keys / Decentralized escape hatches / trusted community multisig to be used in smart contracts as centralized authorities Better tools
  • 39. http://solidity.readthedocs.io/en/latest/security-considerations.html ● 1024 call stack depth -> always check return values of each call ● Block gas limit -> No arbitrary length loops ● Reentry exploit -> update state before executing CALLs ● Ether sent to contract without contract invocation -> be careful with Invariants ● Specify right amount of gas (SEND vs CALL) ● Block timestamp can be manipulated -> block.number are safer ● Tx.orgin vs msg.sender (pishing attacks) ● … Literature: https://github.com/ConsenSys/smart-contract-best-practices Establish security patterns
  • 40. It’s early days, like the internet in 90s Conclusion https://arxiv.org/pdf/1605.09193.pdf Bitcoin’sSecurity Model Revisited