Dopex - mrudenko'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: 147/189

Findings: 1

Award: $7.84

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

7.8372 USDC - $7.84

Labels

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

External Links

Lines of code

https://github.com/code-423n4/2023-08-dopex/blob/eb4d4a201b3a75dd4bddc74a34e9c42c71d0d12f/contracts/amo/UniV2LiquidityAmo.sol#L287

Vulnerability details

Impact

The lpTokenBalance state variable in the UniV2LiquidityAmo contract may become inconsistent with the actual LP token balance of the contract. This can occur if users add or remove liquidity directly through the Uniswap pool without using the contract's functions. Such inconsistency can lead to inaccurate calculations and unexpected contract behavior.

Proof of Concept

In the provided code section, the lpTokenBalance is updated based on the contract's interactions. However, if a user interacts directly with the Uniswap pool, this balance won't reflect the actual state.

function addLiquidity(uint amountA, uint amountB) external onlyOwner { // ... existing code ... // Call the sync function to ensure lpTokenBalance is consistent sync(); // ... rest of the function ... }

By adding the sync function call within the addLiquidity function (and similarly in other functions that change liquidity), we ensure that the lpTokenBalance state variable remains consistent with the actual LP token balance of the contract.

Tools Used

Manual review

Integrate the sync function call within all functions that change the liquidity to ensure the lpTokenBalance state variable remains consistent.

Assessed type

Context

#0 - c4-pre-sort

2023-09-09T03:52:01Z

bytes032 marked the issue as duplicate of #798

#1 - c4-pre-sort

2023-09-09T04:09:20Z

bytes032 marked the issue as duplicate of #269

#2 - c4-pre-sort

2023-09-11T11:58:21Z

bytes032 marked the issue as sufficient quality report

#3 - c4-judge

2023-10-15T18:13:28Z

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