Dopex - clash'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: 182/189

Findings: 1

Award: $0.01

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/perp-vault/PerpetualAtlanticVaultLP.sol#L201

Vulnerability details

Impact

  function subtractLoss(uint256 loss) public onlyPerpVault {
    require(
      collateral.balanceOf(address(this)) == _totalCollateral - loss,
      "Not enough collateral was sent out"
    );
    _totalCollateral -= loss;
  }

If collateral token balance is not equal to _totalCollateral - loss, it will revert. _totalCollateral is a state variable that can be updated using deposit/withdraw or by vault. Parameter loss is calculated in PerpetualAtlanticVault::settle from options. These variables cannot be controlled directly and the protocol assumes collateral token balance of the contract strictly follows rules. Malicious actor can break the assumption and grieve the protocol.

Proof of Concept

Send at least 1 wei of collateral token to PerpetualAtlanticVaultLP contract and the PerpetualAtlanticVault::settle would be broken.

Tools Used

Manual

Replace == with >= or <= as appropriate.

Assessed type

Token-Transfer

#0 - c4-pre-sort

2023-09-09T09:52:54Z

bytes032 marked the issue as duplicate of #619

#1 - c4-pre-sort

2023-09-11T16:14:13Z

bytes032 marked the issue as sufficient quality report

#2 - c4-judge

2023-10-21T07:14:27Z

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