Open c4-bot-2 opened 2 months ago
Transfers from sanctioned accounts are blocked in the _getAccount
function within the WildcatMarketBase
contract.
Invalid finding.
3docSec marked the issue as unsatisfactory: Invalid
Hi @laurenceday would you mind having another look at this finding?
The point is frontrunning sanctions by transferring to another "unknown" address and keep interacting with the protocol from there, so the sanctions check at transfer time won't save the day if I get this right
That'd only be possible if they knew the sanctions would be recorded soon but haven't yet, which IMO is not really something we can do anything about, or likely enough to be worth doing anything about
Okay so the finding is valid. Wrt severity, I think L is appropriate, because there is no impact on functionality or funds. Blockbuster tokens like USDC have the same issue - before being blocked one can give away tokens to some other address and keep using them. It is reasonable to expect the new address will be sanctioned too.
3docSec changed the severity to QA (Quality Assurance)
3docSec marked the issue as grade-b
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: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 themarket.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
```solidity function test_POC_1() external { address bob = address(10); address market = address(1); DeployMarketInputs memory inputs; MarketState memory state; // Don't activate onQueueWithdrawal hook inputs.hooks = EmptyHooksConfig.setHooksAddress(address(hooks)); hooks.onCreateMarket( address(this), market, inputs, abi.encode(block.timestamp + 365 days, 1e18) ); // Withdrawer does not have the isKnownLender credential bool isKnownLender = hooks.isKnownLenderOnMarket(bob, market); assertEq(isKnownLender, false); // Function will not revert though Bob is not a known lender vm.prank(market); vm.warp(block.timestamp + 366 days); hooks.onQueueWithdrawal(bob, 0, 1, state, ''); } ```Tools Used
Manual Review Foundry Testing
Recommendations
Only known lenders should be able to withdraw if the hook is enabled:
Assessed type
Access Control