Function joinTokenSingle
in SingleTokenJoin.sol
and SingleTokenJoinV2.sol
can be made to fail
#81
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")
Handle
pmerkleplant
Vulnerability details
Impact
There's a griefing attack vulnerability in the function
joinTokenSingle
inSingleTokenJoin.sol
as well asSingleTokenJoinV2.sol
which makes any usertransaction fail with "FAILED_OUTPUT_AMOUNT".
Proof of Concept
The
JoinTokenStruct
argument forjoinTokenSingle
includes a fieldoutputAmount
to indicate the amount of tokens the user should receive after joining a basket
(see line 135 and 130).
However, this amount is compared to the contract's balance of the token and
reverts if the amount is unequal.
If an attacker sends some amount of a basket's token to the contract, every call
to this function will fail as long as the output token equals the attacker's token send.
Recommended Mitigation Steps
Refactor the
require
statement to expect at least theoutputAmount
of tokens,i.e.
require(outputAmount >= _joinTokenStruct.outputAmount)
.The text was updated successfully, but these errors were encountered: