Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IdleYieldSource doesn't use mantissa calculations #103

Open
code423n4 opened this issue Jun 23, 2021 · 1 comment
Open

IdleYieldSource doesn't use mantissa calculations #103

code423n4 opened this issue Jun 23, 2021 · 1 comment
Assignees
Labels

Comments

@code423n4
Copy link
Contributor

Handle

tensors

Vulnerability details

Impact

Because mantissa calculations are not used in this case to account for decimals, the arithmetic
can zero out the number of shares or tokens that should be given.

For example, say I deposit 1 token, expecting 1 share in return.
On L95, if the totalunderlying assets is increased to be larger than the number of total shares, then the division would output 0 and I wouldn't get any shares.

Proof of Concept

https://github.com/sunnyRK/IdleYieldSource-PoolTogether/blob/6dcc419e881a4f0f205c07c58f4db87520b6046d/contracts/IdleYieldSource.sol#L95

https://github.com/sunnyRK/IdleYieldSource-PoolTogether/blob/6dcc419e881a4f0f205c07c58f4db87520b6046d/contracts/IdleYieldSource.sol#L106

Recommended Mitigation Steps

Implement mantissa calculations like in the contract for the AAVE yield.

@PierrickGT
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants