The Wildcat Protocol - 0xKbl'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: 104/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
edited-by-warden
duplicate-68

External Links

Lines of code

https://github.com/code-423n4/2023-10-wildcat/blob/c5df665f0bc2ca5df6f06938d66494b11e7bdada/src/market/WildcatMarketWithdrawals.sol#L166-L170 https://github.com/code-423n4/2023-10-wildcat/blob/c5df665f0bc2ca5df6f06938d66494b11e7bdada/src/market/WildcatMarketBase.sol#L172-L176

Vulnerability details

Impact

Detailed description of the impact of this finding.

In the _blockAccount function and when creating the escrow contract in executeWithdrawal, the parameters are being passed in the wrong order. Specifically, the account address is being passed first, and the borrower's address is being passed second. This mistake is causing several problems.

The most significant issue is that, as a result of this mistake, after a lender is sanctioned and their assets are moved to an escrow contract, contrary to the expected behaviour, the escrow is releasable. Since in the escrow the account address is actually the borrower address, a borrower can call releaseEscrow and have the funds transferred to themselves.

Proof of Concept

Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.

Adding the following test to the WildcatMarketWithdrawals.t.sol

function test_borrowerCanReleaseEscrow() external { _deposit(alice, 1e18); _requestWithdrawal(alice, 1e18); fastForward(parameters.withdrawalBatchDuration); sanctionsSentinel.sanction(alice); address escrow = sanctionsSentinel.getEscrowAddress(alice, borrower, address(asset)); vm.expectEmit(address(asset)); emit Transfer(address(market), escrow, 1e18); vm.expectEmit(address(market)); emit SanctionedAccountWithdrawalSentToEscrow(alice, escrow, uint32(block.timestamp), 1e18); market.executeWithdrawal(alice, uint32(block.timestamp)); bool canReleaseEscrow = WildcatSanctionsEscrow(escrow).canReleaseEscrow(); assertEq(canReleaseEscrow, true); vm.prank(borrower); assertEq(asset.balanceOf(borrower), 0); WildcatSanctionsEscrow(escrow).releaseEscrow(); assertEq(asset.balanceOf(borrower), 1e18); }

Results:

Running 1 test for test/market/WildcatMarketWithdrawals.t.sol:WithdrawalsTest [PASS] test_borrowerCanReleaseEscrow() (gas: 931809) Test result: ok. 1 passed; 0 failed; 0 skipped; finished in 3.09ms

Tools Used

Foundry

Pass the parameters in the code linked above in the correct order

Assessed type

Other

#0 - c4-pre-sort

2023-10-27T02:31:54Z

minhquanym marked the issue as duplicate of #515

#1 - c4-judge

2023-11-07T11:58:16Z

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