Asymmetry contest - ayden's results

A protocol to help diversify and decentralize liquid staking derivatives.

General Information

Platform: Code4rena

Start Date: 24/03/2023

Pot Size: $49,200 USDC

Total HM: 20

Participants: 246

Period: 6 days

Judge: Picodes

Total Solo HM: 1

Id: 226

League: ETH

Asymmetry Finance

Findings Distribution

Researcher Performance

Rank: 123/246

Findings: 2

Award: $24.26

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

11.1318 USDC - $11.13

Labels

bug
2 (Med Risk)
downgraded by judge
low quality report
satisfactory
duplicate-363

External Links

Lines of code

https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/SafEth.sol#L63#L101

Vulnerability details

Impact

User will lost stake fund

Proof of Concept

Try to stake some eth before derivatives are ready,deposit 1 ETH and received 0 safETH

  it("Should lost stake fund when Derivatives is not ready", async function () {
    const strategy = await getLatestContract(strategyContractAddress, "SafEth");
    const userAccounts = await getUserAccounts();
    const testLostFundAddress = userAccounts[0];
    // new interface
    const iface = new ethers.utils.Interface(SafEthABI.abi);
    const userStrategySigner = strategy.connect(testLostFundAddress);

    //stake 1eth
    const ethAmount = "1";
    const depositAmount = ethers.utils.parseEther(ethAmount);
    const stakeResult = await userStrategySigner.stake({
      value: depositAmount,
    });
    const mined = await stakeResult.wait();
    console.log(mined);

    const eventLog = iface.decodeEventLog(
      "Staked",
      mined.logs[1].data,
      mined.logs[1].topics
    );

    //deposit 1 ETH and receive 0 safETH
    expect(eventLog.ethIn).eq(depositAmount);
    expect(eventLog.safEthOut).eq(0);
  });

Tools Used

manual

The "stake" method requires checking if the current derivative quantity is greater than zero first

#0 - c4-pre-sort

2023-04-01T07:53:05Z

0xSorryNotSorry marked the issue as low quality report

#1 - c4-pre-sort

2023-04-04T19:34:06Z

0xSorryNotSorry marked the issue as duplicate of #363

#2 - c4-judge

2023-04-21T16:29:01Z

Picodes changed the severity to 2 (Med Risk)

#3 - c4-judge

2023-04-21T16:31:55Z

Picodes marked the issue as satisfactory

1.When there is no limit to the range when setting the maxSlippage, if the slippage set exceeds a reasonable range, it may cause losses to the investor's funds Recommended setting range:maxSlippage %0.5 ~ %2

2.When the weights are set improperly, it may cause losses to investors. Improper weightings can cause the value of the derivative to deviate from the underlying asset, which may result in a lack of liquidity or inaccurate pricing for investors seeking to enter or exit positions. This may lead to losses for investors who have not properly assessed the risks and have invested in the derivative. It is important to properly set the weights and perform rigorous risk management to avoid such negative consequences.

3.When unstaking, it is necessary to check whether the user has a sufficient safEth balance. https://github.com/code-423n4/2023-03-asymmetry/blob/main/contracts/SafEth/SafEth.sol#L108#L129

+ require(balanceOf(msg.sender)>=_safEthAmount, "insufficient balance");

#0 - c4-sponsor

2023-04-10T20:43:31Z

toshiSat requested judge review

#1 - c4-sponsor

2023-04-10T20:43:36Z

toshiSat marked the issue as sponsor acknowledged

#2 - toshiSat

2023-04-10T20:43:41Z

I think only 3 is really valid

#3 - c4-judge

2023-04-24T18:33:14Z

Picodes marked the issue as grade-b

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