Lenders can avoid sanction restrictions in FixedTermLoanHooks
by transferring to another account
#12
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
grade-a
primary issue
Highest quality submission among a set of duplicates
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
🤖_primary
AI based primary recommendation
🤖_44_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/FixedTermLoanHooks.sol#L848-L868
https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/src/access/AccessControlHooks.sol#L812-L825
Vulnerability details
Impact
Lenders can evade sanctioning restrictions by sending their tokens to another of their addresses and continue earning interest in
FixedTermLoanHooks
.Hooks templaets have inconsistent security levels.
Vulnerability Details
Although the documentation says that the two hooks templates
AccessControlHooks
&FixedTermLoanHooks
are the "exact same" and lists the ways in which they are not; see [here](The https://github.com/code-423n4/2024-08-wildcat/blob/fe746cc0fbedc4447a981a50e6ba4c95f98b9fe1/docs/hooks/templates/Fixed%20Term%20Loan%20Hooks.md?plain=1#L5C1-L5C55), this is not the case with respect to withdrawal security as we will see below.The
isKnownLender
flag is set when a lender deposits and is never removed.It serves two purposes:
1. Prevents the borrower from blocking withdrawals from the market by removing genuine lender's credentials
2. Prevents unknown accounts from being able to withdraw tokens from the market
In
AccessControlHooks
if theonQueueWithdrawal
hook is enabled a withdrawing user must be a knownLender or have an active credential.In
FixedTermLoanHooks
however; isKnownLender is only checked if both the hook is enabled ANDmarket.withdrawalRequiresAccess
is active.If the hook is active but the
market.withdrawalRequiresAccess = FALSE
users with no credentials are allowed to withdraw.This allows a user who suspects they may be sanctioned in the future to transfer all of their scaledTokens to another account of theirs and withdraw any time without restriction; avoiding having their funds sent to an escrow.
POC
Add the test function below to
FixedTermLoanHooks.t.sol
and run:Users with no credentials can withdraw
Tools Used
Manual Review
Foundry Testing
Recommendations
Only known lenders should be able to withdraw if the hook is enabled:
Assessed type
Access Control
The text was updated successfully, but these errors were encountered: