First user of autocompounding vaults (AutoPxGlp and AutoPxGmx) can cause loss of funds for later users #151
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-275
satisfactory
satisfies C4 submission criteria; eligible for awards
Lines of code
https://github.com/code-423n4/2022-11-redactedcartel/blob/03b71a8d395c02324cb9fdaf92401357da5b19d1/src/vaults/PirexERC4626.sol#L60-L78
Vulnerability details
Impact
First user of the vaults can cause loss of funds for subsequent users by throwing off the share ratios. This is due to a rounding error which has to be accounted for in erc4626 vault contracts. Consider the following scenario:
Proof of Concept
Tools Used
Foundry
Recommended Mitigation Steps
This can be mitigated in 2 ways:
Or,
The text was updated successfully, but these errors were encountered: