Maia DAO - Ulysses - 0xsagetony's results

Harnessing the power of Arbitrum, Ulysses Omnichain specializes in Virtualized Liquidity Management.

General Information

Platform: Code4rena

Start Date: 22/09/2023

Pot Size: $100,000 USDC

Total HM: 15

Participants: 175

Period: 14 days

Judge: alcueca

Total Solo HM: 4

Id: 287

League: ETH

Maia DAO

Findings Distribution

Researcher Performance

Rank: 65/175

Findings: 2

Award: $64.29

QA:
grade-a
Analysis:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Low Risk and Non-Critical Issues
  1. The _settlementNonce was not checked if it was valid in ArbitrumBranchBridgeAgent.sol/_performFallbackCall().

  2. There was no tracking of the amount going in or out of the root chain in ArbitrumBranchBridgeAgent.sol/withdrawFromPort().

  3. There is no check on _recipient and the _localAddress address which might lead to token loss in ArbitrumBranchPort.sol/_bridgeIn().

  4. There was no check on the localchainId validity in the BranchBridgeAgent constructor.

  5. depositNounce used for core system operations is defined as uint32 in BranchBridgeAgent/callOutSystem(). If it exceeds 4,294,967,295 it could lead to a DOS attack.

  6. The refundee address was not checked in BranchBridgeAgent/callOutAndBridge.

  7. The dParams.htokens.length should be checked before encoding in BranchBridgeAgent/callOutAndBridgeMultiple. If the length is more than 255 then it will be downcasted and lead to the loss of value.

  8. The recipient and router address were not checked in BranchBridgeAgentExecutor/executeWithSettlementMultiple().

  9. There was no address check in BranchPort/withdraw.

  10. The addresses were not checked in CoreRootRouter/initialize() and CoreRootRouter/removeBranchBridgeAgent().

  11. lzendpointaddress was not checked in the constructor of the RootBridgeAgentFactory contract.

  12. No address check on RootBridgeAgentExecutor/executeSystemRequest().

  13. Inconsistent use of require and revert statements. One of the statements should be used across the board. Revert statements are the recommended approach to save gas, in initialize(), initializeCore(), setCoreRouter() of RootPort.sol.

  14. Missing events for core system function in BranchPort/addBridgeAgent().

  15. Errors should be prefixed with the contract name for better error handling. E.g:

error BranchPort__AlreadyAddedBridgeAgent instead of error AlreadyAddedBridgeAgent().

Please address these issues to improve the security and robustness of your contract.

#0 - c4-pre-sort

2023-10-15T12:14:45Z

0xA5DF marked the issue as low quality report

#1 - c4-pre-sort

2023-10-15T12:16:35Z

0xA5DF marked the issue as sufficient quality report

#2 - 0xA5DF

2023-10-15T12:16:56Z

All the additional checks (1-12) are one finding with many instances imo

#3 - c4-judge

2023-10-20T13:38:48Z

alcueca marked the issue as grade-a

Awards

38.6134 USDC - $38.61

Labels

analysis-advanced
grade-b
sufficient quality report
A-10

External Links

Any comments for the judge to contextualize your findings

Context was added where it was relevant to aid the judges.

Approach taken in evaluating the protocol

Since this audit was focused on the Ulysses protocol, here are the steps taken to complete this audit.

  1. Went through the Ulysses docs to understand the protocol.
    • There are 4 major components:
      1. Ports: Root and Branch ports.
      2. Routers: Root and Branch routers.
      3. Bridge Agents: Root and Branch Bridge Agents.
      4. Virtualized Accounts and Liquidity.
  2. Drew two diagrams based on this understanding. [1],[2]
  3. Started to read the codebase high-level, starting from root and branch ports.
  4. With the docs in mind, I started to read each contract matches their supposed functionalities, functions calls (depending on how they are chained) do what they are supposed to do.
  5. When in doubt or confused, I consult the docs or ask in the discord channel dedicated for the audit. The sponsor and other wardens were kind enough to answer my questions.
  6. Next, I evaluate the contracts's logic, following the chained internal functions.
  7. Over the course of the above processes, I take notes about observations and possible attack vectors/paths.
  8. Last but not least, I review the notes and examine observations/attack vectors with more depth.

Observations

  • Ulysses codebase has some of the cleanest codes out of the box.
  • More often than not, Integration with Layerzero follows best practices.
  • Inconsistencies is some part of the codebase e.g usage of reverts and require simultaneously plus several missing checks for addresses passed to core functions.

Architecture recommendations

  • The current design uses _amount - _deposit in several parts of the codebase for calculation of the htokens that a user wants to bridge in/out or use in a transaction. This is counter-intuitive in some cases. For instance: If a user has htoken in source chain but only wants to use underlying tokens for a specific transaction, they would have no means to do so. A boolean can be passed as well to indicate if the user wants to use htokens or not before even doing the calculation of htokens for the tx.

  • Minor but, error handling is good but it could be better if it includes the contract where the error originated from. e.g error BranchPort__InvalidInputArrays(); instead of generic error InvalidInputArrays();

Systemic and/or Centralization risks

The system is designed to be as decentralized as possible. However, ownership is renounced is some areas of the codebase.

Time spent:

80 hours.

Time spent:

80 hours

#0 - c4-pre-sort

2023-10-15T14:12:43Z

0xA5DF marked the issue as sufficient quality report

#1 - alcueca

2023-10-20T12:04:11Z

Some original content as diagrams (which I believe was reused by others, along with an error). Not much else.

#2 - c4-judge

2023-10-20T12:04:16Z

alcueca marked the issue as grade-b

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