Platform: Code4rena
Start Date: 16/10/2023
Pot Size: $60,500 USDC
Total HM: 16
Participants: 131
Period: 10 days
Judge: 0xTheC0der
Total Solo HM: 3
Id: 296
League: ETH
Rank: 106/131
Findings: 1
Award: $6.67
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: YusSecurity
Also found by: 0xAsen, 0xCiphky, 0xDING99YA, 0xKbl, 0xSwahili, 0xbepresent, 3docSec, AS, Aymen0909, DeFiHackLabs, GREY-HAWK-REACH, KeyKiril, MiloTruck, QiuhaoLi, Silvermist, SovaSlava, TrungOre, VAD37, Vagner, Yanchuan, ZdravkoHr, ast3ros, cartlex_, d3e4, deth, ggg_ttt_hhh, gizzy, kodyvim, nirlin, nobody2018, rvierdiiev, serial-coder, sl1, tallo, xeros
6.6715 USDC - $6.67
https://github.com/code-423n4/2023-10-wildcat/blob/c5df665f0bc2ca5df6f06938d66494b11e7bdada/src/market/WildcatMarketBase.sol#L173-L174 https://github.com/code-423n4/2023-10-wildcat/blob/c5df665f0bc2ca5df6f06938d66494b11e7bdada/src/market/WildcatMarketWithdrawals.sol#L167-L168
getEscrowAddress()
returns the wrong WildcatSanctionsEscrow.
Borrower can steal lender's escrowed funds.
createEscrow()
and getEscrowAddress()
both take the parameters borrower
, account
, asset
, in that order, as defined in WildcatSanctionsSentinel.sol.
However, where createEscrow()
is used, in WildcatMarketBase._blockAccount()
and in WildcatMarketWithdrawals.executeWithdrawal()
, the intended borrower
and account
have swapped places.
This means that getEscrowAddress(borrower, account, asset)
returns a different address. The immediate implication of this is that a user or contract interfacing with getEscrowAddress()
will be unable to find the correct WildcatSanctionsEscrow.
Furthermore, the borrower
and account
will then have swapped places also in the deployed WildcatSanctionsEscrow. This means that canReleaseEscrow()
now returns !WildcatSanctionsSentinel(sentinel).isSanctioned(account, borrower);
which most likely is true
since it was the account
that was sanctioned, not the borrower
. Then the borrower can releaseEscrow()
which will now IERC20(asset).transfer(borrower, amount);
. That is, the borrower can immediately transfer the lender's escrowed funds to himself.
createEscrow()
will now also set sanctionOverrides[account][escrowContract] = true;
, which seems less of an issue.
Correct the order of the parameters in WildcatMarketBase._blockAccount()
and in WildcatMarketWithdrawals.executeWithdrawal()
.
Context
#0 - c4-pre-sort
2023-10-27T02:23:13Z
minhquanym marked the issue as duplicate of #515
#1 - c4-judge
2023-11-07T11:46:36Z
MarioPoneder changed the severity to 3 (High Risk)
#2 - c4-judge
2023-11-07T11:47:59Z
MarioPoneder marked the issue as satisfactory