Manipulation of LPToken of the pool when the total supply is zero can lead to the implicit minimum deposit amount and loss of user funds due to rounding errors. #10
Replies: 4 comments 1 reply
-
Attaching forked POC as mentioned for the cpMAN-USDT pool, please enter your API Key
|
Beta Was this translation helpful? Give feedback.
-
Hey, @vatsal095. Thank you for the time and effort you have put into this issue. Our engineering team is aware of this issue and is in the process of QA and delivering the solution soon. If you are interested in contributing to Clearpool, we are always looking for great talent. Feel free to submit your application in our jobs form. Cheers, |
Beta Was this translation helpful? Give feedback.
-
Hey, thanks for offering the job application form, will definitely consider it. But for now, It is apparent that the code is vulnerable to the mentioned vulnerability, and the other solution to eliminate the vulnerability is by voluntarily burning a few shares in order to ensure that totalSupply never goes to zero. which does not take effort or decisions to do so. I think considering the above, it does not seem that you guys are aware of this. Also, you should immediately burn a few shares in order to mitigate this before it's too late. |
Beta Was this translation helpful? Give feedback.
-
okay, I understand that your team is already aware of this problem, also, I have submitted my application |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Adding a docs link
Bug Report
Where: LPTokenWhen:LPToken.totalSupply == 0
Main Affected contracts:
Ethereum
cpMAN-USDT cpAUR-USDC cpPOR-USDC
cpALP-USDC cpFASA-USDC cpFAS-USDT
Polygon
cpFASA-USDC cpPOR-USDT
Fund At risk:
This amount will be infinity, all upcoming pool funds will at risk
Below pools total funds were at risk when they deploy.
Ethereum
cpMAN-USDT => 50K cpMAN
cpAUR-USDC => 9.2M cpAUR
cpPOR-USDC => 200K cpPOR
cpALP-USDC => 590K cpALP
cpFASA-USDC => 470K cpFASA
cpFAS-USDT =>200K cpFAS
Polygon
cpFASA-USDC
cpPOR-USDT
So in polygon right now only two pools and all were added recently, so be careful about adding new pool
Description
This attack has two implications
This leads to an implicit minimum amount for a user at the attacker's discretion.
Main Reason:
Maths:
here BalanceOF(address(this)) == X + 1Wei
now mint token will be :
amount/ token.balanceOf(self)
= Y/(X+1wei) (here denominator is greater than numerator )
= 0.something
= 0 (solidity round off math)
Recommendations:
Beta Was this translation helpful? Give feedback.
All reactions