unsafe cast can lead to theft #224
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate
This issue or pull request already exists
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2022-02-concur/blob/main/contracts/ConvexStakingWrapper.sol#L261
https://github.com/code-423n4/2022-02-concur/blob/main/contracts/ConvexStakingWrapper.sol#L235
Vulnerability details
in the first link I provided, a hacker can call withdraw with amount =
2**196
, the amount of shares that will be burned isuint192(2**192) == 0
.if the system has enough money, the hacker can steal
2**192
tokens and pay nothing.for the second link, a user that provides more than 2**192 tokens, the amount of shares they will be truncated and they will get less than they should.
Recommended Mitigation Steps
use safe cast of openzeppelin.
The text was updated successfully, but these errors were encountered: