yAxis contest - 0xsanson'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: 5/12

Findings: 6

Award: $2,715.34

🌟 Selected for report: 10

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: jonah1005

Also found by: 0xsanson

Labels

bug
duplicate
3 (High Risk)

Awards

209.319 YAXIS - $816.34

External Links

Handle

0xsanson

Vulnerability details

Impact

During Controller.setCap we change _vaultDetails[_vault].balance to _vaultDetails[_vault].balance.sub(_balance). This is wrong, and the correct value should be _vaultDetails[_vault].balance.sub(_diff), because _diff is the value withdrawn from the strategy. High risk because this is an accounting error that propagates though the function balance() in Vault.sol, so for all deposits/withdraws.

Tools Used

editor

Correct using _diff instead of _balance.

#0 - gpersoon

2021-09-29T12:36:56Z

Duplicate of #1

#1 - GalloDaSballo

2021-10-12T23:34:44Z

Duplicate of #1

Findings Information

🌟 Selected for report: cmichel

Also found by: 0xsanson

Labels

bug
duplicate
2 (Med Risk)

Awards

62.7957 YAXIS - $244.90

External Links

Handle

0xsanson

Vulnerability details

Impact

The Controller contract can call converter.convert inside earn and withdraw functions, after transferring amount of tokens to the Converter contract. This contract assumes that it has received exactly amount tokens, however this isn't true for fee-on-transfer tokens. This will cause the aforementioned functions to revert, basically making the entire protocol unusable.

Proof of Concept

https://github.com/code-423n4/2021-09-yaxis/blob/main/contracts/v3/controllers/Controller.sol#L426 https://github.com/code-423n4/2021-09-yaxis/blob/main/contracts/v3/converters/StablesConverter.sol#L110

Tools Used

editor

The Converter.convert function should look at its token's balance and use that variable as _inputAmount.

#0 - Haz077

2021-09-28T16:42:12Z

Same as #127

#1 - GalloDaSballo

2021-10-12T23:22:34Z

Agree with finding, simple mitigation is to check actual balance in contract Additional simple mitigation is to NOT use any token with feeOnTransfer

#2 - GalloDaSballo

2021-10-12T23:25:45Z

Duplicate of #127

#3 - GalloDaSballo

2021-10-13T15:39:16Z

Downgraded to Medium as while this is potentially a serious risk, it can be mitigated by simply not using tokens that have fees

Findings Information

🌟 Selected for report: cmichel

Also found by: 0xRajeev, 0xsanson

Labels

bug
duplicate
2 (Med Risk)

Awards

37.6774 YAXIS - $146.94

External Links

Handle

0xsanson

Vulnerability details

Impact

In the Vault.withdraw function an user burns _shares quantity of VaultTokens to get _amount of outputTokens back from the vault. If the vault doesn't have enough tokens, even after withdrawing from the controller, they receive less tokens than they should; in other terms, they could have burned less tokens to receive the same output quantity. Even if the users check the vault before sending the withdraw transaction, they can still be frontrun since there's no slippage-like parameter.

Tools Used

editor

Suggested adding a way to compensate an user. For example by giving change in VaultTokens.

#1 - GalloDaSballo

2021-10-13T23:21:20Z

Duplicate of #121

Findings Information

🌟 Selected for report: 0xsanson

Also found by: tensors

Labels

bug
2 (Med Risk)
sponsor acknowledged

Awards

62.7957 YAXIS - $244.90

External Links

Handle

0xsanson

Vulnerability details

Impact

In the NativeStrategyCurve3Crv._harvest there are two instances that a bad actor could use to frontrun the harvest.

First, when we are swapping WETH to a stablecoin by calling _swapTokens(weth, _stableCoin, _remainingWeth, 1) the function isn't checking the slippage, leading to the risk to a frontun (by imbalancing the Uniswap pair) and losing part of the harvesting profits.

Second, during the _addLiquidity internal function: this calls stableSwap3Pool.add_liquidity(amounts, 1) not considering the slippage when minting the 3CRV tokens.

Proof of Concept

https://github.com/code-423n4/2021-09-yaxis/blob/main/contracts/v3/strategies/NativeStrategyCurve3Crv.sol#L108

Tools Used

editor

In the function _harvest(_estimatedWETH, _estimatedYAXIS) consider adding two additional estimated quantities: one for the swapped-out stablecoin and one for the minted 3CRV.

#0 - uN2RVw5q

2021-10-02T14:58:02Z

On second thought, I think this is a valid issue.

consider adding two additional estimated quantities: one for the swapped-out stablecoin and one for the minted 3CRV.

This suggestion should be considered.

#1 - GalloDaSballo

2021-10-14T15:38:22Z

Warden identified two paths for front-running

Since these are ways to extract value, severity is Medium

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