# Function refinanceFromLoanExecutionData() does not check executionData.tokenId == loan.nftCollateralTokenId

Gondi's refinanceFromLoanExecutionData passes executionData.tokenId to offer validation instead of loan.nftCollateralTokenId, letting a borrower refinance against a different NFT than the lender's offer approved.

- Payout: Audit contest
- Severity: high
- Program: Gondi
- Found by: minhquanym
- Disclosed: 2024-07-25
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2024-04-gondi-findings/issues/54
- Library page: https://bugbountylibrary.com/r/c4%3A2024-04-gondi%3AH-04
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:access-control vuln:business-logic

**Target:** Gondi lending protocol refinance function (Solidity contract)
**Root cause:** refinanceFromLoanExecutionData forwards executionData.tokenId into _processOffersFromExecutionData/_checkValidators instead of the escrowed loan.nftCollateralTokenId, so offer validation checks a tokenId unrelated to the collateral actually held.
**Steps:**
1. Call `refinanceFromLoanExecutionData()` with `executionData.tokenId` set to an NFT id accepted by the outstanding lender offers.
2. The escrowed collateral remains `loan.nftCollateralTokenId`, which differs from the validated tokenId.
3. `_checkValidators` validates offers against `executionData.tokenId`, so offers pass despite not approving the real collateral.
4. New loan is emitted with mismatched collateral vs. what lenders signed for.
**How found:** Code reading of the refinance path: noticed executionData.tokenId is passed to _processOffersFromExecutionData rather than loan.nftCollateralTokenId, then traced into _checkValidators to confirm the mismatch bypasses lender collateral checks.
**Exploitation:** Borrower refinances an existing loan using offers whose collateral requirements are satisfied by a chosen valid tokenId, while the actual escrowed NFT (loan.nftCollateralTokenId) is a different, unapproved asset — lenders end up backing a loan collateralized by an NFT they never agreed to.
**Insight:** In refinance/renew flows that reuse escrowed collateral, verify the identifier fed into offer validation is the stored collateral id, not a caller-supplied field — the two diverge exactly where the NFT is never re-transferred.

