Inconsistent Minimum Balance Checks Enable Known Lender Status Bypass via onTransfer
function
#41
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
grade-b
primary issue
Highest quality submission among a set of duplicates
Q-18
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_55_group
AI based duplicate group recommendation
sponsor disputed
Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/access/AccessControlHooks.sol#L786-L791
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/access/AccessControlHooks.sol#L864-L881
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/access/AccessControlHooks.sol#L733-L742
Vulnerability details
The issue stems from the difference in logic between the
onDeposit
andonTransfer
functions inAccessControlHooks.sol
, particularly regarding the minimum deposit check. Let's analyze this step by step:Behavior of the
onDeposit
function:In the
onDeposit
function, there's an explicit check for the minimum deposit amount:This ensures that direct deposits must meet the minimum deposit requirement.
Behavior of the
onTransfer
function:In contrast, the
onTransfer
function doesn't have a similar minimum amount check. It primarily focuses on validating the permissions of the recipient (to
address):Impact
Proof of Concept
Attackers might exploit this difference to bypass the minimum deposit limit while still gaining known lender status. The attack steps could be as follows:
a. The attacker first obtains a valid credential through legitimate means (possibly a small deposit or other method).
b. Then, the attacker uses this valid credential to receive a very small amount (potentially far below the minimum deposit requirement) through the
onTransfer
function.c. Since
onTransfer
doesn't have a minimum amount check, as long as the credential is valid, this transfer would succeed.d. In the
_writeLenderStatus
function, if the conditions are met (valid credential, not previously a known lender,canSetKnownLender
is true), the account would be marked as a known lender:Recommended Mitigation Steps
onTransfer
function as well.Assessed type
Access Control
The text was updated successfully, but these errors were encountered: