Blockchain Insights

๐Ÿšจ How a Single Wei Broke ResupplyFi: Inside the $9.6M DeFi Price Manipulation Heist

UppSecEcho
UppSecEcho

July 01, 2025

On June 26, 2025, ResupplyFiโ€”a decentralized stablecoin and lending protocolโ€”became the latest victim in a string of DeFi price manipulation attacks, losing an estimated $9.6 million from its wstUSR lending market.

But this wasnโ€™t a typical exploit. This was a surgical, precision-driven manipulation that started with just 1 wei and ended in millions.

Hereโ€™s how it happened, why it worked, and what this means for the future of DeFi.


๐Ÿงจ The Attack at a Glance

โ€ข Target: ResupplyFiโ€™s wstUSR market

โ€ข Method: Oracle manipulation via ERC-4626 vault logic bug

โ€ข Funds lost: ~$9.6 million in reUSD

โ€ข Exploited function: _updateExchangeRate() in ResupplyPair contract

โ€ข Timeline: Single transaction drain within minutes


๐Ÿ› ๏ธ How the Exploit Worked

At the heart of the attack was a poorly designed exchange rate oracle within ResupplyFiโ€™s vault contract. Specifically, the exchangeRate was derived using a value called pricePerShare, common in ERC 4626 vaults.

But hereโ€™s the catch:

โžค The attacker deposited 1 wei into an almost empty vault.

This gave them control over how the vault's pricePerShare would respond to subsequent โ€œdonations.โ€

โžค Then, they made a large โ€œdonationโ€ to the vault.

This artificially inflated the share price, skewing the oracle rate. Because of a logic flaw, the protocol calculated the exchangeRate as 0, tricking the system into thinking the collateral was worthless.

โžค Result:

The attacker borrowed $10 million worth of reUSD against 0 value collateral.


โš ๏ธ What Went Wrong?

โ€ข Broken Oracle Assumptions: The system trusted pricePerShare as a real-world oracle without validation.

โ€ข No Lower Bound Check: Allowing exchangeRate to drop to zero effectively bypassed the collateralization check.

โ€ข Missing Guardrails: There were no sanity limits on extreme values coming from vault math.


๐Ÿ’ธ The Drain & Laundering

The attacker didnโ€™t stick around.

They quickly converted stolen reUSD into ETH

Funds are now sitting at

  1. 0x886f786618623fffb2be59830a47661ae6492e16
  2. 0x31129a5c13306a48e827e851d44e19ca07d4928a


๐Ÿง  Lessons for the DeFi World

This hack joins a growing list of oracle manipulation exploits where DeFi protocols underestimate how easily โ€œtrustedโ€ math can be gamed in low-liquidity or edge-case scenarios.

โœ… Key takeaways for builders:

โ€ข Never trust raw vault math without bounds.

โ€ข Validate pricePerShare with a circuit breaker or floor value.

โ€ข Use multiple oracles for redundancy.

โ€ข Simulate edge cases with small deposits in testing environments.


๐Ÿ—ฃ๏ธ Final Thoughts

The ResupplyFi exploit is another reminder that a single wei, when paired with flawed logic, can dismantle an entire system.

As DeFi continues to innovate, we must slow down and ensure that core primitives like oracles, vaults, and pricing logic are built with security-first principles.

If not, there will always be someone waiting to turn one wei into one more heist.



post_like_sub1
post_total_comment_sub0

14 ์กฐํšŒ

0/500 bytes