Dopex - ArmedGoose's results

A rebate system for option writers in the Dopex Protocol.

General Information

Platform: Code4rena

Start Date: 21/08/2023

Pot Size: $125,000 USDC

Total HM: 26

Participants: 189

Period: 16 days

Judge: GalloDaSballo

Total Solo HM: 3

Id: 278

League: ETH

Dopex

Findings Distribution

Researcher Performance

Rank: 77/189

Findings: 2

Award: $109.80

QA:
grade-b

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

Labels

bug
2 (Med Risk)
satisfactory
sufficient quality report
duplicate-1032

Awards

90.6302 USDC - $90.63

External Links

Lines of code

https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/reLP/ReLPContract.sol#L286-L295

Vulnerability details

Impact

The code sets 0 minimal amount of tokens when adding liquidity. AddLiquidity operation is subject to the same slippage issues as swaps. Due to this, the protocol may suffer losses each time ReLP is used, as when it adds liquidity, it will suffer slippage.

Proof of Concept

Below code snippet from reLP shows the vulnerable function call. It uses IUniswapV2Router interface. According to UniswapV2 Docs the minimum amounts should be set in places marked below, but they are not.

(, , uint256 lp) = IUniswapV2Router(addresses.ammRouter).addLiquidity( addresses.tokenA, addresses.tokenB, tokenAAmountOut, amountB / 2, 0, //@audit uint amountAMin, 0, //@audit uint amountBMin, address(this), block.timestamp + 10 );

Tools Used

Manual approach

Enforce slippage in the same way as it is done in other functions using the slippageTolerance parameter like here.

Assessed type

MEV

#0 - c4-pre-sort

2023-09-07T12:53:16Z

bytes032 marked the issue as duplicate of #1259

#1 - c4-pre-sort

2023-09-11T07:51:21Z

bytes032 marked the issue as sufficient quality report

#2 - c4-pre-sort

2023-09-11T07:53:16Z

bytes032 marked the issue as duplicate of #1032

#3 - c4-judge

2023-10-15T19:21:17Z

GalloDaSballo marked the issue as satisfactory

Awards

19.1724 USDC - $19.17

Labels

bug
grade-b
QA (Quality Assurance)
sufficient quality report
edited-by-warden
Q-36

External Links

[Low-01] Redundant code Some of the code is not used throughout the project. Examples are: in UniV2Liquidity.sol:

in UniV3LiquidityAmo.sol:

  • Abstract contract OracleLike which is never used

[Low-02] Key and predictable state variables are not initialized There are some key state variables that in order for the protocol to work properly, have to be initialized. For example, the roles that are critical for the protocol or key tokens that anyway will be used. They still can be updated later, but initializing it as the values are predictable (e.g. we already know what tokens will be used and what roles will be used) makes the protocol more error-prone, as during manual setup some steps might be accidentally omitted, leaving the protocol in incorrect state.

The occurences are:

  • RdpxV2Core.sol only the first asset is initialized in constructor
  • Key roles are not set upfront, e.g. RDPXV2CORE_ROLE in RdpxDecayingBonds.sol is used in decreaseAmount and but never initialized, the same role is int PerpetualAtlanticVault.sol used in purchase, settle and payFunding but never initialized

Recommendation: Pre-initialize the known variables in constructor or in an initialization-like function.

[Low-03] RPC disclosure The unit tests contain a valid RPC URL which presumably may have some limitation and be related to a project maintained by the team. Once disclosed, it can be freely used by users throughout the internet or scrapped from github, and the team's limit for this RPC might be abused. Recommendation: After the contest, remove the URL and regenerate new one.

[Low-04] Missing whenNotPaused modifier In RdpxV2Bond there is no pause() check on mint, making the pause less effective. in contrary, it is implemented in decaying bonds on mint. However, the overall impact is negligible thus classified as low.

[Info-01] Bond mapping is not cleared after burn When a bond is burnt, in

#0 - c4-pre-sort

2023-09-10T11:55:06Z

bytes032 marked the issue as sufficient quality report

#1 - GalloDaSballo

2023-10-10T11:34:44Z

L-1 R

L-2 L

L-3 NC

L-4 L

NC-1 L

#2 - c4-judge

2023-10-20T10:21:53Z

GalloDaSballo 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