Consistently check account balance before and after transfers for Fee-On-Transfer discrepencies
The burnAsset function does not account for fee-on-transfer tokens when calculating the amount of fate tokens to credit, leading to an incorrect fateBalance and emitted fateCreated value. An attacker could exploit this to receive more fate tokens than deserved when burning a fee-on-transfer asset.
Submitted by Dravee
Wrong fateBalance bookkeeping for a user. Wrong fateCreated value emitted.
Proof of Concept
Taking into account the FOT is done almost everywhere important in the solution already. That’s a known practice in the solution.
However, it’s missing here (see @audit-info tags):
File: LimboDAO.sol
383: function burnAsset(address asset, uint256 amount) public isLive incrementFate {
384: require(assetApproved[asset], "LimboDAO: illegal asset");
385: address sender = _msgSender();
386: require(ERC677(asset).transferFrom(sender, address(this), amount), "LimboDAO: transferFailed"); //@audit-info FOT not taken into account
387: uint256 fateCreated = fateState[_msgSender()].fateBalance;
388: if (asset == domainConfig.eye) {
389: fateCreated = amount * 10; //@audit-info wrong amount due to lack of FOT calculation
390: ERC677(domainConfig.eye).burn(amount);//@audit-info wrong amount due to lack of FOT calculation
391: } else {
392: uint256 actualEyeBalance = IERC20(domainConfig.eye).balanceOf(asset);
393: require(actualEyeBalance > 0, "LimboDAO: No EYE");
394: uint256 totalSupply = IERC20(asset).totalSupply();
395: uint256 eyePerUnit = (actualEyeBalance * ONE) / totalSupply;
396: uint256 impliedEye = (eyePerUnit * amount) / ONE;//@audit-info wrong amount due to lack of FOT calculation
397: fateCreated = impliedEye * 20;
398: }
399: fateState[_msgSender()].fateBalance += fateCreated; //@audit-info potentially wrong fateCreated as fateCreated can be equal to amount * 10;
400: emit assetBurnt(_msgSender(), asset, fateCreated);//@audit-info potentially wrong fateCreated emitted
401: }
Tools Used
VS Code
Recommended Mitigation Steps
Check the balance before and after the transfer to take into account the Fees-On-Transfer.
gititGoro (Behodler) confirmed but disagreed with High severity and commented:
Nice catch! It’s not a level 3 bug, though.
Jack the Pug (judge) decreased severity to Medium and commented:
Downgrade to
Medas the assets need to be whitelisted.
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 contract calculates the fate tokens to mint based on the nominal transfer amount rather than the actual amount received after fee-on-transfer deductions.
Impact
A user could receive more fate tokens than they should when burning a fee-on-transfer asset, and the emitted event would report an incorrect amount; however, the impact is limited because only whitelisted assets are affected.
What the attacker needed
Asset must be whitelisted; asset must be fee-on-transfer
The fix
The contract should check the balance before and after the transfer to account for fees-on-transfer.
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.
Some tokens take a fee when transferred, so the receiver gets less than the amount sent. This code assumes the full amount arrives and credits the user with fate tokens based on that full amount, giving them too many. The fix is to check the actual balance change after the transfer.
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.