Are Hackers Deflating DeFi?

Hackers and Defi, cryptocurrency scams
Share on twitter
Share on email
Share on facebook
Share on linkedin
Share on telegram
Share on whatsapp

The first half of 2021 is nearly complete. The year started with hopes of moving past a global pandemic and for many hopes of financial freedom achieved through cryptocurrencies, tokens, and DeFi (Decentralized Finance) investments. With this excitement, there has been both a huge increase in new tokens created as well as a dramatic increase in DeFi vulnerabilities exposed. 

Coins and tokens, what’s the difference? Simply put a coin is a cryptocurrency that has its own native blockchain. On the other hand, a token is a smart contract that lives on top of a blockchain such as Ethereum or commonly referred to as ETH. Creating a token can be as simple as copying and pasting another token’s code. Most people that create a coin end up altering the code to make it suit what they are trying to do with their token. These changes, however small, can often lead to vulnerabilities in the code. 

So far this year, hackers have been attacking the space to the tune of $370 million on Binance Smart Chain. Most notably, PancakeBunny was wiped out of over $200 million in assets on May 19th. The value of the token pumped from about $150 – $240 before it dropped to almost $0 in about 30 minutes. It then climbed and settled at around $8 before recovering to its current value of about $23. 

This is just one example of about eight Binance Smart Chain tokens that have been attacked recently. Others include Uranium which was hit for about $50 million in tokens, Belt finance at about $7 million, and multiple others including Spartan Protocol and Meerkat each for over $30 million. 

I know what you are thinking, blockchain is supposed to be secure! Well, it generally is. The majority of these attacks on DeFi have been done using a flash loan attack or exploiting an error in the smart contract coding.

Flash loans were initially introduced as a way to leverage DeFi loans. This tactic was made popular by Aave. The basic strategy was taking a loan with no collateral, flipping  the borrowed asset on another exchange for profit and then repaying the loan and 0.09% fee all in one transaction. 

Think of the old story of the boy who started with a paperclip and traded his way up to a house, achieving all of this with one transaction. 

Flash loans have two main ways of being executed. The first one I will talk about is known as “Arbitrage”. Arbitrage is where the same coin or token has a different price on different exchanges.   

Exchange A lists Pickle Token for  $100 and Exchange B lists it for $200. You borrow $100 in BNB (the cryptocurrency coin that fuels the Binance Network) from the DeFi as a flash loan. Then in that same transaction you take the BNB to Exchange A and buy the Pickle Token for $100. Next, you take the Pickle Token to Exchange B and sell it for $200 in BNB. You return the $100 BNB to pay off your loan all in one transaction.  

Another option is to Collateral Swap or purchase tokens and swap them with other tokens. For instance, I borrow 1000 ETH from Exchange A. I take that ETH to Exchange B and sell it for BNB. Dumping a large amount of ETH on the exchange will lower the price of ETH.  I then take those BNB to Exchange C and buy Pickle. I then move the Pickle back to Exchange B and buy ETH. 

The final step is to go back to Exchange A with the ETH I purchased and repay my loan keeping any extra ETH I purchase at a lower price as profit. 

Now Flash loans in and of themselves are not an actual “hack” as they are a feature of many DeFi platforms. The “hack” occurs when there is an error in the original smart contract code.

This brings us back to the beginning of the article and just how easy it is to create these new tokens and DeFi apps or dApps. Often the code is a copy-paste with minimal changes made to it. However, those small changes can lead to security issues.

You can see evidence of this in the Uranium V2 hack. The below image is a snippet of the smart contract. The red box shows where the copied code was changed from 1000 to 10000. However, they failed to change the last instance of 1000 in the green box. This error in the code essentially allowed the attackers to swap 1 token for almost all of the tokens in the liquidity pool netting them a $50 million haul. 

DeFi and new tokens will continue to be created at a rapid pace. Security of these smart contracts are key to the longevity and safety of those who are invested in liquidity pools. 

