Re-entry Attack

     Within the contect of cryptocurrency and blockchain technology, a “re-entry attack” or “re-entrance attack”, is a cyber attack on a smart contract that is deployed to a Turing complete blockchain. The attack is based on poorly written contract code that leave a “back-door” vulnerability.

     Due to the immutable and permanent nature of blockchain, whenever a smart contract is deployed it cannot be altered. The stakes of writing secure, accurate code is extremely high (especially when pertaining to finances). If the code in a smart contract is written poorly then a malicious actor may be able to execute the code pre-maturely. By executing code pre-maturely, a hacker can run a small portion of the code and immediately run another instance on top of the partially running code. They can re-enter the smart contract as it is being executed.

     The most famous example from the industry is the DAO hack that happened on the Ethereum blockchain, which ended up splitting the chain and funneling funds from Ethereum to Ethereum Classic. What happened was, as the hacker 

1) The hacker ran the “splitDAO” function of the contract;

2) Let it executeuntill the  “withdrawRewardFor(msg.sender)” function. (which let the hacker withdraw the specified amount of ETH from the DAO)

3) However, the program is re-run before it can reach the line of code called “balances[msg.sender] = 0” which would set the hacker’s balance in the smart contract to 0.

In even simpler terms, the attacker was able to “reenter” the contract before it could finish thus allowing him to drain money from the contract by recursively calling the function.

 

      Resources

Donate

BTC: bc1qcskmel9llhrdqj3arxyqnennx4ashvfutlreyy
LTC: ltc1qa0fj4lcu5365rep50aza5fqqvx8ef0afemh6s5
ETH: 0x071D72dbc48ad2Fe35daE256eCF0834C5dde688c
DASH: XgXHqVyJiQNdVVszH9cnqCP4uWcP8tVxdK
BNB: bnb1mau4j8kry0jgw45ufy69hvhd0k04llet8fk2p6

Welcome To The Crypfo Initiative!

There was an error while trying to send your request. Please try again.

Crypfo.info will use the information you provide on this form to be in touch with you and to provide updates and marketing.
Join the Leaders of the Digital Economy.
Gain Access to Specialized Crypto Asset Insight before anyone else.