Skip to content
Business logic Audit finding Intermediate

Locked funds are debited twice from the user during tokenization leading to fund loss

When a user tokenizes their conviction score and specifies an amount of FSD tokens to lock, the contract transfers that amount from the user twice. The user therefore loses the specified number of tokens beyond what they intended to lock.

FairSide contest

Originally disclosed on Code4rena

During tokenization of conviction scores, the user can optionally provide FSDs to be locked to let it continue conviction accrual. However, the amount of FSDs specified for locking are debited from the user twice, leading to fund loss.

This, in effect, forces the user to unknowingly and unintentionally lock twice the amount of FSD tokens, leading to a loss of the specified ‘locked’ number of tokens.

Alice decides to tokenize her conviction score into an NFT and specifies 100 FSD tokens to be locked in her call to tokenizeConviction(100). 100 FSD tokens are transferred from her FSD balance to FairSideConviction contract on Line282 of ERC20ConvictionScore.sol. However, in FairSideConviction.createConvictionNFT(), the specified locked amount is transferred again from Alice to the contract on Line50 of FairSideConviction.sol.

The impact is that Alice wanted to lock only 100 FSD tokens, but the FairSide protocol has debited 200 tokens from her balance leading to a loss of 100 FSD tokens.

Recommend removing the redundant transfer of FSD tokens on Line282 in tokenizeConviction() of ERC20ConvictionScore.sol.

The original report as published on Code4rena. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 token transfer: the locking amount is transferred in the calling function and then transferred again inside the NFT creation function.

Impact

The user is forced to lock twice the intended amount, losing the extra tokens.

What the attacker needed

A user with FSD tokens; user tokenizes conviction score

The fix

The redundant token transfer in tokenizeConviction should be removed so the amount is only moved once.

How it was found

  1. The user calls tokenizeConviction with an amount of FSD tokens to lock.
  2. The contract transfers that amount from the user's balance.
  3. The contract then calls createConvictionNFT, which transfers the same amount again.

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 smart contract is a program that runs on a blockchain and can hold tokens. Here, one function moved the user's tokens into the contract, and a second function called later moved the same amount again, so the user paid twice for one action.

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.

More from FairSide contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.