yAxis contest - 0xRajeev's results

The trusted #DeFi platform to earn reliable returns on digital assets.

General Information

Platform: Code4rena

Start Date: 09/09/2021

Pot Size: $60,000 USDC

Total HM: 24

Participants: 12

Period: 7 days

Judge: GalloDaSballo

Total Solo HM: 14

Id: 30

League: ETH

yAxis

Findings Distribution

Researcher Performance

Rank: 4/12

Findings: 7

Award: $3,446.19

๐ŸŒŸ Selected for report: 13

๐Ÿš€ Solo Findings: 2

Findings Information

๐ŸŒŸ Selected for report: jonah1005

Also found by: 0xRajeev, hrkrshnn

Labels

bug
duplicate
3 (High Risk)

Awards

125.5914 YAXIS - $489.81

External Links

Handle

0xRajeev

Vulnerability details

Impact

addToken does not check for token being added a duplicate of what was already added. If a duplicate token is added, removeToken only removes the first matching token and the later duplicates still remain. With the vault[token] deleted, this may lead to undefined behavior.

Proof of Concept

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/Manager.sol#L420-L436

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/Manager.sol#L462-L490

Tools Used

Manual Analysis

Check for duplicate token being added and do not add such duplicates.

#0 - Haz077

2021-09-21T12:36:04Z

require(vaults[_token] == address(0), "!_token") already checks for duplicated tokens.

#1 - uN2RVw5q

2021-09-29T17:41:37Z

I think this is a valid issue. Effectively a duplicate of https://github.com/code-423n4/2021-09-yaxis-findings/issues/3

The check require(vaults[_token] == address(0), "!_token") did not exist when the contracts were part of the contest.

I would also change the severity to high risk, just like in the duplicated issue.

#2 - Haz077

2021-09-29T18:23:52Z

My bad, I missed that the check was added after the contest ended.

#3 - GalloDaSballo

2021-10-13T23:22:39Z

Duplicate of #3

Findings Information

๐ŸŒŸ Selected for report: jonah1005

Also found by: 0xRajeev, WatchPug

Labels

bug
duplicate
3 (High Risk)

Awards

125.5914 YAXIS - $489.81

External Links

Handle

0xRajeev

Vulnerability details

Impactโ€จ

There is an assumption in LegacyController.vault() that the vault will have enough tokens[0] to cover the balance difference. If not, the user may receive less than amount requested and balance funds get lost/locked unless the vault withdraws from the strategy. This is not clear.

Proof of Concept

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/controllers/LegacyController.sol#L164

Tools Used

Manual Analysis

Ensure that vault will have enough tokens[0] in it or withdraws from strategy to cover the withdrawal request.

#0 - GainsGoblin

2021-09-30T16:52:52Z

Duplicate of #28

#1 - GalloDaSballo

2021-10-14T17:07:03Z

Duplicate of #28

Findings Information

๐ŸŒŸ Selected for report: cmichel

Also found by: 0xRajeev, 0xsanson

Labels

bug
duplicate
2 (Med Risk)
sponsor disputed

Awards

37.6774 YAXIS - $146.94

External Links

Handle

0xRajeev

Vulnerability details

Impact

User may receive less than the eligible amount per the shares being withdrawn. It is not clear under what conditions this happens but needs to be documented and user warned.

Proof of Concept

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/Vault.sol#L256-L263

Tools Used

Manual Analysis

Evaluate under what conditions this is true and ensure this is documented and user warned.

#0 - Haz077

2021-09-21T11:59:10Z

I don't see where is the issue.

#1 - uN2RVw5q

2021-10-01T17:25:16Z

AFAIU, it could be possible that if the contract doesn't have enough balance for IERC20(_output), the user may actually be burning more shares than required to get the same amount of tokens.

There are two ways to proceed:

  1. Either document this properly and perhaps have frontend checks.
  2. Or change withdraw to be more like withdrawp(uint256 _shares, address _output, uint256 _minAmount). After the _amount computation, there can be a check require(_amount >= _minAmount) to guarantee that at least _minAmount tokens are returned. This helps avoid users accidentally burning more tokens than needed.

So I'm not sure about the "sponsor disputed" tag for this issue. I think this should be reconsidered.

#3 - GalloDaSballo

2021-10-13T23:20:50Z

Duplicate of #121

Findings Information

๐ŸŒŸ Selected for report: 0xRajeev

Labels

bug
2 (Med Risk)
sponsor acknowledged
sponsor confirmed

Awards

139.546 YAXIS - $544.23

External Links

Handle

0xRajeev

Vulnerability details

Impact

The manager.allowedVaults check is missing for add/remove strategy like how it is used in reorderStrategies(). This will allow a strategist to accidentally/maliciously add/remove strategies on unauthorized vaults.

Given the critical access control that is missing on vaults here, this is classified as medium severity.

Proof of Concept

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/controllers/Controller.sol#L101-L130

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/controllers/Controller.sol#L172-L207

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/controllers/Controller.sol#L224

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/Manager.sol#L210-L221

Tools Used

Manual Analysis

Add manager.allowedVaults check in addStrategy() and removeStrategy()

#0 - uN2RVw5q

2021-10-03T19:15:19Z

#1 - GalloDaSballo

2021-10-14T15:40:49Z

Sponsor has acknowledged and mitigated by adding further access control checks

Findings Information

๐ŸŒŸ Selected for report: 0xRajeev

Labels

bug
2 (Med Risk)
sponsor acknowledged

Awards

139.546 YAXIS - $544.23

External Links

Handle

0xRajeev

Vulnerability details

Impact

A malicious strategist can halt the entire protocol and force a permanent shutdown once they observe that governance is trying to set a new strategist and they do not agree with that decision. They may use the 7 day window to halt the protocol. The access control on setHalted() should be onlyGovernance.

Proof of Concept

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/Manager.sol#L515-L522

https://github.com/code-423n4/2021-09-yaxis/blob/cf7d9448e70b5c1163a1773adb4709d9d6ad6c99/contracts/v3/Manager.sol#L333-L345

Tools Used

Manual Analysis

Change access control to onlyGovernance from onlyStrategist for setHalted()

#0 - uN2RVw5q

2021-10-03T15:58:06Z

#1 - GalloDaSballo

2021-10-14T15:42:44Z

Agree that such critical functionality should be limited to the highest permission access role. Sponsor has mitigated

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