Deep Dive Deep Dive into High-Profile Crypto Exploits — Part III: Fei Protocol

2 min readApr 30, 2022

On April 30rd, 2022 80M$ was drained from Rari Protocol. The attack was performed 5 times in the span of 15 minutes.

TLDR; The root cause of this attack stems from a Reentrancy security loophole where the attacker could borrow ETH without a collateral.


  • FEI protocol -Fei is a decentralized, scalable, and DeFi-native stablecoin protocol
  • Rari Fuse Pool Lending, borrowing & yield for Fuse protocol.

The Attack — A High-level overview

The function doTransferOut is called when borrowing ETH from the cEther contract. The function uses which does not limit the gas of the called function.

This can lead to re-entrancy attack because if the receiver is a contract, it can execute arbitrary code when receiving this ETH.

A second mistake in the borrow function was that side effects were only updated after the ETH was transferred, which is the second requirement for a successful re-entrancy attack.

The Attack — Step By Step

  1. Flash loan asset

2. Deposit flash loaned asset to rari as collateral.

3. Borrow ETH (debt is not updated yet)

4. leverage reentrancy and call exitMarket() which return the collateral, since debt side-effects are not yet stored.

5. Repay flash loan

6. Attacker get borrowed eth for free.

7. The attacker repeated these steps multiple times until he drained more than 20,000 ETH, worth around 80M$ at the time of this writing.

Relevant Links

Attacker address: 0x6162759edad730152f0df8115c698a42e666157f

Attacker contracts :

Exploit transactions:

All relevant transactions can be found here:


  1. Always use check-effect-interacts pattern…

2. Restrict gas limit when sending ETH.

3. Do not use underling assets that can cause reentrancy attacks (For compound based projects).

About Solid Group

Solid Group is a blockchain consulting and auditing service provider founded by cybersecurity experts with a great passion for the cryptocurrency world. We are known for our exceptional out of the box thinking, experience, and our credibility among the community. Throughout our work, our team was able to discover many high severity issues & vulnerabilities. We work with leading companies in the field, helping them increase their resilience through tailored services and solutions.

‌Solid Group provides ALL IN ONE ICO SOLUTION -

  • audited token generator ( Generate your own token with NO CODING KNOWLEDGE)
  • sniper bot protection tool
  • Smart contract auditing service

🌍 | 🐦 Twitter | 📣 Telegram Group | ✉️




We are a group 3 software developers with combined experience of over 15years in various fields such as Software design, Operating systems, and solidity.