code-423n4 / 2023-09-ondo-findings

7 stars 5 forks source link

In case of accrual of additional income for holding rUSDY tokens, the protocol is subject to a flashloan attack #479

Closed c4-submissions closed 1 year ago

c4-submissions commented 1 year ago

Lines of code

https://github.com/code-423n4/2023-09-ondo/blob/main/contracts/usdy/rUSDY.sol#L449-L456 https://github.com/code-423n4/2023-09-ondo/blob/main/contracts/usdy/rUSDY.sol#L434-L440

Vulnerability details

Impact

rUSDY is the rebasing variant of USDY token, and is heavily based on other rebasing tokens such as stETH. Users are able to acquire rUSDY tokens by calling the wrap(uint256) function on the contract. Where as the price of a single USDY token varies over time, the price of a single rUSDY token is fixed at a price of 1 Dollar.

The description of the competition on the code4rena website says: "Where as the price of a single USDY token varies over time, the price of a single rUSDY token is fixed at a price of 1 Dollar, with yield being accrued in the form of additional rUSDY tokens."

At the same time, there is no time in the contract for which rUSDY tokens are held. If additional income is credited to the user's rUSDY balance, the contract is subject to a flashloan attack.

Proof of Concept

  1. The service intends to accrue additional income based on the user's balance.
  2. The user calculates a transaction through the mempool to accrue additional income and takes a flashloan, ahead of the service transaction.
  3. The service calculates more tokens per user address.
  4. User returns flashloan.

Tools Used

Manual review

Recommended Mitigation Steps

Enter a minimum wrap() time for tokens or accrue additional income based on the holding time

Assessed type

Context

raymondfam commented 1 year ago

Insufficient proof. Additionally, wrapping USDY to get rUSDY is simply resorting to a different form of token unit.

c4-pre-sort commented 1 year ago

raymondfam marked the issue as low quality report

c4-pre-sort commented 1 year ago

raymondfam marked the issue as primary issue

c4-judge commented 1 year ago

kirk-baird marked the issue as unsatisfactory: Invalid