Maia DAO Ecosystem - ubermensch's results

Efficient liquidity renting and management across chains with Curvenized Uniswap V3.

General Information

Platform: Code4rena

Start Date: 30/05/2023

Pot Size: $300,500 USDC

Total HM: 79

Participants: 101

Period: about 1 month

Judge: Trust

Total Solo HM: 36

Id: 242

League: ETH

Maia DAO Ecosystem

Findings Distribution

Researcher Performance

Rank: 93/101

Findings: 1

Award: $23.84

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

Awards

23.8445 USDC - $23.84

Labels

bug
3 (High Risk)
partial-25
duplicate-758

External Links

Lines of code

https://github.com/code-423n4/2023-05-maia/blob/54a45beb1428d85999da3f721f923cbf36ee3d35/src/ulysses-omnichain/BranchBridgeAgent.sol#L1340-L1342

Vulnerability details

Impact

The _normalizeDecimals function, in its current implementation, could lead to incorrect balance calculations and token transfers, affecting any mechanism in the system that relies on it.

Proof of Concept

The _normalizeDecimals function's formula should be _amount * (1 ether) / (10 ** _decimals) to correctly normalize to 18 decimals. But the current implementation uses _amount * (10 ** _decimals) / 1 ether, which results in incorrect conversions.

Additionally, tokens with decimals greater than 18 aren't correctly handled.

Tools Used

Manual Review

The _normalizeDecimals function should be revised to correctly normalize amounts to 18 decimals. Here's a proposed implementation:

function _normalizeDecimals(uint256 _amount, uint8 _decimals) internal pure returns (uint256) { return _decimals == 18 ? _amount : _amount * (10 ** (18 - _decimals)); }

This new implementation ensures that the correct normalization is applied and it only accepts tokens with decimals less than or equal to 18.

Assessed type

Decimal

#0 - c4-judge

2023-07-09T15:20:55Z

trust1995 marked the issue as duplicate of #758

#1 - c4-judge

2023-07-09T15:20:59Z

trust1995 marked the issue as satisfactory

#2 - trust1995

2023-07-28T11:17:54Z

Partial credit for detecting 1/3 of the primary's issues.

#3 - c4-judge

2023-07-28T11:17:59Z

trust1995 marked the issue as partial-25

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