Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: high
Invalid

[H-2] ZlpVault::updateAssetAllowance Unlimited ERC20 Approval to MarketMakingEngine Enables Total Fund Drain

Summary

The zlpVault::updateAssetAllowance function grants unlimited token approval to the privileged MarketMakingEngine, creating a single point of failure for catastrophic fund loss. If the MarketMakingEngine is compromised, an attacker can drain all vault assets in one transaction.

Vulnerability Details

Affected Code:

function updateAssetAllowance(uint256 amount) external onlyMarketMakingEngine {
IERC20(asset()).approve(msg.sender, amount);

}

The onlyMarketMakingEngine modifier restricts this function to the MarketMakingEngine contract. However, if this contract is compromised (e.g., via a private key leak or reentrancy exploit), an attacker can:

  1. Call updateAssetAllowance(type(uint256).max) to grant unlimited approval.

  2. Call transferFrom on the vault’s asset to drain all funds.

Exploit Scenario:

  1. Attacker compromises the MarketMakingEngine contract.

  2. Calls updateAssetAllowance(type(uint256).max) to grant unlimited approval.

  3. Calls transferFrom(ZlpVault.address, attacker.address, totalAssets()) to drain all funds.

Impact

High Impact: All vault assets (LSTs/LRTs) can be stolen in one transaction.

High Likelihood: High-value protocols are prime targets for infrastructure compromise.

High Risk: Immediate and irreversible loss of LP funds.

Tools Used

Manual Review, foundry

Recommendations

  1. Remove updateAssetAllowance and set fixed approvals during initialization. Example:

IERC20(asset()).approve(marketMakingEngine, MAX_ALLOWANCE);

Implement a pull-based allowance system (e.g., permit safe increaseAllowance calls by LPs).

  1. Use a whitelist for approved spenders.

  2. Additional Context:
    Unlimited approvals are a common anti-pattern in DeFi. They introduce unnecessary risk and should be avoided unless absolutely necessary.

Updates

Lead Judging Commences

inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.