building and breaking block chains
play

Building and Breaking Block Chains Merlin Corey Pandoblox Engineer - PowerPoint PPT Presentation

Building and Breaking Block Chains Merlin Corey Pandoblox Engineer Shellcon 2018 Who is that Merlin guy? Cryptography nerd Null Space Labs keyholder LayerOne Hardware Hacking Village Defcon Tamper Evident Village DC949


  1. Building and Breaking Block Chains Merlin Corey Pandoblox Engineer Shellcon 2018

  2. Who is that Merlin guy? ● Cryptography nerd ● Null Space Labs keyholder ● LayerOne Hardware Hacking Village ● Defcon Tamper Evident Village ● DC949 Alumni ● Startup Wizard at Pandoblox

  3. Assumptions ● Cryptographic fundamentals ● Vague ideas of what a cryptocurrency is ● Passing familiarity with Python or another language

  4. Cryptographic Fundamentals ● Hashing is most important concept ● One-way function ● Ideally – Large space – Randomized value – No collisions

  5. Vague ideas of Cryptocurrency ● Magical internet currency ● The future of everything ● Really slow database ● Pyramid scheme?

  6. Basic programming ● TrackA = Room(‘pufferfish’) ● Merlin = Speaker() ● For each Attendee in TrackA.attendees() – Attendee.ListenTo(Merlin) ● Print(‘Now you know Python’)

  7. Building Basic Blockchain: Prior Art ● https://github.com/dvf/blockchain ● https://github.com/zack-bitcoin/basiccoin

  8. Building Basic Blockchain: Challenge ● How hard could it be?

  9. Building Basic Blockchain: Challenge ● How hard could it be? – Pretty hard, honestly

  10. Building Basic Blockchain: Challenge ● How hard could it be? – Pretty hard, honestly – But we’ll keep it as simple as possible

  11. Building Basic Blockchain: High level Components ● Transaction ● Block ● Blockchain ● Node ● Network

  12. Building Basic Blockchain: High level Components ● Transaction – Inputs – Outputs – Coinbase

  13. Building Basic Blockchain: High level Components ● Block – Transactions ● Merkle Root – Proof – Parent block

  14. Building Basic Blockchain: High level Components ● Blockchain – Blocks connected by parent blocks – Block #0 ● Block #1 (Child of #0) – Block #2 (Child of #1) ● Block #3 (Child of #2) ● Block #4 (Child of #3) ● Block #5 (Child of #4) ● … ● Block #N (Child of #N-1)

  15. Building Basic Blockchain: High level Components ● Node – Miner – Wallet

  16. Building Basic Blockchain: High level Components ● Network – Nodes – Blocks – Protocol

  17. Build Basic Block Chain: Transaction Input

  18. Build Basic Block Chain: Transaction Output

  19. Build Basic Block Chain: Transaction

  20. Build Basic Block Chain: Special Transactions

  21. Building Basic Blockchain: Hashing ● Exploring hashing with live code

  22. Build Basic Blockchain: Hashing

  23. Build Basic Blockchain: Merkle Tree T op Hash Hash 0 hash( ) + Hash 1 Hash Hash 0 1 Hash 0-0 Hash 1-0 hash( ) hash( ) + + Hash 0-1 Hash 1-1 Hash Hash Hash Hash 0-0 0-1 1-0 1-1 hash(L1) hash(L2) hash(L3) hash(L4) Data L1 L2 L3 L4 Blocks

  24. Build Basic Block Chain: Merkle Root

  25. Building Basic Blockchain: Block Helpers

  26. Building Basic Blockchain: Genesis Block

  27. Building Basic Blockchain: Blockchain ● Exploring blockchain with live code

  28. Building Basic Blockchain: Virtual Machine ● Transaction outputs are scripts

  29. Building Basic Blockchain: Virtual Machine ● Transaction outputs are scripts ● Breathe a sigh of relief

  30. Building Basic Blockchain: Virtual Machine ● Transaction outputs are scripts ● Breathe a sigh of relief – We won’t be implementing all that today! ● Listen to Merlin ramble on about it, anyway

  31. Breaking Basic Blockchain ● What is controllable ● How is a 51% attack executed?

  32. Breaking Production Blockchains: Smart Contracts ● There are many attacks against smart contracts

  33. Breaking Production Blockchains: Smart Contracts ● There are many attacks against smart contracts – Underflow and Overflow are the most basic

  34. Breaking Production Blockchains: Smart Contracts ● Understanding the DAO hack

  35. Breaking Production Blockchains: Smart Contracts ● Understanding the DAO hack – Recursive function calls are dangerous

  36. Breaking Production Blockchains: Smart Contracts ● Understanding the DAO hack – Recursive function calls are dangerous – Especially when you do work on either side of them

  37. Breaking Production Blockchains: Smart Contracts ● Understanding the DAO hack

  38. Breaking Production Blockchains: Smart Contracts ● ERC20 Short Address Attack – Generate address with trailing zero – Send to address without trailing zero

  39. Protecting Production Blockchains: Nodes and Wallets ● Private keys – Passphrases – Cold storage ● RTFM your configuration ● Firewalls ● Monitoring and Alerting

  40. Protecting Production Blockchains: Network ● Economic feasibility of 51% attacks ● Like any other software: patches

  41. Protecting Production Blockchains: Network ● Economic feasibility of 51% attacks ● Like any other software: patches – Bitcoin DoS [patch] ● Bitcoin Infinite Inflation? ● Notice of Vulnerability ● CVE-2018-17144

  42. Protecting Production Blockchains: Smart Contracts in Solidity ● Avoid reentrancy issues ● Be careful of overflows and underflows ● Use a library – Like SafeMath ● Check lengths of addresss and other data ● Use EthFiddle and test

  43. Protecting Production Blockchains: Smart Contracts in Solidity ● Avoid reentrancy issues ● Be careful of overflows and underflows ● Use a library – Like SafeMath ● Check lengths of addresss and other data ● Use EthFiddle and test – Test

  44. Protecting Production Blockchains: Smart Contracts in Solidity ● Avoid reentrancy issues ● Be careful of overflows and underflows ● Use a library – Like SafeMath ● Check lengths of addresss and other data ● Use EthFiddle and test – Test ● Test!

  45. Questions and Contact ● Any questions? – If you’re still awake, that is ● Want to talk to Merlin? – Come check out NSL 4.0 starting late October! – Hang out on EFNet in #NSL – Hand him a drink at any conference!

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend