Submitted by KIntern_NA, also found by bin2chen and glcanvas
The attacker can exploit the contract twTAP.sol to steal rewards.
The function twTAP.claimAndSendRewards() -> twTAP._claimRewardsOn() is intended for users who utilize the cross-chain message of BaseTOFT.sol to claim a specific set of reward tokens.
The internal function iterates through the list of reward tokens specified by the user after calculating the claimable amount for each token in the STORAGE array twTAP.rewardTokens[]. Unfortunately, there is no check if the _rewardTokens contain duplicated reward tokens, and the function claimable(_tokenId) is not called after each iteration, which allows the attacker to manipulate the function call using the same reward address repeatedly.
For example,
One solution to mitigate this issue is to require the MEMORY array _rewardTokens to be sorted in ascending order.
By ensuring that the reward tokens are sorted in ascending order, we can prevent the exploit where the attacker claims the same reward token multiple times and effectively mitigate the vulnerability.
0xRektora (Tapioca) confirmed via duplicate issue 1304
