Is there a risk of uncontrolled access to Hyperliquid API wallet permissions? Itemized permission control may be the solution.

CN
15 minutes ago
The security boundary of the API wallet continues to degrade, and native permission control has become a key shortfall.

Written by: DevenMat, Co-founder of Valantis Labs

Compiled by: AididiaoJP, Foresight News

Note: The assumptions in this article about the Hyperliquid state model are primarily based on testnet transactions. The HyperCore state machine is currently a black box - nodes run signed binary files, and the code is not publicly available. The actual cost of introducing permission policies in the API wallet can only be estimated through testnet transactions and Hyperliquid's publicly disclosed architectural decisions. Before the node source code is made public, community-proposed improvement suggestions based on evidence remain limited.

As a liquidity backend, Hyperliquid enables individual agents to build a complete financial experience for users on a unified base. It inherently possesses traits of deep liquidity, composability, programmability, and neutrality, thereby positioning itself as an irreplaceable financial infrastructure in the age of agents.

However, HyperCore currently lacks the core security capabilities that agents rely on - limited scope permission policies. Permission policies are essentially limited permissions, such as allowing trading only in specified markets, requiring approval before opening positions, prohibiting transfers to unknown addresses, etc. It is these types of restricted permissions that allow today’s non-financial individual agents to operate safely with data such as emails, calendars, and contacts. Yet, Hyperliquid has, over the past year, eliminated support for such scope-limited API access.

The security boundary of the API wallet (formerly known as the agent wallet) continues to degrade, to the point where it is no longer suitable to grant user account permissions to agents. It should be emphasized that AI agents need to operate accounts on Hyperliquid through the API wallet, but the current API wallet permissions are too broad and lack restrictions, making it very risky to hand over the API wallet directly to AI agents.

This article seeks to find a pathway to rebuild Hyperliquid as a reliable financial backend for individual agents.

AI Agents in the Wallet

AI agents are a key distribution channel for achieving Hyperliquid's vision of "liquidity AWS," enabling Hyperliquid to truly become the underlying layer of billions of people's daily financial lives.

Future forms of personal finance will see agents directly accessing your investment portfolio, acting on your behalf after obtaining explicit authorization, calling upon funds, credentials, and data. If Hyperliquid is to become the financial layer for these agents, account-level permission control must be provided: allowing agents to only access specific parts of the account rather than the entirety.

The only feasible way currently is through CoreWriter, but latency issues make this solution incomplete; an additional layer of control must be added at the native HyperCore level. The API wallet itself must also maintain a minimum security boundary to support the user experience required by agents.

Handing over the API wallet directly to AI agents currently poses significant and growing risks.

Support for AI Agents Has Been Interrupted

The originally designed security boundary of the API wallet has significantly degraded.

Now, as long as a user's account assets exceed approximately $40 million, if the API wallet is maliciously used, attackers can use the account's funds to buy 500,000 HYPE and stake it, then start a HIP-3 market under their control using these staked assets. As a result, the user's related assets will be locked for 183 days and face the risk of penalties. Moreover, this series of operations is irreversible; even if the user later revokes the API wallet, it cannot be undone.

The situation has not always been like this. Let's review the historical boundaries.

In the initial design, the API wallet could not withdraw or transfer funds from the account.

But the system never restricted the scale of margin that the API wallet could call. Once compromised, attackers could maliciously place orders in thin markets (with themselves as counterparties) to siphon off funds. In 2022, the leaked API keys of trading bot service 3Commas were used to place orders in users' Binance accounts, specifically targeting the periods with the worst liquidity and easiest to manipulate.

In addition to the above attacks, subsequent upgrades introduced new risk exposures that were entirely unconsidered in the initial security architecture.

179491535873622.jpg

These unrelated upgrades piled up, ultimately rendering the security boundary of the API wallet practically ineffective.

Risks

The API wallet has become the default way for users to trade on Hyperliquid through its interface. Currently, many wallets still directly list hosted API wallets in various builder code applications.

For ordinary trading applications, this risk may still be tolerable - after all, they only control a subset of the user population. However, once AI agents are introduced, the risks will amplify dramatically.

AI agents do not need to steal your API wallet private key to drain the account. They just need to be induced to read a piece of malicious text. Giving the API wallet to an agent is equivalent to exposing all the aforementioned attack paths to anyone who can place a statement in front of it.

Why Do API Wallet Permissions Continue to Expand?

Smart contracts on HyperEVM interact with HyperCore through CoreWriter, which is the foundational framework for Hyperliquid’s programmable applications. There are two ways smart contracts can change the state of HyperCore: by calling CoreWriter actions or using the API wallet.

