Skip to content

Latest commit

 

History

History
94 lines (63 loc) · 3.3 KB

002.md

File metadata and controls

94 lines (63 loc) · 3.3 KB

Dapper Sand Bison

Medium

Inconsistent view modifiers will cause integration issues and failed transactions

Summary

The inconsistent view/non-view modifiers between interfaces and implementations in Strategy and Vault contracts will cause integration issues as external protocols will have incorrect assumptions about state modifications, leading to failed transactions and increased gas costs.

Root Cause

Root Cause: In IStrategy.sol and IVault.sol, the checkPoolActivity() function is declared without the view modifier while the implementation in Strategy.sol is view-only: https://github.com/sherlock-audit/2025-02-yieldoor/blob/main/yieldoor/src/interfaces/IVault.sol#L20 https://github.com/sherlock-audit/2025-02-yieldoor/blob/main/yieldoor/src/interfaces/IStrategy.sol#L29 https://github.com/sherlock-audit/2025-02-yieldoor/blob/main/yieldoor/src/Strategy.sol#L310-L342

Internal Pre-conditions

  1. Protocol must be deployed with the mismatched interface and implementation
  2. External protocol must make state assumptions based on function modifiers

External Pre-conditions

  1. External protocol must integrate with Yieldoor through the provided interfaces
  2. Protocol assumes checkPoolActivity() modifies state based on interface declaration
  3. Protocol implements gas estimation based on non-view function
  4. Transaction fails due to incorrect gas estimation or state modification assumptions
  5. Critical operations like position opening fail due to the interface mismatch:

https://github.com/sherlock-audit/2025-02-yieldoor/blob/main/yieldoor/src/Leverager.sol#L113-L114

Attack Path

  1. External protocol integrates with Yieldoor using IVault interface
  2. Protocol assumes checkPoolActivity() modifies state based on interface declaration
  3. Protocol implements gas estimation based on non-view function
  4. Transaction fails due to incorrect gas estimation or state modification assumptions
  5. Critical operations like position opening fail due to the interface mismatch: https://github.com/sherlock-audit/2025-02-yieldoor/blob/main/yieldoor/src/Leverager.sol#L113-L114

Impact

  • External protocols suffer from failed transactions and increased gas costs
  • Integration failures in critical paths like position opening and liquidation checks
  • No direct fund loss but operational impact on protocol integrations
  • Affects all contracts integrating with Yieldoor through the provided interfaces

PoC

contract VaultIntegrationTest is Test {
    IVault vault;
    
    function testIncorrectStateAssumption() public {
        // Setup vault integration
        vault = IVault(address(0x123));
        
        // This will fail due to incorrect gas estimation
        // as interface suggests state modification
        vm.expectRevert();
        vault.checkPoolActivity();
    }
}

Mitigation

  1. Add view modifier to interface declarations:
interface IStrategy {
    function checkPoolActivity() external view returns (bool);
}

interface IVault {
    function checkPoolActivity() external view returns (bool);
}
  1. Update Vault.sol implementation to match:
function checkPoolActivity() public view returns (bool) {
    return IStrategy(strategy).checkPoolActivity();
}
  1. Document the view-only nature of these functions in interfaces and implementation