FraxlendPair.sol is not fully EIP-4626 compliant
The contract's maxDeposit and maxMint functions always return a fixed maximum value, even when the contract is paused and deposits and mints are disabled. This breaks the EIP-4626 standard, which could break composability with other contracts and potentially lead to loss of funds.
Submitted by 0x52, also found by berndartmueller, cryptphi, and Lambda
Impact
FraxlendPair.sol is not EIP-4626 compliant, variation from the standard could break composability and potentially lead to loss of funds.
Proof of Concept
According to EIP-4626 method specifications (https://eips.ethereum.org/EIPS/eip-4626)
For maxDeposit:
MUST factor in both global and user-specific limits, like if deposits are entirely disabled (even temporarily) it MUST return 0.
For maxMint:
MUST factor in both global and user-specific limits, like if mints are entirely disabled (even temporarily) it MUST return 0.
When FraxlendPair.sol is paused, deposit and mint are both disabled. This means that maxMint and maxDeposit should return 0 when the contract is paused.
The current implementations of maxMint and maxDeposit do not follow this specification:
function maxDeposit(address) external pure returns (uint256) {
return type(uint128).max;
}
function maxMint(address) external pure returns (uint256) {
return type(uint128).max;
}
No matter the state of the contract they always return uint128.max, but they should return 0 when the contract is paused.
Recommended Mitigation Steps
maxDeposit and maxMint should be updated to return 0 when contract is paused. Use of the whenNotPaused modifier is not appropriate because that would cause a revert and maxDeposit and maxMint should never revert according to EIP-4626.
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 maxDeposit and maxMint functions are hardcoded to return a constant maximum and do not check whether the contract is paused.
Impact
Because the reported limits do not reflect the paused state, integrations relying on the standard could misbehave, which could break composability and potentially lead to loss of funds.
What the attacker needed
Contract is paused
The fix
The functions should be updated to return zero when the contract is paused, without reverting, since EIP-4626 requires these functions never to revert.
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.
This is a smart contract that follows a token standard called EIP-4626, which defines how deposit and withdrawal vaults should behave. The standard says that when deposits are switched off, the functions that report the maximum allowed deposit must report zero. Here they always report a huge number, so other contracts reading that value would wrongly think deposits are still possible.
What is Smart contracts?
Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.