Anyone can remove existing term without queueing through setTerms()
#59
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
M-06
primary issue
Highest quality submission among a set of duplicates
🤖_11_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2024-04-gondi/blob/b9863d73c08fcdd2337dc80a8b5e0917e18b036c/src/lib/pools/PoolOfferHandler.sol#L110
Vulnerability details
Impact
In PoolOfferHandler, new terms require a two-step process for setting (
setTerms()
andconfirmTerms()
). ThesetTerm()
function isonlyOwner
, but theconfirmTerms()
function can be called by anyone. This function uses the provided input__terms
from the caller to execute the logic. This could enable an attacker to remove all existing terms, even if the owner does not intend to do so (without pending through thesetTerms()
function).Proof of Concept
Consider the following scenario
setTerms()
with the__terms
they want to set up. The new term is pending confirmation after a waiting period.NEW_TERMS_WAITING_TIME
, an attacker callsconfirmTerms()
with_termKeys
set to all 5 existing terms and__terms.aprPremium = 0
.pendingAprPremium
of these terms is reset to 0 after it is confirmed earlier, the checkif (pendingAprPremium != __terms[i].aprPremium)
is bypassed. The attacker could set the_terms[][][][]
mapping of existing loans to 0.Tools Used
Manual Review
Recommended Mitigation Steps
Only allow the owner to call
confirmTerms()
.Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: