Oct 26, 202612 min read

DeFi security due diligence: a vault review

Before a treasury deposits $250,000 into a vault, it needs to know where the money goes, who can change the rules and whether it can withdraw.

JohnnyTimeFounder, Ginger Security

When a trading firm or treasury wants to put money into DeFi, the conversation usually starts with the yield. The harder question comes next: what needs to go right for that money to come back?

In my work with funds, trading firms and institutions, this is where a security review becomes much more than looking for an audit report. I want to understand where the assets go, who can change the rules and what the team can actually do if something goes wrong.

Take a treasury considering a 250,000 USDC deposit into a vault offering 8% annual yield. If that rate holds and USDC stays at $1, that’s around $20,000 over a year before additional fees. It’s an attractive number. But the entire $250,000 is exposed while earning it.

The example vault is Cedar. Dollar figures use USDC at $1, though its market price can differ.

First, where does the money go?

Cedar accepts USDC on Ethereum and lends it to one pool through a strategy contract. The treasury receives vault shares, tokens representing its interest in the vault. To leave, it returns those shares and withdraws USDC, subject to the vault’s rules and available liquidity.

Cedar Vault funds flow: USDC moves from the treasury wallet through the vault and strategy into the lending pool. Withdrawals reverse that path. Vault shares return from the vault to the treasury wallet on deposit.
The wallet holds vault shares, a claim on the position. Custody controls protect the shares, while the underlying USDC remains exposed to the vault and pool.

The treasury will hold the shares in custody. Borrowing against them, bridging them or depositing them elsewhere would add dependencies to this review.

The asset also needs to be identified by its contract address and chain. For USDC, I’d use Circle’s published contract addresses as the starting point. A familiar symbol in a wallet interface isn’t enough to identify the asset being approved.

Before the deposit, the treasury gives the vault a spending allowance. That permission lets the vault transfer approved USDC from the wallet. I’d approve only the next deposit amount, keep unrelated balances elsewhere, and check the remaining allowance after execution. The ERC-20 specification defines allowances and transferFrom, the operation used to spend approved tokens.

Cedar uses ERC-4626, a common interface for tokenized vaults. It gives us standard functions for deposits and withdrawals. We still need to establish what Cedar’s implementation does behind those functions.

The audit looks reassuring. Then I check what it covers.

I’d match the audit’s scope to the code handling the deposit today.

Cedar uses a proxy: the address users interact with forwards execution to a separate implementation contract. An upgrade can change that implementation while leaving the vault address the same. Ethereum’s upgrade documentation explains this arrangement.

Cedar Vault audit coverage: the vault code matches the reviewed deployment, but the new strategy withdrawal path lacks review coverage. Hold deposits.
The withdrawal path is the missing review that stops this deposit. A smaller deposit would leave the same question unanswered.

In our example, the vault code matches the reviewed deployment, but the strategy’s new withdrawal path has no review coverage. If I can’t establish what has been reviewed on the way out, I’m not ready to approve the way in.

For the rest of this example, assume the team has confirmed the following:

  • Deployment: the proxy, implementation, strategy and pool are identified. Verified source and build settings match the deployed code. Initialization and configuration are recorded.
  • Remediation: the previous version’s withdrawal-accounting fix has a documented follow-up review. That review covers the earlier version only.
  • Dependencies: the pool deployment matches its separate review scope. The asset is native USDC with issuer controls. Borrower solvency and redemption rights need separate assessment.

The request is specific: provide a review of the changed withdrawal path, identify the reviewed code revision, and map it to the deployed strategy. Include the findings and confirmation that any fixes were checked.

Keep the original reports and this mapping against a deployment snapshot: chain ID, finalized block number and hash, exact addresses, code hashes and capture time. For an ERC-1967 proxy, inspect the relevant implementation or beacon storage slot as well as the upgrade authority. A beacon is a contract that supplies the implementation address. The ERC-1967 specification defines these slots and related events.

Who can change the rules after we deposit?

A clean review of today’s code doesn’t stop an authorized administrator from replacing it tomorrow. A withdrawal that works today could behave differently after an upgrade.

Cedar has a 48-hour timelock for upgrades. Covered changes must wait before execution. That gives the treasury a response window, provided the team detects the proposal and can withdraw in time. I’d inspect who can schedule and execute changes, who can grant those permissions, and whether another route bypasses the delay. OpenZeppelin’s access-control documentation describes these roles.

Power Cedar’s configuration Exposure for the treasury
Upgrade the vault or replace the strategy A protocol wallet needs three of five signers to propose a change through the 48-hour timelock. The timelock controls upgrades and its own administration. No immediate upgrade path is present. Once the delay expires, new code could redirect or take deposited funds.
Pause activity A separate wallet needs two of three signers to stop deposits and new strategy allocations. Current code leaves withdrawals available. Resuming allocations requires the delayed controller. Existing pool positions remain exposed. A later implementation could change withdrawal behavior.
Redirect funds or rescue tokens The current strategy moves USDC only between the vault and the recorded pool. Its rescue function excludes USDC, vault shares and the pool position token. Changing the pool or recipient requires the timelock. Confirm the restrictions in code and tests. They can be replaced by an upgrade.
Withdraw from treasury custody The treasury wallet requires two of three signers. Its signing policy permits withdrawal only to that wallet. No execution module or delegate is enabled. Signer compromise or a policy change can defeat custody restrictions. Record which controls are enforced by the custody system and which depend on written procedures.
Change a dependency The pool has its own upgrade controller with a 24-hour delay. USDC has issuer controls, including address blocklisting. Cedar’s 48-hour delay doesn’t apply to either dependency. A blocked address can be unable to send or receive USDC.

For a multisignature wallet, check execution paths as well as owners and signing thresholds. Safe modules, for example, can execute transactions through their own authorization logic. A two-of-three label doesn’t describe every possible permission.

USDC’s issuer controls belong in the review because they affect the exit. Circle explains the circumstances and effects of address restrictions in its blocklisting documentation. The vault’s own pause settings cannot override a restriction at the asset level.

We have 48 hours. Can we actually get out?

If the missing strategy review is completed, the treasury would consider a $25,000 pilot position. Cedar permits withdrawals of up to 40,000 USDC across all users per rolling 24 hours, subject to pool liquidity. At first glance, that looks like enough room for the treasury to exit.

But the limit is shared. If other users have already withdrawn 32,000 USDC, only 8,000 USDC of capacity remains. Our treasury could be left with 17,000 USDC still exposed, even if it reacts immediately. Other depositors can consume the withdrawal capacity before our transaction executes.

A $25,000 Cedar Vault position has $8,000 available to exit and $17,000 still exposed after other users consume $32,000 of the shared $40,000 withdrawal limit.
A 48-hour upgrade delay reserves no exit capacity. Here, $17,000 stays exposed until capacity and liquidity become available.

The exit review also needs to establish what happens in these states:

  • Under normal liquidity, a 1,000 USDC deposit returns shares and a full withdrawal returns funds to custody. Record fees, shares burned and the balance recovered.
  • With deposits paused, new deposits fail while withdrawals remain available under the current implementation. Establish the reason for the pause before considering a restart.
  • With pool liquidity exhausted or the vault or pool address blocked from transferring USDC, withdrawal fails. Escalate the remaining exposure and retain the transaction record. There is no separate escape route around the pool or the token’s controls.

For an ERC-4626 vault, check maxWithdraw(owner) alongside a withdrawal preview. maxWithdraw must account for applicable limits. previewWithdraw estimates the shares required and must ignore those limits. A quote can exist when the actual withdrawal is unavailable. These are distinct requirements in ERC-4626.

The exit procedure also needs to work without the protocol’s website. Use the reviewed contract interface, return assets to the existing custody wallet, and have gas and enough available signers to execute. After a partial withdrawal, check transaction state and remaining capacity before retrying.

Which tools help with the deposit decision?

I’d choose tools around the unanswered questions: which code is running, where the position is exposed and whether this treasury can withdraw. They provide different inputs to the decision.

Tool or system Where it helps What I would verify
Foundry Cast Reading implementation, strategy and permissions Query the same chain and block with the correct ABI. Cross-check critical values against another trusted node.
Sourcify Comparing published source and compilation output Inspect the match type and account for libraries and immutables. Then trace that source to the report scope.
Tenderly Simulator Testing the intended deposit and exit Use the actual wallet and proposed amount. Inspect balance changes and liquidity assumptions.

For supported vaults, the JohnnyTime checker helps collect the first pass. I’d use Cast when a custom permission or adapter needs closer inspection. Sourcify answers the source-matching question, and a simulation helps examine a particular transaction.

The integration reviewer still owns the conclusions and unresolved checks. I’d preserve the inputs and rerun affected tests after a strategy or implementation change. This shortlist follows tool documentation, without a commercial-product benchmark.

Would I approve the deposit?

Suppose the supplemental review arrives. It covers the new withdrawal path and maps the exact deployed strategy code to the reviewed revision. Findings have documented resolutions. The security reviewer checks the mapping against a fresh deployment snapshot.

I’d then consider a $25,000 pilot. The smaller amount sets the exposure we’re willing to accept while the treasury exercises its controls, after completing the checks described above.

Before any deposit, the treasury team must demonstrate the custody restrictions. The monitoring owner must demonstrate alert delivery and rehearse the exit. The security reviewer must confirm the current code and permissions. Whoever accepts the exposure must acknowledge in writing that the entire pilot could be lost or become inaccessible. The separate investment, legal and credit approvals must also be complete.

The first permitted deposit would be 1,000 USDC, followed by a full withdrawal back to custody. Only after full recovery and balance reconciliation would deposits increase toward the pilot cap. A failed round trip would suspend that permission and reopen the review.

For this pilot, the operating limits would be:

Control Limit or requirement
Aggregate position across treasury wallets 25,000 USDC, including accrued yield. Stop new deposits above the cap.
Total deposits during the pilot 25,000 USDC, including the initial test. A withdrawal doesn’t reset this allowance.
Deposit rate No more than 10,000 USDC per rolling 24 hours. This does not restrict emergency withdrawals.
Treasury wallet Only the allocated USDC and enough ETH for fees. No share approvals or use as collateral elsewhere.
Transaction approval Restrict the chain, asset, vault and functions. Check the spender and receiver. Simulate each deposit and have a second person compare the decoded transaction data with the intended action.
Review expiry 30 days, or sooner if a change or incident triggers another review.

The plan needs someone ready to act

For Cedar, I’d monitor scheduled upgrades, implementation changes, roles, pauses and dependencies. Compare current code identities, allowances, position value and withdrawal capacity with the approved state every five minutes. A missed check must alert too.

The example requires acknowledgment within 15 minutes by a named person, with a backup. Rehearse the response outside normal working hours.

Cedar Vault emergency exit: a scheduled upgrade becomes eligible after 48 hours. Alert the team, prepare signers and attempt withdrawal. Available capacity and liquidity allow USDC to return to custody. A limited or blocked exit leaves the remaining funds exposed.
The 48-hour delay creates a response window. It guarantees neither available liquidity nor a complete withdrawal.

New deposits stop immediately after a code, authority, custody-policy or dependency change. A failed exit, unexplained accounting difference, credible vulnerability report or loss of monitoring also reopens the decision. Follow the exit procedure where possible and record what remains exposed. Restoring deposits requires a new recorded approval.

What this review can and can’t answer

Even with the pilot controls in place, we haven’t established how much liquidity will be available during a market shock or ruled out a later signer compromise. Those are remaining risks to record and accept. An unidentified administrator or unexplained code change would instead leave the review incomplete and block new deposits.

Before increasing the allocation, changing strategy or using the shares elsewhere, reopen the review. Record what changed, which checks support the new position and who accepts the remaining risk.

Try this on your next integration

Download the blank DeFi security review template. Use it to record the contracts, missing information and decision conditions for the position you’re considering.

Discuss a DeFi security review

We can define the scope around your planned interaction and the decision you need to make.

Explore the service