Submitted by pmerkleplant, also found by certora, hyh, p4st13r4, pauliax, robee, and WatchPug
Theres a griefing attack vulnerability in the function joinTokenSingle in
SingleTokenJoin.sol as well as SingleTokenJoinV2.sol which makes any user
transaction fail with FAILEDOUTPUTAMOUNT.
The JoinTokenStruct argument for joinTokenSingle includes a field outputAmount
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 contracts balance of the token and
reverts if the amount is unequal.
If an attacker sends some amount of a baskets token to the contract, every call
to this function will fail as long as the output token equals the attackers token send.
Refactor the require statement to expect at least the outputAmount of tokens,
i.e. require(outputAmount >= _joinTokenStruct.outputAmount).
loki-sama (Amun) confirmed
