Adding reward tokens to twTap could cause pending cross-chain claim rewards msg to be stuck
A cross-chain reward claim message checks that the number of claimed reward token types matches the number of tokens in the original send parameters. If a new reward token is added to twTap after the message is sent but before it is replayed, the check fails and the message reverts, leaving it stuck and any TAP tokens it carried lost.
Originally disclosed on Code4rena
Submitted by ronnyx2017
There is a check in the TapTokenReceiver._claimTwpTapRewardsReceiver to ensure the claimed types amount is equal to the token types amount of sendParam.
if (
(claimedAmount_.length - 1) // Remove 1 because the first index doesn't count.
!= claimTwTapRewardsMsg_.sendParam.length
) {
revert
The process of cross-chain claim is as follows: The B chain is the main chain, which the twTap is deployed. And the user is on the chain A.
- The user calls
TapOFT.sendPacketwithMSG_CLAIM_REWARDSmessage on the chain A. - The LZ replays the message on the chain B, which will call the
TapTokenReceiver._claimTwpTapRewardsReceiverfunction. TapTokenReceiver._claimTwpTapRewardsReceiverfunction will send every reward token to the chain A by LZTapTokenSender(rewardToken_).sendPacket.
Proof of Concept
The issue is that, if after step 1 the LZ message sent, a new reward token is added to the twTAP on the chain B, then step 2 will be revert in the TapTokenReceiver._claimTwpTapRewardsReceiver function. So this message will be stuck in the LZ indefinitely.
Impact
Every LZ message sent by TapToken.sendPacket can carry cross-chain TAP tokens, which means the amountToSendLD of the message is not zero. It will burn the TAP token of the source chain and mint them on the target chain. If the message is stuck, these TAP token will be lost forever.
Assessed type
Context
Note: For full discussion, see here.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the receiver validates the claimed reward token count against a snapshot taken at send time, so any later change to the reward token set makes the message permanently unprocessable.
Impact
The stuck message could cause the TAP tokens it carried to be lost forever, since they were burned on the source chain and never minted on the target.
What the attacker needed
TwTap deployed on chain B; user sends claim message from chain A; new reward token added before replay
How it was found
- The user calls TapOFT.sendPacket with a claim-rewards message on chain A.
- The LayerZero message is replayed on chain B and calls the receiver's claim function.
- The receiver sends each reward token back to chain A via the sender contract.
- If a new reward token was added to twTap after step 1, the count check fails and the message reverts.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A user on one blockchain asks a contract on another blockchain to collect their rewards. The receiving contract compares how many kinds of reward tokens it found with how many the original request expected. If someone adds a new reward token in between, the numbers no longer match, the request fails, and the message cannot be retried, so tokens sent along with it are gone.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.