Attacker can break joinTokenSingle()
by transferring basketToken to the contract
#212
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
Handle
WatchPug
Vulnerability details
https://github.com/code-423n4/2021-12-amun/blob/98f6e2ff91f5fcebc0489f5871183566feaec307/contracts/basket/contracts/singleJoinExit/SingleTokenJoin.sol#L133-L137
In the current implementation,
_joinTokenSingle()
requires balanceOfoutputToken
strictly equal tooutputAmount
in calldata.However, since anyone can transfer
outputToken
to the contract, if there are existingoutputToken
in the balanceOf the contract,joinTokenSingle()
will always fail with "FAILED_OUTPUT_AMOUNT".An attacker can send
1 wei
ofoutputToken
and breakjoinTokenSingle()
.The same problem also applies to:
https://github.com/code-423n4/2021-12-amun/blob/98f6e2ff91f5fcebc0489f5871183566feaec307/contracts/basket/contracts/singleJoinExit/SingleTokenJoinV2.sol#L128-L132
Recomandation
Change to:
The text was updated successfully, but these errors were encountered: