The Wildcat Protocol - d3e4's results

Banking, but worse - a protocol for fixed-rate, undercollateralised credit facilities.

General Information

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

Wildcat Protocol

Findings Distribution

Researcher Performance

Rank: 106/131

Findings: 1

Award: $6.67

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

6.6715 USDC - $6.67

Labels

bug
3 (High Risk)
satisfactory
upgraded by judge
duplicate-68

External Links

Lines of code

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

Vulnerability details

Impact

getEscrowAddress() returns the wrong WildcatSanctionsEscrow. Borrower can steal lender's escrowed funds.

Proof of concept

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().

Assessed type

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

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter