Beneficiary cant get fairSideConviction NFT unless they only claim once, and only after it’s fully vested
The vesting contract only transfers the conviction NFT if the final claim amount equals the total vesting amount, so a beneficiary who makes any earlier claim can never receive the NFT. An attacker (or any beneficiary) could permanently lose access to the NFT by claiming in multiple transactions.
Submitted by WatchPug, also found by cmichel
Based on the context, once the beneficiary claimed all their vesting tokens, they should get the fairSideConviction NFT.
However, in the current implementation, if the beneficiary has claimed any amounts before it’s fully vested, then they will never be able to get the fairSideConviction NFT, because at L138, it requires the tokenbClaim to be equal to the initial vesting amount.
function claimVestedTokens() external override onlyBeneficiary {
uint256 tokenClaim = calculateVestingClaim();
require(
tokenClaim > 0,
"FSDVesting::claimVestedTokens: Zero claimable tokens"
);
totalClaimed = totalClaimed.add(tokenClaim);
lastClaimAt = block.timestamp;
fsd.safeTransfer(msg.sender, tokenClaim);
emit TokensClaimed(msg.sender, tokenClaim, block.timestamp);
if (amount == tokenClaim) {
uint256 tokenId = fsd.tokenizeConviction(0);
fairSideConviction.transferFrom(address(this), msg.sender, tokenId);
}
}
Recommendation
Change to:
function claimVestedTokens() external override onlyBeneficiary {
uint256 tokenClaim = calculateVestingClaim();
require(
tokenClaim > 0,
"FSDVesting::claimVestedTokens: Zero claimable tokens"
);
totalClaimed = totalClaimed.add(tokenClaim);
lastClaimAt = block.timestamp;
fsd.safeTransfer(msg.sender, tokenClaim);
emit TokensClaimed(msg.sender, tokenClaim, block.timestamp);
if (amount == totalClaimed) {
uint256 tokenId = fsd.tokenizeConviction(0);
fairSideConviction.transferFrom(address(this), msg.sender, tokenId);
}
}
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
The condition for transferring the NFT compares the current claim amount to the total vesting amount, rather than comparing the cumulative total claimed to the total vesting amount.
What the attacker needed
Beneficiary claims tokens before full vesting
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 vesting contract gradually releases tokens to a beneficiary. The contract also promises a special NFT once all tokens are claimed. The bug is that the contract checks if the current claim equals the total amount, instead of checking if the total claimed so far equals the total amount. So if you claim in parts, you never get the NFT.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.