<!-- canonical: https://0xsimao.com/findings/maple-finance-iii-refinancer-danger-term-upgrades -->

# Malicious refinancer danger due to fixed term loan upgrades.

Crit/High · Three Sigma · Institutional lending · 10th April, 2024

Finding 3S-MAPLE-M09 of the Maple Finance security review.

- Protocol: https://maple.finance/
- Report: /reports/maple-finance-iii-2024
- Source: https://cdn.sanity.io/files/qoqld077/production/36dbe5ca76da3d2392bcee581548067705b8bd36.pdf

---

### Description

In the previous [maple-core-v2 code,](https://github.com/maple-labs/loan/blob/16d50af0af22b4725073eea76a1e27da60b385e4/contracts/MapleLoan.sol#L215) any address could be chosen for the refinancer when
proposing new terms. The new versions of the fixed term loans add a check regarding the
refinancer address, but place it in the proposeNewTerms(...) function, such that
proposed terms in the previous loans version did not validate the refinancer address. The
new check could lead to a false sense of security and delegates could accept new terms
with a malicious refinancer address.
Exploit
● v400 fixed term loan borrower proposes refinancing with an invalid fee manager
● v400 loans are upgraded to v500 loans
● Given that v500 loans only allow whitelisted refinancers to be proposed, it could
lead to a false sense of security
● The delegate accepts the new terms and the malicious refinancer address steals
funds

### Recommendation

The refinancer validation should be done on acceptNewTerms(...). It would be possible to
leave it on proposeNewTerms(...), however, it would require the Maple team to track all
the v400 maple loans (even the ones that were not funded / are idle) to check if there are
invalid refinancer addresses before upgrading, and even then, attackers could still watch
the mempool for the upgrade. Overall, it is safer to put the validation on
acceptNewTerms(...).

### Status

Acknowledged by the team.
