NFTs can never be redeemed back to their conviction scores leading to lock/loss of funds
The tokenization function fails to update the protocol's overall conviction score, so later attempts to redeem an NFT back to a conviction score always revert due to an underflow. As a result, users cannot redeem their tokenized conviction scores, effectively losing the conviction score value.
FairSide contest
Originally disclosed on Code4rena
Besides the conviction scores of users, there appears to be tracking of the FairSide protocol’s tokenized conviction score as a whole (using fscAddress = address(fairSideConviction)). This is evident in the attempted reduction of the protocol’s score when a user acquires conviction back from an NFT. However, the complementary accrual of the user’s conviction score to fscAddress when the user tokenizes their conviction score to mint an NFT is missing in tokenizeConviction().
Because of this missing update of the conviction score to fscAddress upon tokenization, there are no checkpoints written for fscAddress. There also doesn’t appear to be any initialization for bootstrapping this address’s conviction score checkpoints. As a result, the sub224() on Line350 of ERC20ConvictionScore.sol will always fail with an underflow. This is because fscOld = 0 (because fscNum = 0) and convictionScore > 0, effectively reverting all calls to acquireConviction().
The impact of this is that all tokenized NFTs can never be redeemed back to their conviction scores leading to a lock/loss of FSD funds for users who tokenized/sold/bought FairSide NFTs.
Proof of Concept:
- Alice tokenizes her conviction score into an NFT. She sells that NFT to Bob, who pays an amount commensurate with the conviction score captured by that NFT (as valued by the market) and any FSDs locked with the NFT.
- Bob then attempts to redeem the bought NFT back to the conviction score to use it on the FairSide network. But the call to
acquireConviction()fails. Bob is never able to redeem Alice’s NFT and has lost the funds used to buy it.
Recommend adding appropriate logic to bootstrap, initialize fscAddress ’s tokenized conviction score checkpoints, and update it during tokenization.
fairside-core (FairSide) confirmed:
Although the finding is correct, FSDs will not be permanently locked in the NFT as they can still be redeemed via the dedicated
releasefunction on the conviction NFT implementation. As such, I would label this a medium-level finding, given that the conviction scores will indeed be lost.
fairside-core (FairSide) commented:
Fixed in PR#16.
Labeling this as medium risk as FSDs will not be permanently locked.
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 tokenizeConviction() function does not update the protocol's overall conviction score checkpoints, causing an underflow when acquireConviction() tries to subtract from a zero value.
What the attacker needed
User has a conviction score; user tokenizes conviction score into an NFT; NFT is sold or transferred; new owner attempts to redeem NFT
The fix
The issue was fixed by adding logic to bootstrap and update the protocol's conviction score checkpoints during tokenization.
How it was found
- Alice tokenizes her conviction score into an NFT.
- She sells that NFT to Bob.
- Bob attempts to redeem the bought NFT back to the conviction score.
- The call to acquireConviction() fails.
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.
Conviction scores are like loyalty points that can be turned into NFTs. The code forgets to update the total points when you create an NFT, so when you try to turn the NFT back into points, the system crashes and you lose the points.
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.