totalSupply may exceed LibBasketStorage.basketStorage().maxCap
The joinPool function checks the maximum cap using only the base amount, ignoring the fee that is also minted to the fee beneficiary. An attacker could mint tokens beyond the intended maxCap by joining the pool when fees are enabled.
Submitted by Czar102, also found by gpersoon, gzeon, kenzo, and WatchPug
Impact
Total supply of the token may exceed the maxCap introduced. This can happen when a user wants to join the pool. The check in BasketFacet::joinPool(...) includes only the base amount, without fee. Thus, if fee is on and someone will want to create as many tokens as possible, the totalSupply + _amount will be set to maxCap. The call will succeed, but new tokens were also minted as the fee for bs.feeBeneficiary if bs.entryFee and bs.entryFeeBeneficiaryShare are nonzero. Thus, the number of tokens may exceed maxCap.
Recommended Mitigation Steps
Consider calculating feeAmount and feeBeneficiaryShare before the require(...) statement and check totalSupply.add(_amount).add(feeBanficiaryShare) <= this.getCap().
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
Impact
The total supply of the token could exceed the intended maxCap, potentially diluting value or breaking assumptions.
What the attacker needed
EntryFee and entryFeeBeneficiaryShare are nonzero
The fix
The fee amount and beneficiary share should be calculated before the cap check, and the check should include them.
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 token has a maximum supply limit. When someone adds funds to the pool, the contract checks that the new total won't exceed this limit. However, the check forgets that a fee is also minted as new tokens, so the actual total can go over the limit.
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.