Locked funds from tokenization are credited twice to user leading to protocol fund loss
The protocol releases locked FSD tokens twice when a user acquires conviction back from an NFT. An attacker could obtain double the locked amount, causing loss of protocol funds.
FairSide contest
Originally disclosed on Code4rena
The tokens optionally locked during tokenization are released twice on acquiring conviction back from an NFT. (The incorrect double debit of locked funds during tokenization has been filed as a separate finding because it is not necessarily related and occurs in different parts of the code.)
When a user wants to acquire back the conviction score captured by an NFT, the FSD tokens locked, if any, are released to the user as well. However, this is incorrectly done twice. Released amount is transferred once on Line123 in _release() (via acquireConviction -> burn) of FairSideConviction.sol and again immediately after the burn on Line316 in acquireConviction() of ERC20ConvictionScore.sol.
This leads to loss of protocol funds.
Alice tokenizes her conviction score into an NFT and locks 100 FSDs. Bob buys the NFT from Alice and acquires the conviction score back from the NFT. But instead of 100 FSDs that were supposed to be locked with the NFT, Bob receives 100+100 = 200 FSDs from FairSide protocol.
Recommend removing the redundant transfer of FSD tokens from protocol to the user on Line316 in acquireConviction() of ERC20ConvictionScore.sol.
fairside-core (FairSide) questioned:
This is directly related to #29 as it refers to the same workflow, as seen in #74 as a single submission. I believe splitting this into two findings is unfair for the first party, and secondly, it does not make sense because there is a valid argument for disagreeing with the severity seen on #74. Can we close this and merge it with #29?
fairside-core (FairSide) commented:
Fixed in PR#3.
Labeling issues #29 and #30 as separate issues because they both pose major issues, which lead to temporary loss of funds, in two different workflows. One when tokenizing convictions and another when acquiring convictions.
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 a redundant transfer of locked FSD tokens in the acquireConviction function, in addition to the transfer already performed during the burn.
Impact
This leads to loss of protocol funds, as the user receives double the locked amount.
What the attacker needed
User has locked FSD tokens during tokenization; Attacker acquires conviction from the NFT
The fix
The redundant transfer of FSD tokens on Line316 in acquireConviction() should be removed; the report states it was fixed in PR#3.
How it was found
- Alice tokenizes her conviction score into an NFT and locks 100 FSDs.
- Bob buys the NFT from Alice.
- Bob acquires the conviction score back from the NFT.
- Bob receives 200 FSDs instead of the 100 that were locked.
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.
When you lock tokens in a smart contract, the contract should return them only once when you unlock. Here, the code sent the locked tokens back twice: once during a burn step and again right after. This meant a user could get double the tokens they locked, draining the protocol.
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.