Dopex - tnquanghuy0512'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: 149/189

Findings: 2

Award: $3.99

🌟 Selected for report: 0

🚀 Solo Findings: 0

Lines of code

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

Vulnerability details

Impact

Malicious users can send 1 wei of WETH to PerpetualAtlanticVaultLP to DOS the PerpetualAtlanticVaultLP.subtractLoss() function

Proof of Concept

  function subtractLoss(uint256 loss) public onlyPerpVault {
    require(
      collateral.balanceOf(address(this)) == _totalCollateral - loss, <@@ CAN DOS THIS EASILY BY DONATION ATTACK
      "Not enough collateral was sent out"
    );
    _totalCollateral -= loss;
  }

Tools Used

Manual Review

Change from == to >= in subtractLoss() function

-  collateral.balanceOf(address(this)) == _totalCollateral - loss
+  collateral.balanceOf(address(this)) >= _totalCollateral - loss

Assessed type

DoS

#0 - c4-pre-sort

2023-09-09T09:56:50Z

bytes032 marked the issue as duplicate of #619

#1 - c4-pre-sort

2023-09-11T16:14:28Z

bytes032 marked the issue as sufficient quality report

#2 - c4-judge

2023-10-20T19:31:26Z

GalloDaSballo marked the issue as satisfactory

Awards

3.9817 USDC - $3.98

Labels

bug
2 (Med Risk)
partial-25
sufficient quality report
edited-by-warden
duplicate-850

External Links

Lines of code

https://github.com/code-423n4/2023-08-dopex/blob/eb4d4a201b3a75dd4bddc74a34e9c42c71d0d12f/contracts/perp-vault/PerpetualAtlanticVault.sol#L237-L241

Vulnerability details

Impact

Execute PerpetualAtlanticVault.updateFundingDuration() make every variables in this contract got affected

If we update fundingDuration to a bigger value than before, nextFundingPaymentTimestamp() will be bigger than block.timestamp, make it DOS in most functions until block.timestamp surpass nextFundingPaymentTimestamp()

Tools Used

Manual Review

I think fundingDuration variable should not be change at all, so I'd recommend change the variable to be a constant

Assessed type

Other

#0 - c4-pre-sort

2023-09-08T06:26:01Z

bytes032 marked the issue as duplicate of #980

#1 - c4-pre-sort

2023-09-11T08:20:59Z

bytes032 marked the issue as sufficient quality report

#2 - c4-judge

2023-10-20T11:11:50Z

GalloDaSballo marked the issue as partial-25

#3 - GalloDaSballo

2023-10-20T11:11:52Z

Low quality but valid

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