Yieldy contest - hake's results

A protocol for gaining single side yields on various tokens.

General Information

Platform: Code4rena

Start Date: 21/06/2022

Pot Size: $50,000 USDC

Total HM: 31

Participants: 99

Period: 5 days

Judges: moose-code, JasoonS, denhampreen

Total Solo HM: 17

Id: 139

League: ETH

Yieldy

Findings Distribution

Researcher Performance

Rank: 29/99

Findings: 3

Award: $331.58

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: pashov

Also found by: csanuragjain, hake, kenta, m_Rassska, oyc_109

Labels

bug
duplicate
2 (Med Risk)
resolved
sponsor confirmed

Awards

119.2495 USDC - $119.25

External Links

Lines of code

https://github.com/code-423n4/2022-06-yieldy/blob/524f3b83522125fb7d4677fa7a7e5ba5a2c0fe67/src/contracts/Migration.sol#L48

Vulnerability details

Impact

Yieldy.transferFrom() returns false on failure instead of reverting. This might lead to moveFundsToUpgradedContract() incorrectly unstaking and restaking tokens, potentially causing user or Migration.sol to lose funds depending on NEW_CONTRACT and OLD_CONTRACT implementations.

Proof of Concept

https://github.com/code-423n4/2022-06-yieldy/blob/524f3b83522125fb7d4677fa7a7e5ba5a2c0fe67/src/contracts/Migration.sol#L48-L52

        IYieldy(OLD_YIELDY_TOKEN).transferFrom(
            msg.sender,
            address(this),
            userWalletBalance
        );

No check for boolean return value from transferFrom()

Tools Used

Manual Review

Implement a check on the return value of transferFrom().

#0 - toshiSat

2022-06-27T21:31:42Z

sponsor confirmed

#1 - 0xean

2022-08-05T22:56:01Z

This is incorrect, the yieldy transfer call definitely reverts if it fails.

Take a look at the solidity compiler version.

#2 - toshiSat

2022-08-08T13:49:45Z

I still think it will be good to explicitly check this instead of relying on the compiler version to make it more future proof (even though it most likely won't be affected).

Findings Information

🌟 Selected for report: unforgiven

Also found by: IllIllI, TrungOre, asutorufos, hake, robee

Labels

bug
duplicate
2 (Med Risk)

Awards

158.9994 USDC - $159.00

External Links

Lines of code

https://github.com/code-423n4/2022-06-yieldy/blob/524f3b83522125fb7d4677fa7a7e5ba5a2c0fe67/src/contracts/Staking.sol#L419

Vulnerability details

Impact

stake() will revert for tokens that charge a fee on transfer.

Proof of Concept

Note: POC below assumes tokePoolContract.deposit(_amount) transfers part of Staking.sol balance to tokePoolContract.

stake() uses the _amount as a reference for _depositToTokemak() and assumes the amount received is equal to _amount. However, with fee on transfer tokens the amount received by Staking.sol will be inferior to _amount due to the fee charged on transfer by the token.

Tools Used

Manual Review

Check the difference between the before and after balance to ensure amount used to deposit is equal to the amount Staking.sol has received.

#0 - toshiSat

2022-06-27T21:28:42Z

duplicate #222

QA Report

[L-01] Approve has been deprecated

I recommend using safeIncreaseAllowance() from OpenZeppelin.

OpenZeppelin Documentation

https://github.com/code-423n4/2022-06-yieldy/blob/524f3b83522125fb7d4677fa7a7e5ba5a2c0fe67/src/contracts/Staking.sol#L83

[N-01] Typo

@ notice remove address to contracts array

Change to: remove address from contracts array https://github.com/code-423n4/2022-06-yieldy/blob/524f3b83522125fb7d4677fa7a7e5ba5a2c0fe67/src/contracts/BatchRequests.sol#L86

[N-02] Change naming to reflect functionality

using the word enable in enableLiquidityReserve() implies it can be disabled. I suggest changing the word "enable" to "init" stemming from initialise. https://github.com/code-423n4/2022-06-yieldy/blob/524f3b83522125fb7d4677fa7a7e5ba5a2c0fe67/src/contracts/LiquidityReserve.sol#L57

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