Wise Lending - Rhaydden's results

Decentralized liquidity market that allows users to supply crypto assets and start earning a variable APY from borrowers.

General Information

Platform: Code4rena

Start Date: 21/02/2024

Pot Size: $200,000 USDC

Total HM: 22

Participants: 36

Period: 19 days

Judge: Trust

Total Solo HM: 12

Id: 330

League: ETH

Wise Lending

Findings Distribution

Researcher Performance

Rank: 32/36

Findings: 1

Award: $124.91

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: serial-coder

Also found by: 0x11singh99, Jorgect, Mrxstrange, Rhaydden, josephdara, nonseodion, unix515

Labels

bug
2 (Med Risk)
:robot:_29_group
sufficient quality report
partial-50
duplicate-245

Awards

124.9081 USDC - $124.91

External Links

Lines of code

https://github.com/code-423n4/2024-02-wise-lending/blob/79186b243d8553e66358c05497e5ccfd9488b5e2/contracts/TransferHub/TransferHelper.sol#L13-L52 https://github.com/code-423n4/2024-02-wise-lending/blob/79186b243d8553e66358c05497e5ccfd9488b5e2/contracts/TransferHub/ApprovalHelper.sol#L13-L29

Vulnerability details

Impact

The _callOptionalReturn function in both ApprovalHelper.sol and TransferHelper.sol returns a boolean indicating the success or failure of the low-level call. But, this return value is not checked/not used at all in these contracts. This means that if the low-level call fails for any reason (e.g., due to a revert in the called contract, the failure will not be caught or handled by the calling contracts. This could lead to unexpected behavior or potential security vulnerabilities, as the contracts may continue executing under the assumption that the call was successful.

The contracts that import the Approvalhelper.sol contract include:

  • WiseSecurity.sol
  • AaveHub.sol
  • PendlePowerFarmDeclarations.sol
  • PendlePowerFarmControllerBase.sol

The contracts that import the Transferhelper.sol contract include:

  • AaveHub.sol
  • PendlePowerFarmDeclarations.sol
  • PendlePowerFarmControllerBase.sol
  • PendlePowerFarmToken.sol
  • WiseCore.sol
  • FeeManagerHelper.sol

TransferHub is the directory which includes contracts intending to move funds securely. Leaving it unchecked leaves the entire codebase vulnerable.

Proof of Concept

ApprovalHelper.sol: The _safeApprove function calls _callOptionalReturn but does not check the return value.

TransferHelper.sol: Both _safeTransfer and _safeTransferFrom functions call _callOptionalReturn without checking the return.

Tools Used

VScode

Check Return Value: Modify the _safeApprove, _safeTransfer, and _safeTransferFrom functions to check the return value of _callOptionalReturn. If the call fails, the functions should revert or handle the failure appropriately. Example modification for _safeApprove:

   function _safeApprove(
       address _token,
       address _spender,
       uint256 _value
   )
       internal
   {
       bool success = _callOptionalReturn(
           _token,
           abi.encodeWithSelector(
               IERC20.approve.selector,
               _spender,
               _value
           )
       );
       require(success, "Approval failed");
   }

Assessed type

Other

#1 - c4-pre-sort

2024-03-12T19:26:01Z

GalloDaSballo marked the issue as insufficient quality report

#2 - c4-pre-sort

2024-03-17T14:30:23Z

GalloDaSballo marked the issue as duplicate of #212

#3 - c4-pre-sort

2024-03-18T16:27:06Z

GalloDaSballo marked the issue as sufficient quality report

#4 - trust1995

2024-03-26T14:30:31Z

Did not demonstrate full understanding like other submissions. 50%

#5 - c4-judge

2024-03-26T14:30:36Z

trust1995 marked the issue as satisfactory

#6 - c4-judge

2024-03-26T14:30:39Z

trust1995 marked the issue as partial-50

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