# When users borrow directly from Morpho price of the collateral will not be accurate

Notional Exponent's Morpho oracle misprices collateral when users borrow directly from Morpho with a pending withdrawal request, using yield token value instead of request value.

- Payout: Audit contest
- Severity: high
- Program: Notional
- Found by: mstpr-brainbot
- Disclosed: 2025-06-27
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2025-06-notional-exponent-judging/issues/450
- Library page: https://bugbountylibrary.com/r/sherlock%3A2025-06-notional-exponent%3AH-4
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:sherlock sev:high technique:source-review vuln:accounting-error vuln:oracle-manipulation

**Target:** Morpho lending integration / yield strategy oracle
**Root cause:** The oracle's convertToAssets function checks a transient variable t_currentAccount to detect withdrawal requests, but this variable is only set when borrowing via the lending router. Direct Morpho borrowing bypasses this, causing the oracle to price shares as yield tokens instead of withdrawal request value.
**Steps:**
1. User deposits into a yield strategy and receives shares.
2. User initiates a withdrawal request via lendingRouter.initiateWithdraw, converting shares to a withdrawal request.
3. User borrows directly from Morpho (not via lendingRouter), so t_currentAccount is not set.
4. Morpho oracle calls convertToAssets, which falls back to super.convertToAssets(shares) and prices based on yield token holdings.
5. Oracle price diverges from actual withdrawal request value, mispricing collateral.
**How found:** Code review identified that t_currentAccount is only set in the lending router path, and direct Morpho borrowing skips this, leading to inconsistent pricing.
**Exploitation:** A user with a pending withdrawal request borrows directly from Morpho. The oracle incorrectly values their shares as yield tokens rather than the withdrawal request, potentially allowing over-borrowing or incorrect liquidation.
**Insight:** When integrating with external lending protocols, check for transient state variables that are only set in wrapper functions; direct calls to the external protocol can bypass critical logic.

## Proof of concept (copied exactly from the original report)

**Foundry test showing oracle price inconsistency**

```
// forge test --match-test test_price_Inconsistency -vv
    function test_price_Inconsistency() public {

        console.log("Asset is", IERC20Metadata(address(asset)).symbol());

        address tapir = msg.sender;
        // deal(address(asset), msg.sender, defaultDeposit); 
        _enterPosition(tapir, defaultDeposit, 0);
        uint256 balanceBefore = lendingRouter.balanceOfCollateral(tapir, address(y));

        vm.startPrank(tapir);
        lendingRouter.initiateWithdraw(tapir, address(y), getWithdrawRequestData(tapir, balanceBefore));

        MarketParams memory marketParams = MorphoLendingRouter(address(lendingRouter)).marketParams(address(y));
        Id idx = Id.wrap(keccak256(abi.encode(marketParams)));
        address oracle = marketParams.oracle;

        console.log("Price of the asset is", IOracle(oracle).price());
        console.log("Price of the vault is", y.price(tapir));
    }
```

