# refinanceFull/addNewTranche reusing a lender's signature leads to unintended behavior

refinanceFull and addNewTranche share the same lender signature hash, letting a borrower replay a refi signature into addNewTranche to roughly double the loan.

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

**Target:** MultiSourceLoan.sol refinanceFull/addNewTranche signature check
**Root cause:** Both refinanceFull and addNewTranche validate the same RenegotiationOffer.hash() signature with no type/trancheIndex discriminator, so a signature intended for one function is valid for the other.
**Steps:**
1. Lender signs a RenegotiationOffer intended for refinanceFull (replacing the tranche).
2. Borrower observes the signed offer and front-runs, calling `addNewTranche(_renegotiationOffer, _loan, _renegotiationOfferSignature)`.
3. `_checkSignature(_renegotiationOffer.lender, _renegotiationOffer.hash(), sig)` passes since hash is identical.
4. New tranche is appended instead of replacing, roughly doubling total borrowed principal.
**How found:** Code reading: noticed refinanceFull and addNewTranche both call _checkSignature on the same _renegotiationOffer.hash() with no function/type discriminator, implying cross-function signature replay.
**Exploitation:** Borrower front-runs the lender's intended refinanceFull with addNewTranche using the same signed offer, appending a new tranche and roughly doubling the borrowed amount against the lender.
**Insight:** When two functions validate the same signed struct hash, check whether the struct encodes which function it authorizes; missing a type/trancheIndex field enables cross-function replay of a lender's signature.

