Tapioca DAO - hack3r-0m's results

The first ever Omnichain money market, powered by LayerZero.

General Information

Platform: Code4rena

Start Date: 05/07/2023

Pot Size: $390,000 USDC

Total HM: 136

Participants: 132

Period: about 1 month

Judge: LSDan

Total Solo HM: 56

Id: 261

League: ETH

Tapioca DAO

Findings Distribution

Researcher Performance

Rank: 98/132

Findings: 3

Award: $61.03

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: IllIllI

Also found by: 0x007, Breeje, cergyk, hack3r-0m, kutugu, pks_

Labels

bug
2 (Med Risk)
downgraded by judge
satisfactory
duplicate-1211

Awards

58.8874 USDC - $58.89

External Links

Lines of code

https://github.com/Tapioca-DAO/tapioca-periph-audit/blob/023751a4e987cf7c203ab25d3abba58f7344f213/contracts/oracle/implementations/ARBTriCryptoOracle.sol#L117

Vulnerability details

Impact

ARBTriCryptoOracle is used to determine price of LP token of tricrypto (USDT, WBTC, WETH) on arbitrum. This pool is susceptible to re-entrancy due to bug in vyper 0.2.15.

and hence get_virtual_price can be manipulated which is used for pricing LP tokens.

Proof of Concept

Arbitrum tricrypto allows to exchange/swap with native ETH as recepient

  • Attacker implements fallback on their contract and calls exchange(..., use_eth=true) with flasloaned tokens on tricrypto
  • It inflates self.D variable impacting calculation of get_virtual_price in rest of the call context
  • Due to this, virtual_price can be decreased to very large extent
  • If this price is used to calcuate slippage while swapping, adding liquidity or removing liquidity then it will lead to loss to the protocol

Tools Used

Manual Review

Use latest crvUSD tricrypto pool and wait for curve team to release oracle for that or use offchain oracle

Assessed type

Oracle

#0 - c4-pre-sort

2023-08-05T06:47:06Z

minhquanym marked the issue as duplicate of #704

#1 - c4-judge

2023-09-13T08:58:02Z

dmvt marked the issue as satisfactory

#2 - c4-judge

2023-09-20T20:12:27Z

dmvt changed the severity to 2 (Med Risk)

Awards

2.1417 USDC - $2.14

Labels

bug
2 (Med Risk)
satisfactory
duplicate-163

External Links

Lines of code

https://github.com/Tapioca-DAO/tapioca-yieldbox-strategies-audit/blob/05ba7108a83c66dada98bc5bc75cf18004f2a49b/contracts/glp/GlpStrategy.sol#L166-L178

Vulnerability details

Impact

glpRewardRouter.mintAndStakeGlp(address(weth), wethAmount, 0, 0);

Here, minUSDG = 0 and minGlp = 0 means no slippage checks.

This can be sandwitched in certain conditions in which delta between min and max glp price is higher due to following factors:

  • delta between min and max price reported by gmx fast price feed
  • delta between optimal weight of WETH (since WETH is used for minting) and current weight of WETH in GLP pool
  • open interest imbalance

However, there is mint and burn fee of 0.1% on GLP and hence in usual conditions, it would be rare perform profitable sandwitch.

Proof of Concept

Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.

Tools Used

Manual Review

Add one of min output amount in mintAndStakeGlp (ref: https://github.com/RageTrade/delta-neutral-gmx-vaults/blob/main/contracts/libraries/DnGmxJuniorVaultManager.sol#L288-L300 )

Assessed type

Oracle

#0 - c4-pre-sort

2023-08-06T03:23:24Z

minhquanym marked the issue as duplicate of #220

#1 - c4-judge

2023-09-19T11:41:45Z

dmvt marked the issue as duplicate of #245

#2 - c4-judge

2023-09-22T22:18:44Z

dmvt marked the issue as satisfactory

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