Incorrect Minimum Lots Validation in CoreVault Redemption
The redeemFromCoreVault function incorrectly lowers the minimum redemption lots requirement when the core vault has fewer available lots than the configured minimum. This allows a redeemer to create a redemption request with fewer lots than the intended minimum.
- Disclosed after under an hour
#46122 [SC-Insight] Incorrect Minimum Lots Validation in CoreVault Redemption
Submitted on May 25th 2025 at 07:18:51 UTC by @aman for Audit Comp | Flare | FAssets
- Report ID: #46122
- Report Type: Smart Contract
- Report severity: Insight
- Target: https://github.com/flare-foundation/fassets/blob/main/contracts/assetManager/library/CoreVault.sol
- Impacts:
- Contract fails to deliver promised returns, but doesn't lose value
Description
Brief/Intro
The redeemFromCoreVault function in CoreVault.sol incorrectly validates the minimum lots requirement when the available lots in the core vault are less than the coreVaultMinimumRedeemLots setting. This allows redeemers to create redemption requests with fewer lots than the minimum requirement.
Vulnerability Details
The vulnerable code is in CoreVault.sol:
function redeemFromCoreVault(
uint64 _lots,
string memory _redeemerUnderlyingAddress
)
internal
onlyEnabled
{
State storage state = getState();
require(state.coreVaultManager.isDestinationAddressAllowed(_redeemerUnderlyingAddress),
"underlying address not allowed by core vault");
AssetManagerSettings.Data storage settings = Globals.getSettings();
uint64 availableLots = getCoreVaultAmountLots();
uint64 minimumRedeemLots = SafeMath64.min64(state.minimumRedeemLots, availableLots);
require(_lots >= minimumRedeemLots, "requested amount too small");
// ... rest of the function
}
The issue is that the code:
- Gets the available lots in the core vault
- Sets
minimumRedeemLotsas the minimum ofstate.minimumRedeemLotsandavailableLots - This means if
availableLotsis less thanminimumRedeemLots, the requirement is lowered - This contradicts the documentation which states that lots must be larger than
coreVaultMinimumRedeemLots
Impact Details
- Impact: Allows redemption requests with fewer lots than the minimum requirement
- Likelihood: Low - Only occurs when core vault has insufficient funds
References
- File:
contracts/assetManager/library/CoreVault.sol - Function:
redeemFromCoreVault
Recommendations
- Fix the minimum lots validation to always enforce the minimum requirement:
function redeemFromCoreVault(
uint64 _lots,
string memory _redeemerUnderlyingAddress
)
internal
onlyEnabled
{
State storage state = getState();
require(state.coreVaultManager.isDestinationAddressAllowed(_redeemerUnderlyingAddress),
"underlying address not allowed by core vault");
require(_lots >= state.minimumRedeemLots, "requested amount too small");
uint64 availableLots = getCoreVaultAmountLots();
require(_lots <= availableLots, "not enough available on core vault");
// ... rest of the function
}
Proof of Concept
Proof of Concept
Add the Following test Case to CoreVault.ts :
it.only("request direct redemption from core vault less than min Redeem lots", async () => { // @audit-issue : redeem less than min lots
const agent = await Agent.createTest(context, agentOwner1, underlyingAgent1);
const minter = await Minter.createTest(context, minterAddress1, underlyingMinter1, context.underlyingAmount(10000000));
const redeemer = await Redeemer.create(context, redeemerAddress1, underlyingRedeemer1);
await prefundCoreVault(minter.underlyingAddress, 1e6);
// allow CV manager addresses
await coreVaultManager.addAllowedDestinationAddresses([redeemer.underlyingAddress], { from: governance });
// make agent available
await agent.depositCollateralLotsAndMakeAvailable(100);
// mint
const [minted] = await minter.performMinting(agent.vaultAddress, 2);
await minter.transferFAsset(redeemer.address, minted.mintedAmountUBA);
// agent requests transfer for some backing to core vault
const transferAmount = context.convertLotsToUBA(2);
await agent.transferToCoreVault(transferAmount);
let res = await context.assetManager.setCoreVaultMinimumRedeemLots(3, { from: context.governance });
expectEvent(res, "SettingChanged", { name: "coreVaultMinimumRedeemLots", value: "3" })
const minLots = await context.assetManager.getCoreVaultMinimumRedeemLots();
assertWeb3Equal(minLots, 3);
const lots = 2;
// redeemer requests direct redemption from CV
const [paymentAmount1, paymentReference1] = await testRedeemFromCV(redeemer, lots);
const trigRes = await coreVaultManager.triggerInstructions({ from: triggeringAccount });
const paymentReqs = filterEvents(trigRes, "PaymentInstructions");
assertWeb3Equal(paymentReqs[0].args.account, coreVaultUnderlyingAddress);
assertWeb3Equal(paymentReqs[0].args.destination, redeemer.underlyingAddress);
assertWeb3Equal(paymentReqs[0].args.amount, paymentAmount1);
expect(toBN(minLots).gt(toBN(lots))).to.be.true;
});
Run with command yarn testHH.
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 code sets the minimum redeem lots to the smaller of the configured minimum and the available lots, instead of always using the configured minimum.
Impact
The contract fails to enforce the documented minimum redemption lots, allowing smaller redemptions when the core vault has insufficient funds, but no direct loss of value is claimed.
What the attacker needed
Core vault has fewer lots than the minimum; redeemer has FAssets to redeem
The fix
The minimum lots validation should always enforce the configured minimum, and a separate check should ensure the requested lots do not exceed available lots.
How it was found
- Deploy and set up an agent, minter, and redeemer, and prefund the core vault.
- Allow the redeemer's underlying address as a destination.
- Make the agent available and mint some FAssets, then transfer them to the redeemer.
- Have the agent transfer some backing to the core vault.
- Set the core vault minimum redeem lots to 3.
- Request a redemption of 2 lots from the core vault and observe it succeeds despite being below the minimum.
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 smart contract function is supposed to enforce a minimum number of 'lots' (a unit of asset) when someone redeems from a core vault. Because of a mistake, if the vault has fewer lots than that minimum, the check is weakened and a smaller redemption is allowed. This breaks the intended rule but does not directly steal funds.
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.