Biconomy Hyphen 2.0 contest - catchup's results

Next-Gen Multichain Relayer Protocol.

General Information

Platform: Code4rena

Start Date: 10/03/2022

Pot Size: $75,000 USDT

Total HM: 25

Participants: 54

Period: 7 days

Judge: pauliax

Total Solo HM: 10

Id: 97

League: ETH

Biconomy

Findings Distribution

Researcher Performance

Rank: 26/54

Findings: 2

Award: $433.63

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: defsec

Also found by: Ruhum, catchup, danb, hickuphh3, peritoflores

Labels

bug
duplicate
2 (Med Risk)

Awards

80.3981 USDT - $80.40

External Links

Lines of code

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L348 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L349

Vulnerability details

Impact

equilibriumFee and maxFee values are used directly within getTransferFee() function without any checks performed. If these values were entered faulty by mistake at addSupportedToken() or changeFee(), such as too high maxFee, or equilibriumFee > maxFee, then transfer fee calculations will be incorrect. It would be good to check these settings against some default values and against each other before using them in getTransferFee() function.

Proof of Concept

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L348 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L349

Tools Used

manual analysis

Include checks such as: require(maxFee <= maxAllowedFee, "maxFee higher than allowed"); require(equilibriumFee < maxFee, "equilibriumFee faulty");

#0 - ankurdubey521

2022-03-30T15:44:18Z

Duplicate of #8

Awards

353.2341 USDT - $353.23

Labels

bug
QA (Quality Assurance)

External Links

C4 finding submitted: (risk = 1 (Low Risk)) updateTokenCap() updates only the transferConfig cap values, but not deposit config values.

Lines of code

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/token/TokenManager.sol#L111 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/token/TokenManager.sol#L112 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/token/TokenManager.sol#L96

Vulnerability details

addSupportedToken() writes the cap limits to transferConfig first and then copies the same values to deposit config by tokensInfo[tokenAddress].tokenConfig = transferConfig[tokenAddress]; However, updateTokenCap() updates only the transferConfig cap values, but not deposit config values.

Impact

There is no way to update tokensInfo[tokenAddress].tokenConfig

Proof of Concept

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/token/TokenManager.sol#L111 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/token/TokenManager.sol#L112 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/token/TokenManager.sol#L96

Tools Used

Manual analysis

Either update the deposit tokenConfig values the same as transfer config values such as: tokensInfo[tokenAddress].tokenConfig = transferConfig[tokenAddress]; Or include seperate min max parameters in updateTokenCap() for deposit config and use them.

C4 finding submitted: (risk = 1 (Low Risk)) getTokensInfo() returns transfer min-max values

Lines of code

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/token/TokenManager.sol#L121

Vulnerability details

addSupportedToken() writes the cap limits to transferConfig first and then copies the same values to deposit config by tokensInfo[tokenAddress].tokenConfig = transferConfig[tokenAddress]; However, updateTokenCap() updates only the transferConfig cap values, but not deposit config values.

Impact

getTokensInfo() returns transferConfig[tokenAddress] where it should be tokensInfo[tokenAddress].tokenConfig

Proof of Concept

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/token/TokenManager.sol#L121

Tools Used

Manual analysis

Line 121 should be changed as: tokensInfo[tokenAddress].tokenConfig;

C4 finding submitted: (risk = 1 (Low Risk)) maxFee is not checked against a max value while being updated

Lines of code

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/token/TokenManager.sol#L50

Vulnerability details

changeFee() maxFee should be checked against a maximum value (like 10%) to make sure it is not set too high by mistake.

Impact

maxFee can be set beyond limits which would mess up fee calculations.

Proof of Concept

getTransferFee() function calculations will give unpredicted results. https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L342

Tools Used

Manual analysis

A check should be added to changeFee() such as: require(_maxFee <= maxAllowedFee, "maxFee higher than allowed");

C4 finding submitted: (risk = 1 (Low Risk)) changeFee() should have tokenChecks(tokenAddress) modifier

Lines of code

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/token/TokenManager.sol#L48

Vulnerability details

changeFee() is not checking if the tokenAddress is zero and the token is supported.

Impact

Unnecessary execution if the tokenAddress is zero or the token is not supported

Proof of Concept

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/token/TokenManager.sol#L48

Tools Used

Manual analysis

changeFee() should include tokenChecks(tokenAddress) modifier

C4 finding submitted: (risk = 0 (Non-critical)) No need to define abicoder V2

Lines of code

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L4 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/token/LPToken.sol#L3

Vulnerability details

abicoder V2 is explicitly defined at LPToken.sol, LiquiditPool.sol. Starting from solidity version 0.8.0 abi coder V2 is activated by default.

Impact

Unnecessary code

Proof of Concept

https://docs.soliditylang.org/en/v0.8.11/080-breaking-changes.html

Tools Used

Manual analysis

These pragma's can be removed.

C4 finding submitted: (risk = 0 (Non-critical)) executors and executorStatus can be made private.

Lines of code

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/ExecutorManager.sol#L9 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/ExecutorManager.sol#L10

Vulnerability details

Internal state variables can be private

Impact

Proof of Concept

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/ExecutorManager.sol#L9 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/ExecutorManager.sol#L10

Tools Used

Manual analysis

Change executors and executorStatus visibility as private.

C4 finding submitted: (risk = 0 (Non-critical)) setBaseGas() takes a parameter of uint128

Lines of code

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L22 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L119

Vulnerability details

setBaseGas() takes a parameter of uint128 but baseGas is actually uint256

Impact

Better coding practice

Proof of Concept

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L22 https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L119

Tools Used

Manual analysis

Change the parameter to uint256.

C4 finding submitted: (risk = 0 (Non-critical)) typo in comment

Lines of code

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L300

Vulnerability details

There is a typo for the word 'after'

Impact

Proof of Concept

https://github.com/code-423n4/2022-03-biconomy/blob/main/contracts/hyphen/LiquidityPool.sol#L300

Tools Used

Manual analysis

Fix the typo.

#0 - pauliax

2022-05-17T15:36:36Z

"changeFee() maxFee should be checked against a maximum value (like 10%) to make sure it is not set too high by mistake." should be Medium: https://github.com/code-423n4/2022-03-biconomy-findings/issues/8#issuecomment-1114023886

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