Decent Aqua Sloth
High
In the VVVVCTokenDistributor.sol
file, the claim function allows users to claim tokens. Any malicious actor can frontrun the valid signature used here to steal the claimed tokens.
In VVVVCTokenDistributor.sol:133
, the tokens are sent to the msg.sender
. It can be done but only if the signature has the msg.sender
in it to make sure the msg.sender
is validated by the signature done offchain. This is not the case in _isSignatureValid
function, so anyone can frontrun the transaction of an other user to claim his tokens.
No response
No response
- A user wants to claim tokens
- The offchain signature of the protocol sign the claiming
- The user calls the
claim
function with the signature - Seeing that a malicious user frontrun the transaction and claim with the exact same parameters
- The malicious user receives tokenss
- The user's transaction reverts because the nonce is already used.
Any user can loose all his claimed tokens.
Add this test to VVVVCTokenDistributor.unit.t.sol
file:
function testPOC() public {
address hacker = makeAddr("hacker");
VVVVCTokenDistributor.ClaimParams memory claimParams = generateClaimParamsWithSignature(
sampleUser,
projectTokenProxyWallets,
sampleTokenAmountsToClaim
);
// Seeing this transaction in the mempool, the hacker frontrun it
// claimAsUser(sampleUser, claimParams);
claimAsUser(hacker, claimParams);
assertTrue(ProjectTokenInstance.balanceOf(hacker) == sum(sampleTokenAmountsToClaim));
assertTrue(ProjectTokenInstance.balanceOf(sampleUser) == 0);
}
Add the msg.sender
to the signed message