Cudos contest - reassor's results

Decentralised cloud computing for Web3.

General Information

Platform: Code4rena

Start Date: 03/05/2022

Pot Size: $75,000 USDC

Total HM: 6

Participants: 55

Period: 7 days

Judge: Albert Chon

Total Solo HM: 2

Id: 116

League: COSMOS

Cudos

Findings Distribution

Researcher Performance

Rank: 19/55

Findings: 2

Award: $651.51

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: wuwe1

Also found by: Dravee, GermanKuber, GimelSec, WatchPug, cccz, defsec, dipp, jah, reassor

Labels

bug
duplicate
2 (Med Risk)

Awards

502.4722 USDC - $502.47

External Links

Lines of code

https://github.com/code-423n4/2022-05-cudos/blob/de39cf3cd1f1e1cf211819b06d4acf6a043acda0/solidity/contracts/Gravity.sol#L600-L608

Vulnerability details

Impact

Contract Gravity.sol does not properly handle ERC20 tokens that charge fee on their transfers. Implementation of such a tokens does not transfer exact amount provided to transfer() but part of it is charged as a fee, burned or used in some other way. This leads to incorrect accounting and effectively to loss of funds.

Proof of Concept

Tools Used

Manual Review / VSCode

It is recommended to add support for ERC20 tokens with built-in fees. Example of the implementation:

uint256 ourStartingBalance = IERC20(_tokenContract).balanceOf(address(this)); IERC20(_tokenContract).safeTransferFrom(msg.sender, address(this), _amount); uint256 ourEndingBalance = IERC20(_tokenContract).balanceOf(address(this)); require(ourEndingBalance > ourStartingBalance, "ERC20 reduced balance"); state_lastEventNonce = state_lastEventNonce + 1; emit SendToCosmosEvent( _tokenContract, msg.sender, _destination, _amount, ourEndingBalance - ourStartingBalance, state_lastEventNonce );

#0 - mlukanova

2022-05-10T14:48:35Z

Duplicate of #3

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