SlideShare a Scribd company logo
EXPLAIN ETHEREUM
SMART CONTRACT
HACKING
LIKE I AM FIVE
Zoltan Balazs
2018 October
Whoami?
Zombie Browser Toolkit
https://github.com/Z6543/ZombieBrowserPack
HWFW Bypass tool
Similar stuff was used in PacketRedirect in Danderspritz FlewAvenue by EQGRP
https://github.com/MRGEffitas/hwfwbypass
Malware Analysis Sandbox Tester tool
https://github.com/MRGEffitas/Sandbox_tester
Played with crappy IoT devices – my RCE exploit code running on ~600 000 IP cameras via Persirai
https://jumpespjump.blogspot.hu/2015/09/how-i-hacked-my-ip-camera-and-found.html
https://jumpespjump.blogspot.hu/2015/08/how-to-secure-your-home-against.html
Invented the idea of encrypted exploit delivery via Diffie-Hellman key exchange, to bypass exploit detection appliances
Implemented by Angler and Nuclear exploit kit developers
https://www.mrg-effitas.com/generic-bypass-of-next-gen-intrusion-threat-breach-detection-systems/
2
Questions
Hands up if you know something about blockchain
Hands up if you have ever tried to explain Bitcoin to your
parents/colleagues/kids
Hands up if it ended: “it is complicated”
Hands up if you have ever interacted with a Smart Contract
Why am I talking about this?
ITSEC folks laugh about Blockchain a lot
They believe it is
not happening
not important
not working
Bad news: it is happening!
Trust me, this is an important topic
I will calculate losses in Lamborghinis – 200K USD
So who am I to talk about this topic?
I don’t give advice
on investing/
selling/ HODLing
cryptocurrencies
Main idea of cryptocurrencies
Let’s go with metaphors on this topic
Math is hard (at least for me it is true)
Let’s form a group where we solve
mathematical challenges MINING
Everyone can easily check if someone solved
the hard math challenge
When someone solves a math challenge, they
receive moneZ (my imaginary cryptocurrency)
Transactions
If Bunny wants to send moneZ to Piggie,
everyone will know and has to know about
all details of the transaction
In fact, everyone knows how much
moneZ everyone has because it is public
knowledge
Sidenote: ETHEREUM different
Blockchain
The last not yet processed moneZ are collected in a transaction together
The bundle of transactions is included as additional parts to the math
challenge to be solved blocks
Including the transactions in the math challenges will cost moneZ for the
initiator transaction fee
A long paper trail is created where every blocks are recorded blockchain
How can newcomers get moneZ - Bitcoin, etc.?
They can start to solve new math challenges
Before that they should get a copy of the long paper trail -
blockchain
By solving math challenges and including the transactions, they
get the transaction fee
Or they can ask someone to send them moneZ
In exchange they can give something - real money, Alpaca
socks
What is a wallet
The wallet holds all the moneZ you previously
received
Whenever you send moneZ from your wallet to
someone else's wallet, you sign the transaction
with your signature, which is impossible to
counterfeit
Transactions are irreversible and final*
Everyone will know you transferred the money,
you can’t draw back
Why is this interesting?
You don’t have to be in the same room to do the math challenges
You can do all the stuff through the Internet
You don’t even have to know who the others are (pseudo-anonimity)
Smart Contracts
Assume you have a basic understanding of
cryptocurrencies in general
Let’s take a deep dive into Smart Contracts
Bitcoin is also capable of doing Smart
Contracts
Ethereum YAC (Yet Another
Cryptocurrency) was designed for Smart Contracts
Smart Contracts
You want to sign and get a countersign of the
contract
carve the contract into stone
contracts carved into the stone
cannot be modified
In the smart contract world, the stone is the
blockchain
it is powered by the time and
energy spent on solved math
challenges
Code is universal
What is gas?
Smart contract is code which can be executed by
anyone who solves the math challenges for
moneZ - mines the cryptocurrencies
Similarly to moneZ transaction fees, you have to
pay moneZ to get the smart contract code
executed by everyone
The more complex the smart contract code is, the
more moneZ you have to pay
This is called gas in Ethereum
Are we there yet?
Ethereum Virtual Machine
Bytecode: it is not a machine code, thus you need a VM to execute it
Solidity: compile JavaScript-like code into EVM bytecode
Source code can be published - creates trust
Solidity source code compiles into the same bytecode (reproducible)
At least with the same parameters and same compiler version
JavaScript developers today
Solidity (smart contract language) looks similar to
JavaScript
You need web3.js based frontend - this is JS
Many smart contract coders have JavaScript background
JavaScript: You must move fast and break things
With Ethereum Smart Contracts, this approach is not
“profitable” …
Solidity: Deploy once, be hacked anytime
Since August 2018 the latest Metamask has been
showing the hex data to be sent
Kittie ID in hex
Identifier for the Bid function (MethodID) –
keccak256(“bid(uint256)”)[:4]
59 zeroes because the
world needs 2ˆ256 Kitties
Code can be hacked
Smart contracts are code
The DAO: Recursive call + race condition
June 18th, 2016
Attacker transfers Ether worth $250 million from DAO
That is 1250 Lamborghinis
Reentrancy at the splitDAO function
The DAO hack
You can interrupt the bank teller while
he is giving you money
The bank teller only updates your
balance at the end
The DAO hack …
// INSECURE --- this is not DAO code, but similar so it is easy to understand
function withdrawBalance() public { // 1st line
uint amountToWithdraw = userBalances[msg.sender]; // 2nd line
require(msg.sender.call.value(amountToWithdraw)()); // 3rd line. At this point, the caller's code is
executed, and can call withdrawBalance again
userBalances[msg.sender] = 0; // 4th line
}
The solution?
Rewrite the past and pretend it didn’t happen
Attacker got away with his ETH Classic
worth $67.4 million – 337 Lambos
Multi-signature wallets
“Captain planet, the world’s first multi-factor authentication” © dnet
Shared vulnerable library + reinit - 2017 July 20
$31M stolen – 155 Lambos
A lot more was in danger, but good guys were faster
Lot of shared libraries exists in the blockchain
Save gas
Contracts now share the same vulnerabilities
Parity multi-signature wallets
Teh code
NON LIBRARY CODE
function() payable { // someone called a function we don’t have?
if (msg.value > 0) // some ether is sent
...
else if (msg.data.length > 0) //ether is not sent, but some data is
_walletLibrary.delegatecall(msg.data); //let’s check if we can execute this code via shared
library
}
● If the method name is not defined on this contract…
● And there’s no ether being sent in the transaction…
● And there is some data in the message payload…
for whatever method that calls DELEGATECALL, it will call the same method on the contract you're
delegating to, but using the context of the current contract
Teh library codez
function initWallet(address[] _owners, uint _required, uint _daylimit) {
//the shared library has initWallet and it is public !
initDaylimit(_daylimit);
initMultiowned(_owners, _required);
}
initWallet is not in the non-library code, but is called in the shared library
So some random guys don’t know how to code
Smart Contracts …
Fixing the Parity bug
Parity fixed previous bug
and introduced a new one
Library contract was not initialized properly. That allowed anyone to turn the library
contract into a multi-sig wallet
The next Parity hack
November 2017 - $300M lost – 1500 Lambos
@devops199 “accidentally” called initWallet()
method to own the library
@devops199 “accidentally” called kill() method
to self-destruct it
It was planned to be fixed – forking EIP-999. Community voted no
Intro to integer underflow
Underflow
If there are (unsigned integer
8) 3 people on the bus, and
four of them took of the bus,
how many people are still on
the bus?
255
Intro to integer overflow
Overflow
If there are (unsigned integer 8)
255 people on the bus, and the bus
is totally full, and one guy hops on
the bus, how many people are on
the bus?
Proof of Weak Hands
https://medium.com/@optimumregret/the-surreal-madness-
of-ethereums-pyramid-schemes-da705fe7d92e
USD 2M lost
unsigned integer underflow withdrawal
Use Safemath!
https://etherscan.io/tx/0x233107922bed72a4ea7c75a83ecf58dae4
b744384e2b3feacd28903a17b864e0
Conclusion
Blockchain, Ethereum, Smart Contracts are here to hack
Writing secure Smart Contracts is hard
Ethereum is still in beta
Hacking Smart Contracts is possible, fun, but probably illegal
Hacking your own smart contract is probably not illegal
Hacking in test blockchain is not illegal
Where to learn to code? cryptozombies.io
Where to learn to hack?
References
Nick Szabo: The idea of smart contracts 1997 https://perma.cc/V6AZ-7V8W
https://www.reddit.com/r/explainlikeimfive/comments/12knie/eli5_bitcoins/?st=IZW0ENOG&sh=d566a3ee
https://medium.freecodecamp.org/smart-contracts-for-dummies-a1ba1e0b9575
https://www.reddit.com/r/explainlikeimfive/comments/4lz9t4/eli5_ethereum/
http://hackingdistributed.com/2016/06/18/analysis-of-the-dao-exploit/
https://github.com/b-mueller/smashing-smart-contracts/blob/master/smashing-smart-contracts-1of1.pdf
https://medium.freecodecamp.org/a-hacker-stole-31m-of-ether-how-it-happened-and-what-it-means-for-ethereum-
9e5dc29e33ce
https://www.stateofthedapps.com/
Cryptozombies.io - best tutorial
Latest hype and scams: https://boards.4chan.org/biz/
48
Hack the planet!
zoltan.balazs@mrg-effitas.com
https://hu.linkedin.com/in/zbalazs
Twitter – @zh4ck
www.slideshare.net/bz98
HACKERSULI !!!1!
Greetz to @VitalikButerin, Satoshi
Nakamoto
https://JumpESPJump.blogspot.com

More Related Content

What's hot

Smart contract
Smart contractSmart contract
Smart contract
Akhmad Daniel Sembiring
 
Lapine blockchain introduction 10/04/2018
Lapine blockchain introduction 10/04/2018Lapine blockchain introduction 10/04/2018
Lapine blockchain introduction 10/04/2018
Chuck Bair
 
Blockchain And Cryptocurrency : How Blockchain And Cryptocurrency Relate To E...
Blockchain And Cryptocurrency : How Blockchain And Cryptocurrency Relate To E...Blockchain And Cryptocurrency : How Blockchain And Cryptocurrency Relate To E...
Blockchain And Cryptocurrency : How Blockchain And Cryptocurrency Relate To E...
Blockchain Council
 
Blockchain Technology and Cryptocurrency
Blockchain Technology and CryptocurrencyBlockchain Technology and Cryptocurrency
Blockchain Technology and Cryptocurrency
AdityaSingh1213
 
Smart contract
Smart contractSmart contract
Smart contract
Ninad Brahmin
 
Are blockchain and crypto interchangeable terms
Are blockchain and crypto interchangeable terms Are blockchain and crypto interchangeable terms
Are blockchain and crypto interchangeable terms
Blockchain Council
 
Contracts Across Coins - Smart Contracts for Bitcoin, Ripple and the altcoins
Contracts Across Coins - Smart Contracts for Bitcoin, Ripple and the altcoinsContracts Across Coins - Smart Contracts for Bitcoin, Ripple and the altcoins
Contracts Across Coins - Smart Contracts for Bitcoin, Ripple and the altcoins
Ripple Labs
 
An Introduction to Blockchain
An Introduction to BlockchainAn Introduction to Blockchain
An Introduction to Blockchain
Arun Sharma
 
Blockchain, Ethereum and Business Applications
Blockchain, Ethereum and Business ApplicationsBlockchain, Ethereum and Business Applications
Blockchain, Ethereum and Business Applications
Matthias Zimmermann
 
Blockchain and Bitcoin
Blockchain and BitcoinBlockchain and Bitcoin
Blockchain and Bitcoin
M Shamim Iqbal
 
Crypto currency secrets
Crypto currency secretsCrypto currency secrets
Crypto currency secrets
Sahir
 
How Blockchain Is Different From Cryptocurrency?
How Blockchain Is Different From Cryptocurrency?How Blockchain Is Different From Cryptocurrency?
How Blockchain Is Different From Cryptocurrency?
Endive Software
 
Smart contracts
Smart contractsSmart contracts
Smart contracts
Philippe Camacho, Ph.D.
 
INTRO TO BLOCKCHAINS AND CRYPTOCURRENCY
INTRO TO BLOCKCHAINS AND CRYPTOCURRENCYINTRO TO BLOCKCHAINS AND CRYPTOCURRENCY
INTRO TO BLOCKCHAINS AND CRYPTOCURRENCY
Joseph Holbrook, Chief Learning Officer (CLO)
 
Cryptocurrency solving problems
Cryptocurrency solving problems Cryptocurrency solving problems
Cryptocurrency solving problems
Suman Nayak
 
Blockchain and Bitcoin
Blockchain and BitcoinBlockchain and Bitcoin
Blockchain and Bitcoin
Hugo Rodrigues
 
Blockchain 2.0
Blockchain 2.0Blockchain 2.0
Blockchain 2.0
Jérôme Kehrli
 
Blockchain; how it works, and why you should care
Blockchain; how it works, and why you should careBlockchain; how it works, and why you should care
Blockchain; how it works, and why you should care
Vincent Olislagers
 
EDUCATION ON CRYPTOGRAPHY
EDUCATION ON CRYPTOGRAPHYEDUCATION ON CRYPTOGRAPHY
EDUCATION ON CRYPTOGRAPHY
globalbtcrating
 
An Introduction to Bitcoin, Blockchain and Cryptocurrency
An Introduction to Bitcoin, Blockchain and CryptocurrencyAn Introduction to Bitcoin, Blockchain and Cryptocurrency
An Introduction to Bitcoin, Blockchain and Cryptocurrency
Amarpreet Singh
 

What's hot (20)

Smart contract
Smart contractSmart contract
Smart contract
 
Lapine blockchain introduction 10/04/2018
Lapine blockchain introduction 10/04/2018Lapine blockchain introduction 10/04/2018
Lapine blockchain introduction 10/04/2018
 
Blockchain And Cryptocurrency : How Blockchain And Cryptocurrency Relate To E...
Blockchain And Cryptocurrency : How Blockchain And Cryptocurrency Relate To E...Blockchain And Cryptocurrency : How Blockchain And Cryptocurrency Relate To E...
Blockchain And Cryptocurrency : How Blockchain And Cryptocurrency Relate To E...
 
Blockchain Technology and Cryptocurrency
Blockchain Technology and CryptocurrencyBlockchain Technology and Cryptocurrency
Blockchain Technology and Cryptocurrency
 
Smart contract
Smart contractSmart contract
Smart contract
 
Are blockchain and crypto interchangeable terms
Are blockchain and crypto interchangeable terms Are blockchain and crypto interchangeable terms
Are blockchain and crypto interchangeable terms
 
Contracts Across Coins - Smart Contracts for Bitcoin, Ripple and the altcoins
Contracts Across Coins - Smart Contracts for Bitcoin, Ripple and the altcoinsContracts Across Coins - Smart Contracts for Bitcoin, Ripple and the altcoins
Contracts Across Coins - Smart Contracts for Bitcoin, Ripple and the altcoins
 
An Introduction to Blockchain
An Introduction to BlockchainAn Introduction to Blockchain
An Introduction to Blockchain
 
Blockchain, Ethereum and Business Applications
Blockchain, Ethereum and Business ApplicationsBlockchain, Ethereum and Business Applications
Blockchain, Ethereum and Business Applications
 
Blockchain and Bitcoin
Blockchain and BitcoinBlockchain and Bitcoin
Blockchain and Bitcoin
 
Crypto currency secrets
Crypto currency secretsCrypto currency secrets
Crypto currency secrets
 
How Blockchain Is Different From Cryptocurrency?
How Blockchain Is Different From Cryptocurrency?How Blockchain Is Different From Cryptocurrency?
How Blockchain Is Different From Cryptocurrency?
 
Smart contracts
Smart contractsSmart contracts
Smart contracts
 
INTRO TO BLOCKCHAINS AND CRYPTOCURRENCY
INTRO TO BLOCKCHAINS AND CRYPTOCURRENCYINTRO TO BLOCKCHAINS AND CRYPTOCURRENCY
INTRO TO BLOCKCHAINS AND CRYPTOCURRENCY
 
Cryptocurrency solving problems
Cryptocurrency solving problems Cryptocurrency solving problems
Cryptocurrency solving problems
 
Blockchain and Bitcoin
Blockchain and BitcoinBlockchain and Bitcoin
Blockchain and Bitcoin
 
Blockchain 2.0
Blockchain 2.0Blockchain 2.0
Blockchain 2.0
 
Blockchain; how it works, and why you should care
Blockchain; how it works, and why you should careBlockchain; how it works, and why you should care
Blockchain; how it works, and why you should care
 
EDUCATION ON CRYPTOGRAPHY
EDUCATION ON CRYPTOGRAPHYEDUCATION ON CRYPTOGRAPHY
EDUCATION ON CRYPTOGRAPHY
 
An Introduction to Bitcoin, Blockchain and Cryptocurrency
An Introduction to Bitcoin, Blockchain and CryptocurrencyAn Introduction to Bitcoin, Blockchain and Cryptocurrency
An Introduction to Bitcoin, Blockchain and Cryptocurrency
 

Similar to Zoltán Balázs - Ethereum Smart Contract Hacking Explained like I’m Five

Kriptovaluták, hashbányászat és okoscicák
Kriptovaluták, hashbányászat és okoscicákKriptovaluták, hashbányászat és okoscicák
Kriptovaluták, hashbányászat és okoscicák
hackersuli
 
BlockChain for the Banker
BlockChain for the BankerBlockChain for the Banker
BlockChain for the Banker
Bohdan Szymanik
 
Javascript toolset for Ethereum Smart Contract development
Javascript toolset for Ethereum Smart Contract developmentJavascript toolset for Ethereum Smart Contract development
Javascript toolset for Ethereum Smart Contract development
BugSense
 
The JavaScript toolset for development on Ethereum
The JavaScript toolset for development on EthereumThe JavaScript toolset for development on Ethereum
The JavaScript toolset for development on Ethereum
GreeceJS
 
Blockchain for Notaries
Blockchain for NotariesBlockchain for Notaries
Blockchain for Notaries
Patrice Kerremans
 
Smart contract honeypots for profit (and fun) - bha
Smart contract honeypots for profit (and fun)  - bhaSmart contract honeypots for profit (and fun)  - bha
Smart contract honeypots for profit (and fun) - bha
PolySwarm
 
Blockchain School 2019 - Security of Smart Contracts.pdf
Blockchain School 2019 - Security of Smart Contracts.pdfBlockchain School 2019 - Security of Smart Contracts.pdf
Blockchain School 2019 - Security of Smart Contracts.pdf
Davide Carboni
 
Blockchain for Developers
Blockchain for DevelopersBlockchain for Developers
Blockchain for Developers
Shimi Bandiel
 
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency appDylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
DevCamp Campinas
 
Cryptocurrency_slide
Cryptocurrency_slideCryptocurrency_slide
Cryptocurrency_slide
aman pandey
 
Blockchain, smart contracts - introduction
Blockchain, smart contracts - introductionBlockchain, smart contracts - introduction
Blockchain, smart contracts - introduction
Lukasz Jarmulowicz
 
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
Codemotion
 
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereum
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereumDappsmedia smartcontract _write_smartcontracts_on_console_ethereum
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereum
Tomoaki Sato
 
All aboard the blockchain!
All aboard the blockchain!All aboard the blockchain!
All aboard the blockchain!
The Software House
 
Blockchain Tokenization
Blockchain TokenizationBlockchain Tokenization
Blockchain Tokenization
Bellaj Badr
 
Ethereum in a nutshell
Ethereum in a nutshellEthereum in a nutshell
Ethereum in a nutshell
Daniel Chan
 
The Blockchain and JavaScript
The Blockchain and JavaScriptThe Blockchain and JavaScript
The Blockchain and JavaScript
Portia Burton
 
Trading-CryptoCurrency-Advanced-Trading-Strategies.pdf
Trading-CryptoCurrency-Advanced-Trading-Strategies.pdfTrading-CryptoCurrency-Advanced-Trading-Strategies.pdf
Trading-CryptoCurrency-Advanced-Trading-Strategies.pdf
ShreeharshaHegde7
 
Trading-CryptoCurrency-Advanced-Trading-Strategies.pdf
Trading-CryptoCurrency-Advanced-Trading-Strategies.pdfTrading-CryptoCurrency-Advanced-Trading-Strategies.pdf
Trading-CryptoCurrency-Advanced-Trading-Strategies.pdf
Leokas123
 

Similar to Zoltán Balázs - Ethereum Smart Contract Hacking Explained like I’m Five (20)

Kriptovaluták, hashbányászat és okoscicák
Kriptovaluták, hashbányászat és okoscicákKriptovaluták, hashbányászat és okoscicák
Kriptovaluták, hashbányászat és okoscicák
 
BlockChain for the Banker
BlockChain for the BankerBlockChain for the Banker
BlockChain for the Banker
 
Javascript toolset for Ethereum Smart Contract development
Javascript toolset for Ethereum Smart Contract developmentJavascript toolset for Ethereum Smart Contract development
Javascript toolset for Ethereum Smart Contract development
 
The JavaScript toolset for development on Ethereum
The JavaScript toolset for development on EthereumThe JavaScript toolset for development on Ethereum
The JavaScript toolset for development on Ethereum
 
Blockchain for Notaries
Blockchain for NotariesBlockchain for Notaries
Blockchain for Notaries
 
Smart contract honeypots for profit (and fun) - bha
Smart contract honeypots for profit (and fun)  - bhaSmart contract honeypots for profit (and fun)  - bha
Smart contract honeypots for profit (and fun) - bha
 
Blockchain School 2019 - Security of Smart Contracts.pdf
Blockchain School 2019 - Security of Smart Contracts.pdfBlockchain School 2019 - Security of Smart Contracts.pdf
Blockchain School 2019 - Security of Smart Contracts.pdf
 
Blockchain for Developers
Blockchain for DevelopersBlockchain for Developers
Blockchain for Developers
 
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency appDylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
Dylan Butler & Oliver Hager - Building a cross platform cryptocurrency app
 
Cryptocurrency_slide
Cryptocurrency_slideCryptocurrency_slide
Cryptocurrency_slide
 
Blockchain, smart contracts - introduction
Blockchain, smart contracts - introductionBlockchain, smart contracts - introduction
Blockchain, smart contracts - introduction
 
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
Stefano Maestri - Blockchain and smart contracts, what they are and why you s...
 
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereum
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereumDappsmedia smartcontract _write_smartcontracts_on_console_ethereum
Dappsmedia smartcontract _write_smartcontracts_on_console_ethereum
 
All aboard the blockchain!
All aboard the blockchain!All aboard the blockchain!
All aboard the blockchain!
 
Blockchain Tokenization
Blockchain TokenizationBlockchain Tokenization
Blockchain Tokenization
 
Ethereum in a nutshell
Ethereum in a nutshellEthereum in a nutshell
Ethereum in a nutshell
 
The Blockchain and JavaScript
The Blockchain and JavaScriptThe Blockchain and JavaScript
The Blockchain and JavaScript
 
BlockChain Public
BlockChain PublicBlockChain Public
BlockChain Public
 
Trading-CryptoCurrency-Advanced-Trading-Strategies.pdf
Trading-CryptoCurrency-Advanced-Trading-Strategies.pdfTrading-CryptoCurrency-Advanced-Trading-Strategies.pdf
Trading-CryptoCurrency-Advanced-Trading-Strategies.pdf
 
Trading-CryptoCurrency-Advanced-Trading-Strategies.pdf
Trading-CryptoCurrency-Advanced-Trading-Strategies.pdfTrading-CryptoCurrency-Advanced-Trading-Strategies.pdf
Trading-CryptoCurrency-Advanced-Trading-Strategies.pdf
 

More from hacktivity

Zsombor Kovács - Cheaters for Everything from Minesweeper to Mobile Banking ...
Zsombor Kovács - 	Cheaters for Everything from Minesweeper to Mobile Banking ...Zsombor Kovács - 	Cheaters for Everything from Minesweeper to Mobile Banking ...
Zsombor Kovács - Cheaters for Everything from Minesweeper to Mobile Banking ...
hacktivity
 
Vincent Ruijter - ~Securing~ Attacking Kubernetes
Vincent Ruijter - ~Securing~ Attacking KubernetesVincent Ruijter - ~Securing~ Attacking Kubernetes
Vincent Ruijter - ~Securing~ Attacking Kubernetes
hacktivity
 
Balázs Bucsay - XFLTReaT: Building a Tunnel
Balázs Bucsay - XFLTReaT: Building a TunnelBalázs Bucsay - XFLTReaT: Building a Tunnel
Balázs Bucsay - XFLTReaT: Building a Tunnel
hacktivity
 
Mikhail Egorov - Hunting for bugs in Adobe Experience Manager webapps
Mikhail Egorov - Hunting for bugs in Adobe Experience Manager webappsMikhail Egorov - Hunting for bugs in Adobe Experience Manager webapps
Mikhail Egorov - Hunting for bugs in Adobe Experience Manager webapps
hacktivity
 
Rodrigo Branco - How Offensive Security is Defining the Way We Compute // Key...
Rodrigo Branco - How Offensive Security is Defining the Way We Compute // Key...Rodrigo Branco - How Offensive Security is Defining the Way We Compute // Key...
Rodrigo Branco - How Offensive Security is Defining the Way We Compute // Key...
hacktivity
 
Gabrial Cirlig & Stefan Tanase - Smart Car Forensics and Vehicle Weaponization
Gabrial Cirlig & Stefan Tanase - Smart Car Forensics and Vehicle WeaponizationGabrial Cirlig & Stefan Tanase - Smart Car Forensics and Vehicle Weaponization
Gabrial Cirlig & Stefan Tanase - Smart Car Forensics and Vehicle Weaponization
hacktivity
 
Csongor Tamás - Examples of Locality Sensitive Hashing & their Usage for Malw...
Csongor Tamás - Examples of Locality Sensitive Hashing & their Usage for Malw...Csongor Tamás - Examples of Locality Sensitive Hashing & their Usage for Malw...
Csongor Tamás - Examples of Locality Sensitive Hashing & their Usage for Malw...
hacktivity
 
Matthias Deeg - Bypassing an Enterprise-Grade Biometric Face Authentication S...
Matthias Deeg - Bypassing an Enterprise-Grade Biometric Face Authentication S...Matthias Deeg - Bypassing an Enterprise-Grade Biometric Face Authentication S...
Matthias Deeg - Bypassing an Enterprise-Grade Biometric Face Authentication S...
hacktivity
 
Gergely Biczók - Interdependent Privacy & the Psychology of Likes
Gergely Biczók - Interdependent Privacy & the Psychology of LikesGergely Biczók - Interdependent Privacy & the Psychology of Likes
Gergely Biczók - Interdependent Privacy & the Psychology of Likes
hacktivity
 
Paolo Stagno - A Drone Tale: All Your Drones Belong To Us
Paolo Stagno - A Drone Tale: All Your Drones Belong To UsPaolo Stagno - A Drone Tale: All Your Drones Belong To Us
Paolo Stagno - A Drone Tale: All Your Drones Belong To Us
hacktivity
 
Jack S (linkcabin) - Becoming The Quiz Master: Thanks RE.
Jack S (linkcabin) - Becoming The Quiz Master: Thanks RE.Jack S (linkcabin) - Becoming The Quiz Master: Thanks RE.
Jack S (linkcabin) - Becoming The Quiz Master: Thanks RE.
hacktivity
 

More from hacktivity (11)

Zsombor Kovács - Cheaters for Everything from Minesweeper to Mobile Banking ...
Zsombor Kovács - 	Cheaters for Everything from Minesweeper to Mobile Banking ...Zsombor Kovács - 	Cheaters for Everything from Minesweeper to Mobile Banking ...
Zsombor Kovács - Cheaters for Everything from Minesweeper to Mobile Banking ...
 
Vincent Ruijter - ~Securing~ Attacking Kubernetes
Vincent Ruijter - ~Securing~ Attacking KubernetesVincent Ruijter - ~Securing~ Attacking Kubernetes
Vincent Ruijter - ~Securing~ Attacking Kubernetes
 
Balázs Bucsay - XFLTReaT: Building a Tunnel
Balázs Bucsay - XFLTReaT: Building a TunnelBalázs Bucsay - XFLTReaT: Building a Tunnel
Balázs Bucsay - XFLTReaT: Building a Tunnel
 
Mikhail Egorov - Hunting for bugs in Adobe Experience Manager webapps
Mikhail Egorov - Hunting for bugs in Adobe Experience Manager webappsMikhail Egorov - Hunting for bugs in Adobe Experience Manager webapps
Mikhail Egorov - Hunting for bugs in Adobe Experience Manager webapps
 
Rodrigo Branco - How Offensive Security is Defining the Way We Compute // Key...
Rodrigo Branco - How Offensive Security is Defining the Way We Compute // Key...Rodrigo Branco - How Offensive Security is Defining the Way We Compute // Key...
Rodrigo Branco - How Offensive Security is Defining the Way We Compute // Key...
 
Gabrial Cirlig & Stefan Tanase - Smart Car Forensics and Vehicle Weaponization
Gabrial Cirlig & Stefan Tanase - Smart Car Forensics and Vehicle WeaponizationGabrial Cirlig & Stefan Tanase - Smart Car Forensics and Vehicle Weaponization
Gabrial Cirlig & Stefan Tanase - Smart Car Forensics and Vehicle Weaponization
 
Csongor Tamás - Examples of Locality Sensitive Hashing & their Usage for Malw...
Csongor Tamás - Examples of Locality Sensitive Hashing & their Usage for Malw...Csongor Tamás - Examples of Locality Sensitive Hashing & their Usage for Malw...
Csongor Tamás - Examples of Locality Sensitive Hashing & their Usage for Malw...
 
Matthias Deeg - Bypassing an Enterprise-Grade Biometric Face Authentication S...
Matthias Deeg - Bypassing an Enterprise-Grade Biometric Face Authentication S...Matthias Deeg - Bypassing an Enterprise-Grade Biometric Face Authentication S...
Matthias Deeg - Bypassing an Enterprise-Grade Biometric Face Authentication S...
 
Gergely Biczók - Interdependent Privacy & the Psychology of Likes
Gergely Biczók - Interdependent Privacy & the Psychology of LikesGergely Biczók - Interdependent Privacy & the Psychology of Likes
Gergely Biczók - Interdependent Privacy & the Psychology of Likes
 
Paolo Stagno - A Drone Tale: All Your Drones Belong To Us
Paolo Stagno - A Drone Tale: All Your Drones Belong To UsPaolo Stagno - A Drone Tale: All Your Drones Belong To Us
Paolo Stagno - A Drone Tale: All Your Drones Belong To Us
 
Jack S (linkcabin) - Becoming The Quiz Master: Thanks RE.
Jack S (linkcabin) - Becoming The Quiz Master: Thanks RE.Jack S (linkcabin) - Becoming The Quiz Master: Thanks RE.
Jack S (linkcabin) - Becoming The Quiz Master: Thanks RE.
 

Recently uploaded

AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 

Recently uploaded (20)

AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 

Zoltán Balázs - Ethereum Smart Contract Hacking Explained like I’m Five

  • 1. EXPLAIN ETHEREUM SMART CONTRACT HACKING LIKE I AM FIVE Zoltan Balazs 2018 October
  • 2. Whoami? Zombie Browser Toolkit https://github.com/Z6543/ZombieBrowserPack HWFW Bypass tool Similar stuff was used in PacketRedirect in Danderspritz FlewAvenue by EQGRP https://github.com/MRGEffitas/hwfwbypass Malware Analysis Sandbox Tester tool https://github.com/MRGEffitas/Sandbox_tester Played with crappy IoT devices – my RCE exploit code running on ~600 000 IP cameras via Persirai https://jumpespjump.blogspot.hu/2015/09/how-i-hacked-my-ip-camera-and-found.html https://jumpespjump.blogspot.hu/2015/08/how-to-secure-your-home-against.html Invented the idea of encrypted exploit delivery via Diffie-Hellman key exchange, to bypass exploit detection appliances Implemented by Angler and Nuclear exploit kit developers https://www.mrg-effitas.com/generic-bypass-of-next-gen-intrusion-threat-breach-detection-systems/ 2
  • 3. Questions Hands up if you know something about blockchain Hands up if you have ever tried to explain Bitcoin to your parents/colleagues/kids Hands up if it ended: “it is complicated” Hands up if you have ever interacted with a Smart Contract
  • 4. Why am I talking about this? ITSEC folks laugh about Blockchain a lot They believe it is not happening not important not working Bad news: it is happening! Trust me, this is an important topic I will calculate losses in Lamborghinis – 200K USD
  • 5. So who am I to talk about this topic? I don’t give advice on investing/ selling/ HODLing cryptocurrencies
  • 6. Main idea of cryptocurrencies Let’s go with metaphors on this topic Math is hard (at least for me it is true) Let’s form a group where we solve mathematical challenges MINING Everyone can easily check if someone solved the hard math challenge When someone solves a math challenge, they receive moneZ (my imaginary cryptocurrency)
  • 7. Transactions If Bunny wants to send moneZ to Piggie, everyone will know and has to know about all details of the transaction In fact, everyone knows how much moneZ everyone has because it is public knowledge Sidenote: ETHEREUM different
  • 8. Blockchain The last not yet processed moneZ are collected in a transaction together The bundle of transactions is included as additional parts to the math challenge to be solved blocks Including the transactions in the math challenges will cost moneZ for the initiator transaction fee A long paper trail is created where every blocks are recorded blockchain
  • 9. How can newcomers get moneZ - Bitcoin, etc.? They can start to solve new math challenges Before that they should get a copy of the long paper trail - blockchain By solving math challenges and including the transactions, they get the transaction fee Or they can ask someone to send them moneZ In exchange they can give something - real money, Alpaca socks
  • 10. What is a wallet The wallet holds all the moneZ you previously received Whenever you send moneZ from your wallet to someone else's wallet, you sign the transaction with your signature, which is impossible to counterfeit Transactions are irreversible and final* Everyone will know you transferred the money, you can’t draw back
  • 11. Why is this interesting? You don’t have to be in the same room to do the math challenges You can do all the stuff through the Internet You don’t even have to know who the others are (pseudo-anonimity)
  • 12.
  • 13. Smart Contracts Assume you have a basic understanding of cryptocurrencies in general Let’s take a deep dive into Smart Contracts Bitcoin is also capable of doing Smart Contracts Ethereum YAC (Yet Another Cryptocurrency) was designed for Smart Contracts
  • 14. Smart Contracts You want to sign and get a countersign of the contract carve the contract into stone contracts carved into the stone cannot be modified In the smart contract world, the stone is the blockchain it is powered by the time and energy spent on solved math challenges Code is universal
  • 15. What is gas? Smart contract is code which can be executed by anyone who solves the math challenges for moneZ - mines the cryptocurrencies Similarly to moneZ transaction fees, you have to pay moneZ to get the smart contract code executed by everyone The more complex the smart contract code is, the more moneZ you have to pay This is called gas in Ethereum
  • 16. Are we there yet?
  • 17. Ethereum Virtual Machine Bytecode: it is not a machine code, thus you need a VM to execute it Solidity: compile JavaScript-like code into EVM bytecode Source code can be published - creates trust Solidity source code compiles into the same bytecode (reproducible) At least with the same parameters and same compiler version
  • 18. JavaScript developers today Solidity (smart contract language) looks similar to JavaScript You need web3.js based frontend - this is JS Many smart contract coders have JavaScript background JavaScript: You must move fast and break things With Ethereum Smart Contracts, this approach is not “profitable” … Solidity: Deploy once, be hacked anytime
  • 19.
  • 20.
  • 21. Since August 2018 the latest Metamask has been showing the hex data to be sent Kittie ID in hex Identifier for the Bid function (MethodID) – keccak256(“bid(uint256)”)[:4] 59 zeroes because the world needs 2ˆ256 Kitties
  • 22. Code can be hacked Smart contracts are code
  • 23.
  • 24.
  • 25.
  • 26. The DAO: Recursive call + race condition June 18th, 2016 Attacker transfers Ether worth $250 million from DAO That is 1250 Lamborghinis Reentrancy at the splitDAO function
  • 27. The DAO hack You can interrupt the bank teller while he is giving you money The bank teller only updates your balance at the end
  • 28. The DAO hack … // INSECURE --- this is not DAO code, but similar so it is easy to understand function withdrawBalance() public { // 1st line uint amountToWithdraw = userBalances[msg.sender]; // 2nd line require(msg.sender.call.value(amountToWithdraw)()); // 3rd line. At this point, the caller's code is executed, and can call withdrawBalance again userBalances[msg.sender] = 0; // 4th line }
  • 29.
  • 30. The solution? Rewrite the past and pretend it didn’t happen Attacker got away with his ETH Classic worth $67.4 million – 337 Lambos
  • 31.
  • 32. Multi-signature wallets “Captain planet, the world’s first multi-factor authentication” © dnet
  • 33. Shared vulnerable library + reinit - 2017 July 20 $31M stolen – 155 Lambos A lot more was in danger, but good guys were faster Lot of shared libraries exists in the blockchain Save gas Contracts now share the same vulnerabilities Parity multi-signature wallets
  • 34. Teh code NON LIBRARY CODE function() payable { // someone called a function we don’t have? if (msg.value > 0) // some ether is sent ... else if (msg.data.length > 0) //ether is not sent, but some data is _walletLibrary.delegatecall(msg.data); //let’s check if we can execute this code via shared library } ● If the method name is not defined on this contract… ● And there’s no ether being sent in the transaction… ● And there is some data in the message payload… for whatever method that calls DELEGATECALL, it will call the same method on the contract you're delegating to, but using the context of the current contract
  • 35. Teh library codez function initWallet(address[] _owners, uint _required, uint _daylimit) { //the shared library has initWallet and it is public ! initDaylimit(_daylimit); initMultiowned(_owners, _required); } initWallet is not in the non-library code, but is called in the shared library
  • 36. So some random guys don’t know how to code Smart Contracts …
  • 37. Fixing the Parity bug Parity fixed previous bug and introduced a new one Library contract was not initialized properly. That allowed anyone to turn the library contract into a multi-sig wallet
  • 38. The next Parity hack November 2017 - $300M lost – 1500 Lambos @devops199 “accidentally” called initWallet() method to own the library @devops199 “accidentally” called kill() method to self-destruct it It was planned to be fixed – forking EIP-999. Community voted no
  • 39. Intro to integer underflow Underflow If there are (unsigned integer 8) 3 people on the bus, and four of them took of the bus, how many people are still on the bus? 255
  • 40. Intro to integer overflow Overflow If there are (unsigned integer 8) 255 people on the bus, and the bus is totally full, and one guy hops on the bus, how many people are on the bus?
  • 41. Proof of Weak Hands https://medium.com/@optimumregret/the-surreal-madness- of-ethereums-pyramid-schemes-da705fe7d92e USD 2M lost unsigned integer underflow withdrawal Use Safemath! https://etherscan.io/tx/0x233107922bed72a4ea7c75a83ecf58dae4 b744384e2b3feacd28903a17b864e0
  • 42. Conclusion Blockchain, Ethereum, Smart Contracts are here to hack Writing secure Smart Contracts is hard Ethereum is still in beta Hacking Smart Contracts is possible, fun, but probably illegal Hacking your own smart contract is probably not illegal Hacking in test blockchain is not illegal
  • 43. Where to learn to code? cryptozombies.io
  • 44. Where to learn to hack?
  • 45. References Nick Szabo: The idea of smart contracts 1997 https://perma.cc/V6AZ-7V8W https://www.reddit.com/r/explainlikeimfive/comments/12knie/eli5_bitcoins/?st=IZW0ENOG&sh=d566a3ee https://medium.freecodecamp.org/smart-contracts-for-dummies-a1ba1e0b9575 https://www.reddit.com/r/explainlikeimfive/comments/4lz9t4/eli5_ethereum/ http://hackingdistributed.com/2016/06/18/analysis-of-the-dao-exploit/ https://github.com/b-mueller/smashing-smart-contracts/blob/master/smashing-smart-contracts-1of1.pdf https://medium.freecodecamp.org/a-hacker-stole-31m-of-ether-how-it-happened-and-what-it-means-for-ethereum- 9e5dc29e33ce https://www.stateofthedapps.com/ Cryptozombies.io - best tutorial Latest hype and scams: https://boards.4chan.org/biz/
  • 46. 48 Hack the planet! zoltan.balazs@mrg-effitas.com https://hu.linkedin.com/in/zbalazs Twitter – @zh4ck www.slideshare.net/bz98 HACKERSULI !!!1! Greetz to @VitalikButerin, Satoshi Nakamoto https://JumpESPJump.blogspot.com

Editor's Notes

  1. TODO bevezeto
  2. Who thinks Smart Contracts are the future?
  3. We are going to … TODO nyelvtan
  4. TODO image
  5. Megvagni a videot
  6. It’s like the bank teller won’t change your balance until he gives you all the money you have requested. “Can I withdraw $500? Wait, before that, can I withdraw $500?” The smart contract was designed only to check you have $500 at the beginning, once, and allow themselves to be interrupted.
  7. 5 people would summon Captain Planet who would save the world