Behodler contest - Dravee's results

Ethereum liquidity protocol powered by token bonding curves.

General Information

Platform: Code4rena

Start Date: 27/01/2022

Pot Size: $90,000 USDC

Total HM: 21

Participants: 33

Period: 7 days

Judge: Jack the Pug

Total Solo HM: 14

Id: 78

League: ETH

Behodler

Findings Distribution

Researcher Performance

Rank: 6/33

Findings: 3

Award: $3,254.43

🌟 Selected for report: 7

🚀 Solo Findings: 1

Findings Information

🌟 Selected for report: Dravee

Labels

bug
2 (Med Risk)
disagree with severity
resolved
sponsor confirmed

Awards

1987.8596 USDC - $1,987.86

External Links

Handle

Dravee

Vulnerability details

Impact

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

Check the balance before and after the transfer to take into account the Fees-On-Transfer

#0 - gititGoro

2022-02-05T02:08:19Z

Nice catch! It's not a level 3 bug, though.

#1 - jack-the-pug

2022-02-27T07:26:10Z

Downgrade to Med as the assets need to be whitelisted.

#2 - gititGoro

2022-06-25T01:27:33Z

setEYEBasedAssetStake cannot handle FOT tokens predictably because of the invariant checks on initial balance and final balance. Adding an amount parameter to circumvent this undermines the security of checking invariants. So no PR will be opened against this issue. In retrospect I should have marked it invalid. Marking resolved.

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter