Skip to content
Business logic Audit finding Advanced

The deposit function does not check for the maxMint amount

The deposit function checks the deposit amount against maxDeposit but does not check the resulting shares against maxMint. An attacker could theoretically deposit an amount that mints shares exceeding maxMint when the vault is severely under-collateralised.

ni8mare Follow with ni8mare, hals and 1 other

Originally disclosed on Code4rena

Submitted by ni8mare, also found by ni8mare, hals, and shaka

It is theoretically possible for the deposit amount to mint shares more than the maxMint amount

Proof of Concept

The deposit function has a check for maxDeposit and reverts if the deposit value is more than max(uint96). But, it does not check the shares to be less than maxMint amount and hence, bypasses the check. Theoretically, if the assets are equal to max(uint96) and if the vault is under-collateralized, the ratio of _assetUnit to _exchangeRate is greater than or equal to 2, then the calculation in _convertToShares.

Function _assets.mulDiv(_assetUnit, _exchangeRate, _rounding); could return a value more than the maxMint amount. This is possible in scenarios where the _assetUnit is a big enough number (as there is no limit on the decimals of the underlying asset, and _assetUnit = 10 ** super.decimals()) and the Vault is severely under-collateralized.

Recommended Mitigation Steps

Include the maxMint check in the deposit function to prevent this problem.

Assessed type

Invalid Validation

asselstine (PoolTogether) confirmed

PoolTogether mitigated:

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

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


The original report as published on Code4rena, by ni8mare. 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

The deposit function validates the asset amount against maxDeposit but omits a check that the calculated shares do not exceed maxMint.

Impact

The vault could mint more shares than its declared maxMint limit, breaking the expected cap, though the report frames this as theoretical and dependent on severe under-collateralisation.

What the attacker needed

Vault severely under-collateralised; deposit near max(uint96); asset with large decimals

The fix

The deposit function should include a maxMint check; the project later mitigated by fixing 4626 compliance.

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 lets people deposit assets and receive shares in return. The vault has a stated maximum number of shares it will ever mint, but the deposit function only checks the deposit size, not the shares produced. In an extreme situation, a deposit could create more shares than that stated maximum.

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 ni8mare

View all

8 more disclosed reports, 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.