Fortunately, there are a few things you can do to minimize the risk associated with your investments. First and foremost be careful and research the tokens you are interested in. Do your research on the team behind the token. Ask questions like: Are they public facing?  Are those who control the admin keys transparent or have they given up access? Has the token been through a security audit by one of the reputable security audit firms? 

Certik is one of many companies that specializes in auditing and monitoring various crypto projects. 

I know it is tempting to get into a token early to get the best possible returns. But with that entry, you put your investment at risk. So do so with caution and never invest more than you are willing to lose. 

It’s a very interesting time to be in the crypto-verse. There is always something new and always something going on. It can be overwhelming, but it can also be very exhilarating. Enjoy your investments, the communities, and the gains. But most of all protect yourself and your bags. 

Steven Trapp
Steven Trapp

Steven Trapp is a writer, content creator, and blockchain tech nerd. Steve has made it his business to know the IT around blockchain technologies and strives to share that knowledge so everyone can understand the expanding world of crypto. Find him on Discord or Twitter Spaces talking about anything crypto-related. His focus includes cybersecurity, technology, and outreach to the Japanese crypto-community.

Recent

Newsletter

address

Services

Bitcoin (BTC) 39,839.00 8.12%
Ethereum (ETH) 2,289.71 5.13%
Tether (USDT) 0.998568 1.01%
Binance Coin (BNB) 312.22 3.33%
Cardano (ADA) 1.27 3.66%
XRP (XRP) 0.641782 3.34%
USD Coin (USDC) 0.999913 0.09%
Dogecoin (DOGE) 0.205501 2.50%
Polkadot (DOT) 14.23 3.97%
Binance USD (BUSD) 0.996117 0.56%
Uniswap (UNI) 18.83 4.16%
Bitcoin Cash (BCH) 498.94 5.23%
Litecoin (LTC) 135.48 4.96%
Chainlink (LINK) 19.57 8.35%
Solana (SOL) 27.99 1.41%
Wrapped Bitcoin (WBTC) 39,628.00 7.57%
Polygon (MATIC) 1.03 7.25%
Ethereum Classic (ETC) 48.84 3.45%
Stellar (XLM) 0.261108 2.40%
Theta Network (THETA) 5.93 9.18%
Internet Computer (ICP) 42.63 10.31%
VeChain (VET) 0.083263 8.77%
Dai (DAI) 1.00 0.06%
OKB (OKB) 19.05 19.55%
cUSDC (CUSDC) 0.022108 0.17%
Filecoin (FIL) 49.68 3.31%
cDAI (CDAI) 0.021575 0.12%
TRON (TRX) 0.060537 4.29%
Monero (XMR) 226.76 4.49%
Terra (LUNA) 9.35 12.79%
Aave (AAVE) 302.54 2.75%
EOS (EOS) 3.77 3.52%
cETH (CETH) 45.94 5.08%
FTX Token (FTT) 31.31 7.11%
Amp (AMP) 0.068779 6.89%
Cosmos (ATOM) 11.56 3.16%
Crypto.com Coin (CRO) 0.124309 6.39%
Shiba Inu (SHIB) 0.000006 1.74%
PancakeSwap (CAKE) 14.72 4.53%
LEO Token (LEO) 2.87 0.60%
Algorand (ALGO) 0.842465 0.66%
The Graph (GRT) 0.561319 4.23%
Axie Infinity (AXS) 48.04 24.88%
Celsius Network (CEL) 6.01 3.97%
Bitcoin SV (BSV) 133.70 3.39%
Klaytn (KLAY) 1.01 3.34%
Maker (MKR) 2,666.36 4.96%
NEO (NEO) 33.84 5.98%
Tezos (XTZ) 2.83 1.57%
IOTA (MIOTA) 0.846499 14.38%
Sign-Up For Our Newsletter For The Latest Updates