Join our community: https://t.me/+DOylgFv1jyJlNzM0
Description
refinance_loan() in contracts/loan_manager/src/lib.rs allows an admin to replace a loan's terms. There is no validation that the new terms are actually favorable to the borrower (lower rate, longer term, or reduced principal). An admin could "refinance" a loan with higher interest rates or a shorter term, which would harm the borrower.
The intent of refinancing is to give borrowers better terms when their credit improves or when market rates drop. Without this constraint, the function is effectively an unrestricted loan modification.
Expected Behavior
Add invariant checks in refinance_loan():
assert!(new_interest_rate_bps <= current.interest_rate_bps, "refinance must lower rate (error_code)");
assert!(new_due_ledger >= current.due_ledger, "refinance must not shorten term (error_code)");
Or at minimum, require borrower consent (signature) on the new terms before they are applied.
Impact
Medium. Without this check, an admin can modify a live loan to unfavorable terms without the borrower's explicit consent.
Description
refinance_loan()incontracts/loan_manager/src/lib.rsallows an admin to replace a loan's terms. There is no validation that the new terms are actually favorable to the borrower (lower rate, longer term, or reduced principal). An admin could "refinance" a loan with higher interest rates or a shorter term, which would harm the borrower.The intent of refinancing is to give borrowers better terms when their credit improves or when market rates drop. Without this constraint, the function is effectively an unrestricted loan modification.
Expected Behavior
Add invariant checks in
refinance_loan():Or at minimum, require borrower consent (signature) on the new terms before they are applied.
Impact
Medium. Without this check, an admin can modify a live loan to unfavorable terms without the borrower's explicit consent.