To enable smart contracts to possess the same operational capabilities as regular accounts, the simplest approach is to continuously increase permissions for the API wallet. A more ideal way should be to create a separate CoreWriter action for each new account operation that is sensitive to security but not to latency. However, maintaining CoreWriter incurs higher costs - each new action requires an independent action ID, node-side support, and must appear as a separate transaction type on HyperCore. In contrast, simply expanding API wallet permissions incurs very low costs while covering both smart contracts and regular accounts.

Additionally, nearly all transaction infrastructures on HyperCore adopt a similar architecture: low-latency API wallet hot keys are deployed close to the network, while cold wallets are isolated offline. Therefore, all latency-sensitive operations must be executable by the API wallet to meet the needs of high-value accounts. This also explains why priority fee expenditures occur on API wallets, as well as why staking deposits used to replenish priority fee balances were first included in the API wallet's permission scope—likely at the request of priority fee users.

The continuous expansion of API wallet permissions stems from different builders relying on it for various needs. The problem is that every upgrade indiscriminately expands external applications' control over user accounts, and users have no choice to opt out.

Permission Policies on Hyperliquid

Currently, the best way to implement action-based permission control on Hyperliquid is to use smart contract accounts on HyperEVM to control their corresponding HyperCore addresses. All HyperCore actions will first undergo custom Solidity checks before being processed through CoreWriter. Our developed Valantis Prime is designed for this purpose: it leverages Obsidian's CoreWriterLib and a custom Guardian to enable HyperCore transactions with permission control and programmability. Specific capabilities include:

  • Setting different signers and thresholds for various actions in HyperCore multisig;
  • Setting whitelists and upper limits on amounts for HyperCore transfers.

However, this design completely fails in trading scenarios.

Trades must be submitted through HyperEVM, go through Solidity checks, and wait for the next HyperCore block to process CoreWriter actions before they can actually be executed. This method is suitable for operations such as staking, transferring, and lending, which are not sensitive to latency but cannot meet the low-latency demands of trading.

If low latency is required, the API wallet must interact directly with HyperCore, but the API wallet currently has no constraints or control layers.

Privy offers custodial services that can enforce policies prior to signing. We believe that without native primitives to restrict account signing permissions, custodial trusted signing middleware will become a key dependency for many users on Hyperliquid. We consider this not ideal and unnecessary.

Relying on trusted middleware to implement the security primitives required for agents on Hyperliquid would undermine the fundamental reason agents should thrive here - direct connection to trusted, neutral liquidity infrastructure. Once AI agent applications must hold private keys on a server, their development space shrinks significantly. For Hyperliquid in the coming decade, implementing strategy layers natively on HyperCore is crucial.

Proposal: Add Permission Fields to API Wallet

Building a complete permission strategy layer for the API wallet (including margin limits and market selections) may violate the design principle of HyperCore's minimal state. Therefore, we recommend adopting minimal action-level binary permissions.

Implementation should remain flexible and lightweight - a bitmap can be used to record whether each type of action is allowed to be called by the API wallet, or an equivalent minimal structure can be adopted.

Hyperliquid has already adopted a similar mechanism on HIP-3 deployers. Through setSubDeployers, deployers can grant or revoke permissions for other addresses to call specific perpDeploy variants on their dex at any time - each action is authorized separately and is limited to that action itself.

179491535897190.jpg

The same model can be applied to the API wallet. During transactions, the system retrieves the signer and locates the main account, then checks the permission bits for the corresponding action type to determine if the API wallet is authorized. The new state would only require a bitmap for each API wallet.

The core design principle is: when the network upgrades, the permissions of the API wallet will not automatically expand.

Expected outcomes include:

The API permission scope can be safely extended. Agents requiring relevant permissions can gain staking, withdrawal, and transfer capabilities without compromising the overall security architecture.

Adding new L1 actions or network upgrades will no longer automatically expand the existing API wallet's permission scope. Actions can be added to the API wallet more freely without affecting overall security.

HyperCore accounts can achieve complete programmability without relying on custodial infrastructure. When CoreWriter combines with constrained API wallets, each action can be configured with custom security rules, and will not bring state bloat to HyperCore.

The core advantage of blockchain lies in composability and programmability. Hyperliquid, in its early days, actively reduced programmability in pursuit of performance. The introduction of HyperEVM and CoreWriter aims to supplement HyperCore's programmability with lower resource costs.

The lack of a native, minimal API wallet control layer renders this capability currently incomplete.

免责声明:本文章仅代表作者个人观点,不代表本平台的立场和观点。本文章仅供信息分享,不构成对任何人的任何投资建议。用户与作者之间的任何争议,与本平台无关。如网页中刊载的文章或图片涉及侵权,请提供相关的权利证明和身份证明发送邮件到[email protected],本平台相关工作人员将会进行核查。

Share To
APP

X

Telegram

Facebook

Reddit

CopyLink