Skip to content
$1,000,000 in security audit grants are live now, Apply here →

Security review · March 2025

Hyperliquid Deployment

for USDT0

Guardian's review of Hyperliquid Deployment for USDT0, published March 2025. The report records 11 findings across 2 review rounds, including 1 low and 10 informational.

Published
Review window
February 27 to March 5, 2025
Rounds
Main Review, Remediation Review
Language
Solidity
Chains
Hyperliquid
Sector
Stablecoins, Cross-chain
  • 0 Critical
  • 0 High
  • 0 Medium
  • 1 Low
  • 10 Informational

5 resolved · 4 acknowledged · 2 reported

Scope

Findings 11

Main Review

9 findings · February 27 to March 5, 2025
  1. L-01 Low System Address Receiver Undefined Behavior Warning Resolved
    Location
    Global
    Round
    Main Review

    Description

    The HyperLiquidComposer contract allows the user to transfer their USDT0 to any receiver address on the HyperLiquid L1. Included in this is the HyperLiquid system contract 0x2222222222222222222222222222222222222222. It is unclear how the HyperLiquid system will handle a transfer from the composer contract to the system contract followed by another transfer from the system contract to the system contract. Depending on the integration of USDT0 in the spot balances on the HyperLiquid L1 this may cause unexpected issues and has the potential to duplicate tokens depending on the behavior.

    Recommendation

    Consider explicitly disallowing a receiver address of the HyperLiquid system contract 0x2222222222222222222222222222222222222222 to avoid any unexpected behavior.

  2. I-01 Informational Misleading Comment Documentation Acknowledged
    Location
    TetherToken.sol: 27
    Round
    Main Review

    Description

    The base TetherToken contract indicates that the isTrusted variable is an Unused variable retained to preserve storage slots across upgrades. However in the HyperliquidExtension this mapping is used to validate transferWithHop callers.

    Recommendation

    Consider removing or updating the comment for the Hyperliquid deployment. Otherwise add a new comment in the HyperliquidExtension contract.

  3. I-02 Informational Trapped Funds With Malformed ComposeMsg Trapped Funds Acknowledged
    Location
    HyperLiquidComposer.sol
    Round
    Main Review

    Description

    The lzCompose function in the HyperLiquidComposer contract expects the composeMsg to contain an address and only an address in it’s contents. In the event that a composeMsg is provided which does not adhere to this structure and has less bytes than an address, the decoding reverts and the lzCompose call cannot be executed for the corresponding message. In this case the USDT0 bridged to the HyperLiquidComposer contract is effectively trapped.

    Recommendation

    Be aware of this risk and be sure to include the proper validations in the UI when sending composed messages to the HyperLiquidComposer. If further mitigation is desired, consider adding a rescue function where a trusted address can withdraw trapped USDT0 from the contract.

  4. I-03 Informational Lacking Zero Address Checks Validation Resolved
    Location
    HyperLiquidComposer.sol
    Round
    Main Review

    Description

    The HyperLiquidComposer contract does not implement zero address validations in the constructor for the _token, _endpoint, or _oApp addresses.

    Recommendation

    Consider implementing zero address validations to reduce the risk of an incorrect deployment.

  5. I-04 Informational Unnecessary Imports Superfluous Code Resolved
    Location
    HyperLiquidComposer.sol
    Round
    Main Review

    Description

    In the HyperLiquidComposer contract the IOAppCore and OStableWrapper imports are unnecessary. Additionally, the SafeERC20 library usage and import is unnecessary.

    Recommendation

    Remove the IOAppCore, OStableWrapper, and SafeERC20 imports.

  6. I-05 Informational Lacking Token Validation Validation Resolved
    Location
    HyperLiquidComposer.sol
    Round
    Main Review

    Description

    The lzCompose function assumes that the token and OApp are connected, however there is no explicit validation in the constructor which asserts this at the Smart Contract level. If these addresses are somehow misconfigured it could lead to failed bridges and trapped funds.

    Recommendation

    Consider adding validation in the constructor to ensure that the OApp and token pair are correctly linked via the HyperLiquidExtension.oftContract and OUpgradeable.token functions.

  7. I-06 Informational Composed Messages Stuck For Certain Receivers DoS Acknowledged
    Location
    Global
    Round
    Main Review

    Description

    The _beforeTokenTransfer function in the TetherToken base contract prevents transfers where the USDT0 contract or the zero address is the recipient. Any composed messages with the recipient as the USDT0 contract or the zero address will therefore be unexecutable. Notice that compose messages with a blacklisted address as the receiver will also be unexecutable, since the transferWithHop function attempts to transfer from the receiver address.

    Recommendation

    Be sure to validate in the UI that the receiver address is not the USDT0 contract on HyperEVM nor the zero address.

  8. I-07 Informational Incorrect Documentation Documentation Resolved
    Location
    HyperLiquidComposer.sol
    Round
    Main Review

    Description

    The comment for the constructor in the HyperLiquidComposer contract indicates that the constructor Constructs the StableComposer contract. However instead it should read Constructs the HyperLiquidComposer contract. Additionally, the lzCompose function documentation indicates that the function is intended to perform a token swap and that it expects the encoded compose message to contain the swap amount and recipient address. This misleading documentation about the expected contents of the compose message could be dangerous for users and integrators. If a user were to supply a compose message which follows the documentation the compose message would be unexecutable and the user’s funds would be trapped.

    Recommendation

    Update the documentation to reflect that the HyperLiquidComposer contract is constructed, what this contracts intent is, and that only a recipient address is expected.

  9. I-08 Informational Trapped ETH In lzCompose Trapped Funds Acknowledged
    Location
    HyperLiquidComposer.sol
    Round
    Main Review

    Description

    The lzCompose function is payable in the LayerZero interface, however the implementation in the HyperLiquidComposer contract does not expect to receive any native funds. As a result any native funds sent by an executor when executing the lzCompose function would be lost.

    Recommendation

    Consider validating that the msg.value provided to the lzCompose function is explicitly 0 since the payable modifier is necessary to adhere to the LayerZero interface.

Remediation Review

2 findings · February 28 to March 2, 2025
  1. I-01 Informational Hyperliquid Deployment Concerns Warning Reported
    Location
    Global
    Round
    Remediation Review

    Description

    The deployment and bridging of an ERC20 token on HyperEVM, intended to interact with a native spot asset on Hyperliquid L1, involves specific initialization requirements and token supply configurations that raise concerns about correctness and clarity. When a spot token is deployed on Hyperliquid L1, there are multiple settings to take into account, especially, the maximum supply and the user genesis balances. The maximum supply represents the maximum total supply of the token across all chains and it is used mainly for internal accounting, to display market caps etc. The user genesis balances are the accounts that receive the maximum supply when the token is created, or which is the same, the original minted balances. The USDT token current totalSupply is equal to 76,918,584,460.692261 on Ethereum mainnet and, therefore, during the deployment into the Hyperliquid L1, it is required to configure the maximum supply to be 76,918,584,460.692261 as well. Moreover, in the user genesis [0x222...222, 76,918,584,460.692261] must be set which basically would say that the total supply should be assigned to the bridge. This, in effect, is just for virtual accounting as the bridge does not have the 76918584460692261 tokens, however, neither does the L1. Later on, when a transfer from the EVM to the L1 occurs, all Hyperliquid does on the L1 is debit that amount from the 0x222...222 system address and credit the amount to the account that the amount was transferred from. For example, see the genesis balance of UBTC which is configured to have the entire BTC supply of 21 Million: https://app.hyperliquid.xyz/explorer/token/0x8f254b963e8468305d409b33aa137c67

    Recommendation

    To ensure the successful deployment and bridging of the USDT0 ERC20 token on HyperEVM with Hyperliquid L1, the total balance and user genesis balance for the bridge contract should be assigned to the total supply of USDT on Ethereum Mainnet at the time of listing. It is unclear how to handle tokens which may increase or decrease in totalSupply over time such as USDT, further clarity should be made by the Hyperliquid team before proceeding. Finally, this process should be fully tested earlier on the Hyperliquid testnet following the steps mentioned above.

  2. I-02 Informational Unclear ERC20 Transfer Behavior Warning Reported
    Location
    Global
    Round
    Remediation Review

    Description

    In this article regarding the functionality of the HyperEVM precompiles it is mentioned that:

    Accounts must already exists on the L1
    
    When you first perform an interaction on the L1 from a new smart contract, the action will fail silently on the L1 if the account doesnt not already exists. This must be handled manually such that once the smart contract has been deployed and the address is known, a dust amount of USDC can be sent on the L1 from any account to the address of the smart contract. This forces the account to be created on the L1 and from there everything will work accordingly.
    

    It is unclear whether this behavior would only apply to the 0x33333… system precompile address or if it also applies to ERC20 transfers with the 0x222222… system precompile. We are currently confirming this behavior with the HyperLiquid team.

    Recommendation

    Be aware of this behavior with the 0x333333 system precompile address, and ensure that we are able to confirm the behavior of the 0x222222 ERC20 interactions before moving forward with deployment.

More from USDT0

All 34 reports
  1. USAT Reconfiguration

    1 finding 1 finding: 1 low
  2. Stellar Deployment

    2 findings 2 findings: 2 informational
  3. Corn Network Delisting

    1 finding 1 finding: 1 low
  4. Canary Chain Configuration Verification

    4 findings 4 findings: 4 informational

Put your code through the same review.

This review started with a conversation about scope. Tell us what you are building and we will plan yours with you.

Get a quote