Breaking Chain

3 Hacks an Audit Could Not Find

After hacking dozens of crypto projects as whitehats we understand that a smart contract audit is not enough to guarantee you a project is secured. let us show you some examples of hacks that a classic audit could not have found.

The BadgerDAO Hack

BadgerDAO is a DAO focused on bringing Bitcoin to the web3 world of decentralized finance (DeFi), built on Ethereum smart contracts. On December 2nd, 2021, over $120M worth of cryptocurrency was stolen in a matter of minutes. How is it possible?

During November, the hackers were able to obtain access to the Badger app’s website by using a compromised API key that was created without the knowledge or authorization of Badger engineers to periodically inject a malicious javascript code that affected a subset of its customers. This code generated rogue transaction approvals, which, if approved by users, would allow the hackers to pull funds to their own wallets instead of those controlled by BadgerDAO at a future date. They have waited quietly for a big fish to fall into the trap. 

On December 1st, 2021, a user with $50M worth of an ERC20 token, approved the attacker’s access to their funds. The attackers quickly responded by withdrawing all of this victim’s funds worth $50M, and then followed by draining the accessible accounts of all other victims accumulated over the span of the attacker’s operation, for an overall $120M gain.

So the hack relied on a crypto wallet visual design issue to make users approve the malicious transaction. But long before that, the hack may have taken place because of the use of a compromised API key even though the smart contract was probably perfect.

The Fortress Protocol Hack

Fortress Protocol is a DeFi lending protocol that operates on the Binance Smart Chain. On the morning of May 9th, it had its fund stolen due to a malicious attack.

Weak fortifications surrounding the project’s oracle and governance process allowed the invading hackers to pass a malicious proposal and manipulate the price of collateral. They started by buying 400 000 FTS (the Fortress Protocol’s governance token), 4% of the total supply for 11,4 ETH. Then, they created a malicious proposal contract and used their FTS to vote for their proposal (4% of positive votes is a condition to make the proposal pass successfully). The contract modified the leverage rate of FTS tokens from 0 to 0.7. This allows the hackers to use 70% of the value of leveraged FTS tokens to lend assets in the protocol.

On Fortress Protocol, the price of each token is acquired through different oracles. Oracles are entities that connect blockchains to external systems, thereby enabling smart contracts to execute based upon inputs and outputs from the real world. Among those is FTS, where the price is obtained from the Umbrella Oracle. Unfortunately, there was a vulnerability in the submit() function of the oracle and the hackers were able to manipulate the oracle machine to set a very high price for FTS so he could lend all tokens. All these tokens were converted to around 3 million USDT.

Fortress Protocol was audited by both Hash0x and EtherAuthority neither of which picked up any oracle vulnerability in the code. The reason is simple, it was out of scope for them because the vulnerability was in another protocol’s contract.

The Blizz Finance & Venus Protocol Hacks

Talking about oracles vulnerabilities, here we have a huge one that has cost a lot to two lending platforms: Blizz Finance and Venus Protocol.

As the whole Terra ecosystem was collapsing, the failed UST recovery plan crashed the price of LUNA to fractions of a cent. However, Chainlink, a reputable oracle that was used as a price feed by both protocols to value collateral, contained a minimum price for LUNA hardcoded at $0.10. As the price dropped below this, anyone was able to buy up large quantities of LUNA at market price and use it as collateral (valued at $0.10) to borrow funds from the platforms.

The damages are huge: $8,5M for Blizz Finance (all protocol’s funds) and $13.5M for Venus Protocol (on $1B).

This is a good example that no protocol is infallible even the most important ones. LUNA dropping below $0.10 may have been unthinkable at the time when Chainlink set up the feed but they should have updated their oracle’s parameters as it became clear that LUNA was not going to recover. Protocols should have measures in place for these unforeseen events, such as their own automated circuit-breakers to pause contracts under such conditions.