Sturdy contest - dipp's results

The first protocol for interest-free borrowing and high yield lending.

General Information

Platform: Code4rena

Start Date: 13/05/2022

Pot Size: $30,000 USDC

Total HM: 8

Participants: 65

Period: 3 days

Judge: hickuphh3

Total Solo HM: 1

Id: 125

League: ETH

Sturdy

Findings Distribution

Researcher Performance

Rank: 16/65

Findings: 3

Award: $344.32

🌟 Selected for report: 0

πŸš€ Solo Findings: 0

Awards

14.8433 USDC - $14.84

Labels

bug
duplicate
3 (High Risk)
disagree with severity

External Links

Lines of code

GeneralVault.sol#L100-L128 LidoVault.sol#L122-L149

Vulnerability details

Impact

In the _withdrawFromYieldPool function in LidoVault.sol, the receivedETHAmount value is returned before the sent value for the call function is checked on line 142.

When withdrawCollateral is called in LidoVault.sol and the call fails, the transaction does not revert and the user loses the assets withdrawn from the lending pool. The withdrawn assets stay in the contract.

Proof of Concept

  1. Call withdrawCollateral from LidoVault.sol with _asset = 0x0000000000000000000000000000000000000000, anything for _amount and a valid _to address.

  2. The _amount of stETH is withdrawn from the lending pool.

  3. _withdrawFromYieldPool is called with the stETH amount withdrawn as its _amount value.

  4. In _withdrawFromYieldPool, after the stETH is swapped for ETH, a call to _to is made and the ETH amount received from the swap is sent to the address.

  5. If the call fails, for example the receiving contract does not implement receive or a fallback to receive ETH, then the call should return false and the withdraw transaction should revert. But it does not revert, instead the amount of ETH received from the swap is returned from the _withdrawFromYield function. The ETH acquired from the swap remains in the contract.

Swap line 141 with line 142 in LidoVault.sol.

#0 - sforman2000

2022-05-18T01:32:04Z

Findings Information

🌟 Selected for report: rotcivegaf

Also found by: AuditsAreUS, MaratCerby, StErMi, berndartmueller, cccz, dipp

Labels

bug
duplicate
2 (Med Risk)
sponsor confirmed

Awards

283.5578 USDC - $283.56

External Links

Lines of code

GeneralVault.sol#L75-L89 LidoVault.sol#L79-L104

Vulnerability details

Impact

When the depositCollateral function is used in the LidoVault.sol contract, a user depositing stETH may mistakenly have a non-zero msg.value. The ETH would be passed to the contract and the user would lose that ETH.

Proof of Concept

  1. Call the depositCollateral function in the LidoVault.sol contract with _asset as the stETH token address (LIDO), _amount as any withdrawable amount and msg.value as any amount more than 0.

  2. The amount of msg.value in ETH is sent from the msg.sender to LidoVault.sol.

  3. When _depositToYieldPool is called in the depositCollateral function the _amount of stETH will be sent to LidoVault.sol.

  4. Only the _amount of stETH is deposited into the lending pool, since the ETH sent is not swapped for stETH. The ETH sent stays in the contract.

Consider reverting the transaction when the msg.value is not 0 and the _asset value is equal to LIDO.

On line 97 of LidoVault.sol, the condition could change to require(_asset == LIDO && msg.value == 0, Errors.VT_COLLATERAL_DEPOSIT_INVALID).

#0 - sforman2000

2022-05-18T02:27:22Z

1. Wrong amount emitted

Line References

GeneralVault.sol#L88

Impact

When depositing ETH in the depositCollateral function in GeneralVault.sol (when using the LidoVault.sol contract), the _amount in the emitted event may not be the same as the msg.value.

The assumption is that the DepositCollateral event should emit the actual amount deposited.

Consider using the _stAssetAmount value (returned from the _depositToYieldPool function) for the emit instead of the _amount value.

#0 - HickupHH3

2022-06-06T06:43:31Z

low severity issue

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