Skip to content

Latest commit

 

History

History
67 lines (44 loc) · 2.23 KB

098.md

File metadata and controls

67 lines (44 loc) · 2.23 KB

Fast Cerulean Armadillo

Medium

Missing Validation Between Strike Price and Strike Percent

Summary

The system's option fee calculation function lacks proper validation between the strikePrice and strikePercent parameters. Users can manipulate these inputs by setting a high strikePercent to reduce the option fee while selecting a low strikePrice to retain most of the collateral's upside potential

Root Cause

The function calculateOptionPrice calculates the fee using strikePercent, while the deposited collateral's valuation is determined by strikePrice. There is no validation ensuring consistency between these two parameters.

  function deposit(
        IBorrowing.BorrowLibDeposit_Params memory libParams,
        IBorrowing.BorrowDepositParams memory params,
        IBorrowing.Interfaces memory interfaces,
        mapping(IBorrowing.AssetName => address assetAddress) storage assetAddress
    ) public returns (uint256) {

//
        // Call calculateOptionPrice in options contract to get options fees
        uint256 optionFees = interfaces.options.calculateOptionPrice(
            libParams.ethPrice,
            params.volatility,
            params.depositingAmount,
            params.strikePercent
        );
//

        // Update the borrower details for this index
        depositDetail.normalizedAmount = uint128(normalizedAmount);
        depositDetail.strikePrice = params.strikePrice * uint128(params.depositingAmount);

}

https://github.com/sherlock-audit/2024-11-autonomint/blob/0d324e04d4c0ca306e1ae4d4c65f0cb9d681751b/Blockchain/Blockchian/contracts/lib/BorrowLib.sol#L674

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

  1. A user selects a high strikePercent, reducing the calculated option fee.
  2. Simultaneously, the user chooses a low strikePrice, securing a higher collateral value.
  3. In a market increase, the user's upside is protected using the low strikePrice.
  4. The user benefits from minimized fees due to the unrelated strikePercent value.

Impact

The protocol could lose significant revenue from reduced fees.

PoC

No response

Mitigation

Implement a validation mechanism to ensure consistency between strikePrice and strikePercent.