Trade-only keys on two perp DEXs still moved millions in November. What a trading key can do, and my checks before an AI agent gets one.

Photo by FlyD on Unsplash

At 10:11 UTC on Monday, November 16, a wallet pulled $10.39 million in USDC out of Lighter, a perpetual futures exchange that settles on Ethereum. Lighter’s first public post about it came at 11:02 UTC, when it paused all withdrawals.

Lighter’s smart contracts held up fine. The attacker used one trader’s API key, and that key had no permission to withdraw to anyone else’s wallet. Lighter says so plainly in its post-mortem: “Withdrawals only ever go to the account owner’s own wallet.”

A few days earlier, on November 13 (Beijing time), a trader on Aster, another perp DEX, says they watched 4,564,675.50 USDT leave their account in seven transfers over 44 minutes. The transfers were signed by a browser-generated agent key that, by the trader’s account, had no withdrawal permission either. Aster’s CEO confirmed on November 17 that the user’s “API Wallet private key was compromised.”

I’ve written before that withdrawals stay off on any bot key, always. I still think that. What these two weeks taught me is how much a key can do with withdrawals off, and I’d rather work that out now, because trading keys like these are exactly what we are starting to hand to AI agents.

Why this matters for AI agents

Look at who these keys are being built for. Lighter’s post-mortem has a line addressed to people who “trade programmatically or run agents on Lighter,” and its list of official SDKs includes an Agent Kit. On November 11, Coinbase rolled out Agent Controls for Coinbase for Agents, its MCP server for trading through your own AI agent. On November 23, Anchorage Digital announced a pilot in which an AI agent pays for market data over x402 and trades BTC perpetual futures on Hyperliquid from a self-custody wallet.

On a venue like Hyperliquid, the usual way to let software trade for you is an API wallet, also called an agent wallet. The docs describe it simply: a master account approves an API wallet “to sign on behalf of the master account or any of the sub-accounts.” Your main key doesn’t have to sign every order. The agent key does the routine signing.

That’s a sensible design, and the November incidents don’t break it. They show where its edges are. A wallet company, imToken, put it this way in a long post on November 27: risk is “rapidly spreading” into the systems around on-chain assets, “including browser front ends, software supply chains, delegated API credentials, and AI Agent authorization layers.”

Door one: “your own” accounts

Here is how Lighter says the money left, step by step, from its post-mortem.

An API key on Lighter can send funds to its own account’s sub-accounts. A public pool that the account creates counts as one of those. A public pool is a vault where other people can buy shares while the account’s operator trades. So the attacker, holding the stolen key:

created a public pool from the victim’s account,minted pool shares from a separate account the attacker controlled,transferred the victim’s funds into the pool, which raised the pool’s value without creating new shares,redeemed the attacker’s shares and withdrew.

Each step was something the key was allowed to do. The stolen key never had to sign a withdrawal; the attacker withdrew from its own account. The Defiant summed up the mechanism well: the attacker’s pool “counted as the trader’s own sub-account, so the stolen key could fill it.”

Lighter’s Guardian safeguard paused withdrawals and its Security Council returned about 5 million USDC to the trader. Withdrawals were back to normal later that day, according to Unchained and The Defiant. Lighter never published a total loss. An on-chain researcher, 0xTria, put it at about $15.5 million across two market-maker accounts, a figure Lighter has not confirmed.

The lesson I take from this one is about vocabulary. Permission screens are written in the exchange’s terms: trade, transfer, withdraw. An attacker thinks in terms of where the money can end up. Any internal action that can route value toward an account someone else can touch is, for practical purposes, a withdrawal.

Door two: trading against you

The Lighter post-mortem has a short section I’d print out for anyone running a bot. It’s titled “What else a leaked key could be used for,” and the first item is “Trading against you”: someone holding your key places orders from your account “that trade against their own orders at bad prices, moving value from you to them.” It “works best in thinly traded markets.” The second is opening large or highly leveraged positions, “exposing it to heavy losses or liquidation.”

No exotic route is needed for this. A key that can trade can lose your money by trading.

The HyprEarn case on Hyperliquid fits here. On November 14, HyprEarn posted a security notice about “unauthorized trades on a small number of Hyperliquid accounts” that had approved its agent wallet. It wrote: “Agent wallets can’t withdraw or send funds to another address. They can place trades, which is why revoking matters.” It hasn’t said how many accounts were hit or how much they lost, and neither will I.

The Aster case may belong here too, or somewhere worse. Before the transfers, according to the trader, 33 BTC were moved between futures and spot nine times and sold through 17 market orders. The trader also says their privacy settings blocked internal transfers to other users, yet the USDT went to a newly registered account. As of Pakt’s November 23 write-up, how the key leaked, and how it could fund a stranger’s account, was not public. I’d treat the Aster details as one user’s account until Aster publishes its own.

Door three: the field nobody checked

The same Monday, a Safe smart-account wallet lost about $6.4 million through its Zodiac Roles module, which lets bots and service providers make preset calls on a Safe’s behalf. The Defiant cites analyst disco_trooper: the role checked who received a trade’s output but left the executor field unchecked, and the attacker put its own wallet there.

That’s the same idea at the smart-contract level. A permission that looks narrow (“this bot may only swap”) has many fields, and any field that can point at an address is a place money can leave from. By The Defiant’s count, about $16.8 million of the roughly $20.5 million taken in four incidents that weekend went out through access the owners had granted to software.

The word “nonce” means two opposite things

This is the part that worries me most for people who write their own trading code, or ask an AI assistant to write it for them.

Lighter’s keys leaked because the trader’s own signing code, written outside Lighter’s official SDKs, reused signing nonces. In Lighter’s words, each signature uses “a one-off random value called a nonce, which must be unique and unpredictable every time.” Signatures are public, so “if the same nonce is used with the same key to sign two different transactions, anyone can calculate the private key.” Lighter notes the same is true of Bitcoin and Ethereum signatures. Its advice is to never derive this nonce “from a timestamp, a counter, a weakly seeded random number generator, the transaction’s contents or a cached value.”

Now open Hyperliquid’s API docs. There, “nonce” means something else: a replay-protection number attached to each action. For that one, the docs recommend “an atomic counter,” and the approve-agent request asks for the “current timestamp in milliseconds.”

Both docs are correct about their own nonce. But one says to use a timestamp or counter, and the other says a timestamp or counter is exactly what you must never use. A developer skimming both, or a coding assistant asked to “just write a signer,” can easily blur them. I don’t know who or what wrote the Lighter trader’s signing code, and nobody has said. I do know I wouldn’t let any model write a signer for me from scratch. The official SDKs exist for this, and Lighter says its own “generate every nonce with a cryptographically secure random number generator.”

An app-side revoke leaves the on-chain approval

One line from HyprEarn’s notice deserves more attention than it got: “The old agent stays approved on your Hyperliquid account until you remove it.”

HyprEarn had revoked its old agent wallets on its side. That didn’t remove the approval stored on the user’s Hyperliquid account. Users had to go and revoke it themselves. If you have ever clicked “Enable Trading” on a third-party front end, that approval may still be sitting there.

Hyperliquid’s exchange docs show the limits: an account can have one unnamed API wallet and up to three named ones, plus two more named agents per sub-account, and a named agent can carry an expiry of at most 180 days. That’s a small enough list to audit by hand, and an expiry you can actually set.

Where the limit has to live

Every fix I’ve cited here moves the limit out of the bot and into something the bot can’t edit.

Lighter now requires a wallet signature to transfer funds into a public pool and has made API key signatures non-public. It says IP allowlists, per-key limits on actions and markets, and monitoring for nonce reuse are coming.

Coinbase’s Agent Controls run, in its words, “on Coinbase’s servers, not inside your agent, so your agent can’t bypass them.” They cover a maximum trade size, a 24-hour volume cap and an auto-stop when the portfolio falls by a set percentage. Those map neatly onto “trading against you” and “risky positions.” With Coinbase’s own example settings, $100 per trade and $1,000 a day, a thief holding your key can’t do much.

A separate Coinbase post on November 19 makes the underlying point better than I can: on a blockchain the network only checks for a valid signature, and “the network doesn’t check whether the transfer is what the customer meant.”

Pakt, the company in the Anchorage pilot, argues for putting the policy check at the moment of signing. In its November 23 write-up of the Lighter and Aster cases, it says “a permission flag answers ‘can this key call withdraw?’” while a policy asks whether the key can “move the whole account to an address I have never seen.” Pakt sells that kind of signer, so read its claim that it could have prevented both thefts as a pitch. The distinction itself holds up, and it’s the most useful sentence I read on these incidents.

What I’d check before an agent gets a trading key

This is my own list, built from the incidents above. It sits on top of the basics (withdrawals off, IP lock, one key per bot), not in place of them.

List every action the key can sign, not just the ones you plan to use. Internal transfers, sub-account funding, vault or pool creation, leverage changes. For each one, ask where the money could end up.Assume a leaked trading key will be used to trade against you. Keep agent funds in their own sub-account sized to what you can lose, and avoid letting an agent hold keys on thin markets you don’t need.Put size, volume and loss limits where the agent can’t reach them, on the venue’s side if it offers them, or in a signer the agent can’t modify.Never hand-roll signing code. Use the venue’s official SDK. If you or an assistant ever wrote your own signer, rotate the keys.Audit and revoke approvals on the venue itself, not only in the app that created them. Set expiries where the venue allows it.Watch for the first odd action, not the last withdrawal. In Lighter’s case, nearly an hour passed between the withdrawal and the first public notice. A pool you didn’t create or a transfer to a sub-account you don’t recognize is the alarm.

None of this makes an agent safe. It makes a leaked key smaller, and that’s the part of the problem you actually control.

Sources (all opened November 28, 2026)

Lighter (@Lighter_xyz), “Signing Safely on Lighter: Lessons from November 16,” X article posted November 16, 2026, 18:20 UTC. https://x.com/Lighter_xyz/status/2122394446343946717

Unchained (David Okoya, ed.), “Lighter Pins Drain on Trader’s Leaked API Key as Sleuths Say $15M Lost,” published November 16, 2026. https://unchainedcrypto.com/lighter-pins-drain-on-traders-leaked-api-key-says-contracts-were-not-hit/

Unchained, “Lighter Reopens Withdrawals, Hands 5 Million USDC Back to Drained Trader,” published November 17, 2026. https://unchainedcrypto.com/lighter-reopens-withdrawals-hands-5-million-usdc-back-to-drained-trader/

The Defiant (Camila Russo), “Lighter and a Safe Wallet Lose $16.8M Through Granted Access,” newsletter of November 16, 2026. https://thedefiant.io/newsletter/defi-daily/most-of-the-weekends-crypto-losses-used-granted-access

crypto.news (Olivia Stephanie), “Aster strengthens security after API Wallet leak and reported $4.56M loss,” published November 17, 2026. https://crypto.news/aster-api-wallet-private-key-leak-security-response/

HyprEarn (@HyprEarn), security notice on X, posted November 14, 2026. https://x.com/HyprEarn/status/2121673806704243178

Hyperliquid documentation, “Nonces and API wallets.” https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/nonces-and-api-wallets

Hyperliquid documentation, “Exchange endpoint” (Approve an API wallet). https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint

Coinbase, “Coinbase for Agents introduces new Agent Controls,” published November 11, 2026. https://www.coinbase.com/blog/agent-controls

Coinbase, “Coinbase Security Proof of Work: A valid signature isn’t the whole story,” published November 19, 2026. https://www.coinbase.com/blog/coinbase-security-proof-of-work-a-valid-signature-isnt-the-whole-story

Anchorage Digital, “Anchorage Digital and Pakt Pilot Verifiable Guardrails for AI Agents,” published November 23, 2026. https://www.anchorage.com/insights/anchorage-digital-and-pakt-pilot-verifiable-guardrails-for-ai-agents

Pakt (Nick Campion), “Lighter and Aster: Trade-Only API Keys Still Emptied Two Accounts,” published November 23, 2026 (vendor analysis). https://usepakt.ai/learn/lighter-aster-api-key-incidents

imToken (@imTokenOfficial), X article on crypto’s shifting attack surface, posted November 27, 2026. https://x.com/imTokenOfficial/status/2126262364945432731

I’m Mojtaba. I write about AI and how it’s changing the way people work, invest and trade. Nothing here is investment, legal or financial advice. Every figure above links to its source; if you spot an error, tell me and I’ll fix it.

Research and drafting were assisted by AI tools. All sources were checked and the views are my own.

The Keys Couldn’t Withdraw. The Money Left Anyway. was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.

By

Leave a Reply

Your email address will not be published. Required fields are marked *