Tigris Trade contest - aviggiano's results

A multi-chain decentralized leveraged exchange featuring instant settlement and guaranteed price execution on 30+ pairs.

General Information

Platform: Code4rena

Start Date: 09/12/2022

Pot Size: $90,500 USDC

Total HM: 35

Participants: 84

Period: 7 days

Judge: GalloDaSballo

Total Solo HM: 12

Id: 192

League: ETH

Tigris Trade

Findings Distribution

Researcher Performance

Rank: 51/84

Findings: 2

Award: $134.51

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

Labels

bug
3 (High Risk)
satisfactory
upgraded by judge
edited-by-warden
duplicate-462

Awards

133.3608 USDC - $133.36

External Links

Lines of code

https://github.com/code-423n4/2022-12-tigris/blob/b2ebb8ea1def4927a747e7a185174892506540ab/contracts/StableVault.sol#L78-L83 https://github.com/code-423n4/2022-12-tigris/blob/b2ebb8ea1def4927a747e7a185174892506540ab/contracts/StableVault.sol#L65-L72

Vulnerability details

Impact

The current StableVault design states that its purpose is to allow for many tokens of the same kind (such as USDC/DAI/USDT) to be used to trade on Tigris without splitting up the liquidity into multiple individual pools. Each one of these underlying tokens is redeemable 1:1 by their tigUSD vault token counterpart.

The problem arises when the vault contains more than one type of token and one of those depegs, which may render the vault insolvent. For example, if the vault supports USDC/DAI/USDT and USDT goes to zero (because of regulatory issues, market conditions, etc.), users might want to withdraw all the other assets, which makes the other valuable assets "tainted" together with a zero-valued asset on the same pool.

Proof of Concept

  1. Tigris creates a StableVault with USDC/USDT
  2. Users deposit 100 USDC and 100 USDT in the vault, which mints 200 tigUSD. At this time, each tigUSD is valued $1 and can be converted to either 1 USDC or 1 USDT
  3. Because of market conditions, USDT goes to zero, making 1 tigUSD worth $0.5
  4. Users wanting to withdraw their assets will likely request USDC, but only the first ones to do it will be able. Latecomers will find a vault emptied out with USDC, with only USDT remaining, now worth 0.

Tools Used

Manual analysis

Consider modifying the StableVault design mechanism to a battle-tested one similar to Curve's StableSwap, which takes into account market behavior on the liquidity pool.

#0 - c4-judge

2022-12-20T16:12:41Z

GalloDaSballo marked the issue as duplicate of #462

#1 - c4-judge

2022-12-20T16:13:19Z

GalloDaSballo changed the severity to 3 (High Risk)

#2 - c4-judge

2023-01-22T17:36:57Z

GalloDaSballo marked the issue as satisfactory

Awards

1.1472 USDC - $1.15

Labels

bug
2 (Med Risk)
satisfactory
sponsor acknowledged
edited-by-warden
duplicate-377

External Links

Lines of code

https://github.com/code-423n4/2022-12-tigris/blob/b2ebb8ea1def4927a747e7a185174892506540ab/contracts/Trading.sol#L926-L933

Vulnerability details

Impact

The Tigris protocol does not have enough boundary conditions that prevent a malicious owner to steal users' funds. By using some onlyOwner actions, it is possible, for example, to call Trading.setMaxWinPercent to any arbitrary value, including one greater than 100%, which would make it possible to open a position and close it with an arbitrarily high payout, allowing it to steal all the vault's funds.

Even if we trust the protocol owner, we believe this is an unnecessary and serious centralization risk. A malicious or compromised owner address can take advantage of this, and steal all the funds from the protocol.

Proof of Concept

  1. Alice, a malicious protocol owner, opens a position, and immediately calls for Trading.setMaxWinPercent, setting the max win percent as an extremely large number, enough to empty the whole vault.
  2. As a result, all the users' funds from the protocol are drained.

Tools Used

Manual analysis

Impose boundary checks for all owner-controlled actions. For example, a maximum value for maxWinPercent. Review other functions with onlyOwner modifier and validate if the scope of these actions can be limited in order to reduce the damage of a potential incident.

#0 - TriHaz

2022-12-26T08:22:06Z

We are aware of the centralization risks, owner of all contracts will be the multi-sig treasury for now, until we have a fully decentralized DAO.

#1 - c4-sponsor

2022-12-26T08:22:12Z

TriHaz marked the issue as sponsor acknowledged

#2 - c4-judge

2023-01-15T15:52:12Z

GalloDaSballo marked the issue as duplicate of #377

#3 - GalloDaSballo

2023-01-15T15:52:22Z

Admin privilege risk

#4 - c4-judge

2023-01-22T17:34:41Z

GalloDaSballo 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