Skip to content
Business logic Audit finding Intermediate

Vault does not conform to ERC4626

The Vault's maxDeposit and maxMint functions return a fixed maximum that ignores the limits of the external yield vault, so they can report a higher maximum than the vault would actually accept. This could break external integrations that rely on these functions to determine deposit limits.

degensec Follow with pontifex

Originally disclosed on Code4rena

Submitted by degensec, also found by pontifex

Lines of code

https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L375-L377 https://github.com/GenerationSoftware/pt-v5-vault/blob/b1deb5d494c25f885c34c83f014c8a855c5e2749/src/Vault.sol#L383-L385

Impact

Vault does not conform to ERC4626 which may break external integrations.

Proof of Concept

The ERC4626 specification states that maxDeposit MUST return the maximum amount of assets deposit would allow to be deposited for receiver and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted.

Similarly, maxMint MUST return the maximum amount of shares mint would allow to be deposited to receiver and not cause a revert, which MUST NOT be higher than the actual maximum that would be accepted.

The PoolTogether V5 Vault connects to an external ERC4626-compliant Vault (_yieldVault) and deposits incoming assets in it. This means, that maxDeposit and maxMint of the PoolTogether Vault must be constrained by the maxDeposit and maxMint of the external Vault.

Tools Used

ERC-4626: Tokenized Vaults

Recommended Mitigation Steps

Replace the implementation of maxDeposit:

  function maxDeposit(address) public view virtual override returns (uint256) {
    return _isVaultCollateralized() ? `type(uint96).max` : 0;
  }

with:

  function maxDeposit(address receiver) public view virtual override returns (uint256) {
    if (!_isVaultCollateralized()) return 0;

    uint256 yvMaxDeposit = _yieldVault.maxDeposit(receiver);
    return yvMaxDeposit < `type(uint96).max` ? yvMaxDeposit : `type(uint96).max`;
  }

Analogously, change the implementation of maxMint from:

  function maxMint(address) public view virtual override returns (uint256) {
    return _isVaultCollateralized() ? `type(uint96).max` : 0;
  }

to:

  function maxMint(address receiver) public view virtual override returns (uint256) {
    if(!_isVaultCollateralized()) return 0;

    uint256 yvMaxMint = _yieldVault.maxDeposit(receiver);
    return yvMaxMint < `type(uint96).max` ? yvMaxMint : `type(uint96).max`;
  }

Assessed type

ERC4626

asselstine (PoolTogether) confirmed

PoolTogether mitigated:

Fixed compliance with 4626. PR: https://github.com/GenerationSoftware/pt-v5-vault/pull/11

Status: Mitigation confirmed. Full details in report from 0xStalin, dirk_y and rvierdiiev.


The original report as published on Code4rena, by degensec. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the maxDeposit and maxMint functions return a constant maximum instead of checking the external yield vault's limits.

Impact

External integrations that rely on maxDeposit or maxMint could break because the reported maximum may be higher than what the vault actually accepts.

What the attacker needed

None

The fix

The implementation was changed to return the minimum of the external yield vault's limit and the vault's own cap, and the project confirmed the mitigation.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A vault is a smart contract that holds money for users. The ERC4626 standard says a vault must honestly report the largest amount a user can deposit or mint. Here the vault reported a huge number even though the underlying vault might accept less, which could confuse other programs that use it.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by degensec

View all

1 more disclosed report, best first.

More from PoolTogether

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.