Another Day, Another Reentrancy Attack

On March 16, 2022, the SlowMist Intelligent Zone received a notification regarding a vulnerability in the Hundred Finance protocol that cost over 2363 ETH. We immediately looked into the incident and will now be sharing our findings.

Relevant information

Hundred Fiance is a decentralized lending and borrowing protocol across various blockchains.

Address involved

Attacker contract:
Attacker address:
Attack Transaction:

Attacker contract:

Attacked contract: husdc hwbtc heth hxdai

Cause of incident

The borrowFresh function within the Hundred Finance contract checks the funds after they’ve been transferred. Since USDC, wBTC, and wETH use the ERC677 token protocol, it means they are compatible with the ERC20 protocol. Once the funds have been transferred, the ERC677 protocol can call the onTokenTransfer function in the target contract, allowing the hacker to perform reentrancy attacks using a malicious contract.

Detailed Analysis

1.The hacker borrowed millions via flash-loans to be used collateral. Details below.

2.Using malicious contracts, the hacker deposited millions in USDC as collateral and exchanged it for 59,999,789.075 (hUDSC).

Since the loan contract records the funds after the transfer, the hacker is able to start their attack simultaneously with the transfer.

On the XDai chain, USDC, WBTC, and WETH contain post-transfer callback procedures. This allows malicious contracts to re-enter the WBTC loan contract after USDC has been transferred. Since there’s no record of borrowing USDC yet, the contract borrowed 16.17030715 in WBTC , re-entered the WETH loan contract and borrow additional 24.715930916595319168 WETH.

3.The contract then transferred 1,964,607 USDC to the USDC loan contract as collateral for 98,230,019.558 in hUSDC. Next, it borrowed 1,748,500.495 USDC from the pool, and re-entered it into the xDai loan contract.

The xDai was then transferred and exchanged for 234,304,737.048 in hxDAI. The malicious contract continued to borrow xDai and 4,128,044.631 USDC from the USDC loan contract. The attacker then transferred 1,358,759.278 USDC to the USDC loan contract again, and obtained 67,937,725.081 in hUSDC this time. They repeated this step again and borrowed 1,209,295.758 USDC from the USDC loan contract.

4.Finally, the contract returned all the borrowed funds from the flashloan to SushiSwap, and then transferred the remaining funds to the hackers address.


According to our MistTrack analysis, the initial funds were transferred in from Tornado.Cash. Once the stolen funds were deposited into their account, it was converted to ETH and bridge to the Ethereum network.

In total, more than 2,363 ETH was converted from the stolen funds. It was then deposited into Tornado.Cash in 32 separate transactions to avoid tracking.


This attack was caused by the borrowFresh function in the loan contract. It does not verify token transfers before the funds are transferred. This allows malicious contracts to re-enter other loan contracts after the transfer.

The SlowMist security team recommends that when using non-ERC20 token contracts, projects should pay more attention to see if they’re compatible. Contract amounts should be recorded before token transfers, and the Checks-Effects-Interactions rules should be followed to avoid issues like this in the future.




Focuses on Blockchain Ecosystem Security, have served over 1k+ customers.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

An overview of OAuth 2.0

IoT Inspector Featured on Science Friday

You will never be a victim of fraud if account holders adopt the RBI’s policies

ElectrumSV 1.3.10

Vigor for Dummies — Second Edition: The Vigor DAC (Decentralized Autonomous Community)

The “Doxxing” of Q, for the Non-Techie

‘dig’ results for and

What is the Data Privacy Protocol Alliance?

Try UnUniFi Protocol Testnet with Telescope, a Block Explorer and Wallet

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Focuses on Blockchain Ecosystem Security, have served over 1k+ customers.

More from Medium

Intro to Smart Contract Security Audits| Accessing Private Data

Detailed explanation of Ethereum smart contract vulnerabilities  — — On-chain vulnerability…

Damn Vulnerable DeFi Challenge #5 Solution — Side entrance

SWC-100 | Function Default Visibility