# A malicious user can take on a loan using an existing borrower's collateral in refinanceFromLoanExecutionData()

refinanceFromLoanExecutionData lacks borrower and tokenId checks, letting attacker B refinance using victim A's collateral and lock it.

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

**Target:** MultiSourceLoan.sol refinanceFromLoanExecutionData()
**Root cause:** _validateExecutionData skips the executionData borrower signature check when msg.sender != _loan.borrower, and refinanceFromLoanExecutionData never verifies _loan.borrower == _loanExecutionData.borrower nor that tokenIds match.
**Steps:**
1. Borrower A has an active loan in MultiSourceLoan with collateral NFT.
2. Attacker B crafts and signs a _loanExecutionData offer with same principalAddress and nftCollateralAddress but different tokenId.
3. B calls refinanceFromLoanExecutionData() with A's _loan; msg.sender != _loan.borrower bypasses signature check.
4. No borrower equality or tokenId check; _processOffersFromExecutionData transfers principal to B.
5. A's collateral remains locked for B's new loan; can be front-run against A's repayment approval.
**How found:** Code reading of refinanceFromLoanExecutionData and _validateExecutionData, noticing missing borrower equality and tokenId checks and the conditional signature bypass.
**Exploitation:** Attacker signs own execution data, calls refinance against victim's existing loan; signature check bypassed since caller isn't the borrower, principal disbursed to attacker while victim's collateral stays locked.
**Escalation:** Front-running victim's repayment approval to repeatedly lock collateral.
**Insight:** In refinance flows, verify the new execution data's borrower and collateral tokenId match the existing loan; a signature check gated on msg.sender != borrower is a bypass when caller identity is attacker-controlled.

