All options settlements can be blocked with a permanent DOS of the settle()
function
#1019
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-1227
edited-by-warden
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/perp-vault/PerpetualAtlanticVaultLP.sol#L201
https://github.com/code-423n4/2023-08-dopex/blob/main/contracts/perp-vault/PerpetualAtlanticVault.sol#L359-L361
Vulnerability details
Summary
The
PerpetualAtlanticVaultLP::subtractLoss()
function has a strict balance check with arequire
.By providing any amount of collateral to it, like 1 wei, the function will always revert. This function is used by the
PerpetualAtlanticVault::settle()
function, which is called by theRdpxV2Core::settle()
function.This will make the settle function always revert.
Impact
With a DOS of the
RdpxV2Core::settle()
function, no option can be settled. This can be undone as the strict balance check on thesubstractLoss()
function will always make the function revert.The attack is extremely cheap, and easy to exploit, just requiring the attacker to send 1 wei of collateral to the
PerpetualAtlanticVaultLP
contract at any time.Proof of Concept
The root of the finding is this strict equality check.
Once an attacker sends any amount of collateral tokens to the contract, the
require
statement will not pass, making the function always revert.PerpetualAtlanticVaultLP.sol#L201
This function is called by the
PerpetualAtlanticVault
on itssettle()
function:PerpetualAtlanticVault.sol#L359-L361
And originally,
PerpetualAtlanticVault::settle()
, is called within the Core contractsettle()
function:So, all option settlements can be prevented with a DOS of the
subtractLoss()
, function which will make all calls tosettle()
revert.Coded Proof of Concept
This tests shows how the
settle()
functions becomes DOS, after 1 wei of collateral is sent to the vault LP.Add this test to
tests/rdpxV2-core/Unit.t.sol
and runforge test --mt "testSettleDos"
:Tools Used
Manual Review
Recommended Mitigation Steps
Replace the strict equality with a
>=
:Assessed type
Invalid Validation
The text was updated successfully, but these errors were encountered: