DoS in wrap and unwrap #159
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
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-05-alchemix/blob/de65c34c7b6e4e94662bf508e214dcbf327984f4/contracts-full/adapters/fuse/FuseTokenAdapterV1.sol#L76
https://github.com/code-423n4/2022-05-alchemix/blob/de65c34c7b6e4e94662bf508e214dcbf327984f4/contracts-full/adapters/fuse/FuseTokenAdapterV1.sol#L98
Vulnerability details
Impact
the code is doing wrong check, so when things will work it will revert.
Proof of Concept
In the function
wrap()
there is this lines:but
mint
returns the amount that minted, so whenerror = amount
the check will fail even though it worked good.Same in
unwrap
:the redeem returns the amount.
Recommended Mitigation Steps
I recommend to change the lines like this:
in wrap:
if ((error = ICERC20(token).mint(amount)) != amount) { revert FuseError(error); }
and in unwrap:
if ((error = ICERC20(token).redeem(amount)) != amount) { revert FuseError(error); }
The text was updated successfully, but these errors were encountered: