code-423n4 / 2021-06-pooltogether-findings

0 stars 0 forks source link

User could lose underlying tokens when redeeming from the `IdleYieldSource` #120

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

shw

Vulnerability details

Impact

The redeemToken function in IdleYieldSource uses redeemedShare instead of redeemAmount as the input parameter when calling redeemIdleToken of the Idle yield source. As a result, users could get fewer underlying tokens than they should.

Proof of Concept

When burning users' shares, it is correct to use redeemedShare (line 130). However, when redeeming underlying tokens from Idle Finance, redeemAmount should be used instead of redeemedShare (line 131). Usually, the tokenPriceWithFee() is greater than ONE_IDLE_TOKEN, and thus redeemedShare is less than redeemAmount, causing users to get fewer underlying tokens than expected.

Referenced code: IdleYieldSource.sol#L129-L131

Recommended Mitigation Steps

Change redeemedShare to redeemAmount at line 131.

PierrickGT commented 3 years ago

PR: https://github.com/pooltogether/idle-yield-source/pull/4