The FjordAuction smart contract contains a critical vulnerability where user bids are not properly reset after claiming tokens. This oversight allows users to potentially claim tokens multiple times, leading to an unfair distribution of auction tokens and potential loss of funds for the contract.
In the claimTokens() function, the contract sets the user's bid to zero after calculating and transferring the claimable tokens:
However, there is no mechanism to prevent a user from calling this function multiple times. The function only checks if the user's bid is zero before proceeding, but does not implement any safeguard against repeated claims.
1: Users can claim tokens multiple times, receiving more tokens than they are entitled to based on their original bid.
2: This could lead to a depletion of the contract's token balance, potentially leaving later claimants unable to receive their fair share of tokens.
3: The integrity of the auction process is compromised, as the final distribution of tokens does not accurately reflect the bidding results.
4: In extreme cases, a malicious user could drain all available tokens from the contract.
manual review
1: Introduce a new mapping to track whether a user has already claimed their tokens
2: Modify the claimTokens() function to check and update this mapping
3: Consider implementing a withdrawal pattern instead of directly transferring tokens, to mitigate potential reentrancy attacks:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.