DeFiFoundrySolidity
16,653 OP
View results
Submission Details
Severity: medium
Invalid

maximumExpectedValue bypass in harvest function allows exceeding configured limits

Summary

The harvest function allows processing amounts larger than the configured maximumExpectedValue, potentially bypassing an important safety limit.

Vulnerability Details

In IAlchemist.sol, maximumExpectedValue is defined as a safety parameter but can be bypassed:

struct YieldTokenConfig {
// ...
uint256 maximumExpectedValue; // Should limit maximum value
// ...
}

PoC:

function testMaximumValueBypass() public {
IAlchemist.YieldTokenConfig memory config = IAlchemist.YieldTokenConfig({
adapter: address(1),
maximumLoss: 1000,
maximumExpectedValue: 100e18, // Set low limit
creditUnlockBlocks: 100
});
uint256 harvestAmount = 200e18; // Double the maximumExpectedValue
alchemist.harvest(yieldToken, harvestAmount); // Successfully processes larger amount
}


Impact

  • Safety limits can be bypassed

  • Potential for larger than intended harvests

  • Risk of economic damage due to uncapped operations

Tools Used

  • Foundry

  • Manual Review

Recommendations

1. Add value check in harvest function:

function harvest(address yieldToken, uint256 amount) external {
require(amount <= yieldTokenConfig[yieldToken].maximumExpectedValue, "Amount exceeds maximum");
// ... rest of the function
}
Updates

Appeal created

inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Out of scope

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.