This repository has been archived by the owner on May 26, 2023. It is now read-only.
GimelSec - Invalid expiration blocks users from refunding, and also causes abuses of bounty contracts #495
Labels
Duplicate
A valid issue that is a duplicate of an issue with `Has Duplicates` label
High
A valid High severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
GimelSec
high
Invalid expiration blocks users from refunding, and also causes abuses of bounty contracts
Summary
In the document, the expiration of the deposit should be a number of days, but the
_expiration
could be a number of seconds. The invalid_expiration
could block users from refunding, and also causes abuses of bounty contracts.Vulnerability Detail
In document Deposit Period Days:
It defines a number of days, but the
_expiration
parameter is a number of seconds. Any user could deposit their funds and refund them only after a second.An example of an exploit scenario is that an attacker could maliciously increase the length of
deposits
array to become a large length (by repeatedly funding and refunding due to the cheap gas fee on Polygon), causing anyone being unable to refund.Because
refundDeposit()
callsbounty.getLockedFunds(depToken)
to calculateavailableFunds
, but a large length ofdeposits
will trigger the gas limit DoS of the for loop, the transaction will be reverted in the for loop ofgetLockedFunds()
.Impact
There are some scenario examples in this issue.
deposits
array to become a large length (by repeatedly funding and refunding due to the cheap gas fee on Polygon), causing anyone being unable to refund due to the gas limit DoS ofbounty.getLockedFunds(depToken)
inrefundDeposit()
.Code Snippet
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/DepositManager/Implementations/DepositManagerV1.sol#L40
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/DepositManager/Implementations/DepositManagerV1.sol#L83
https://github.com/sherlock-audit/2023-02-openq/blob/main/contracts/DepositManager/Implementations/DepositManagerV1.sol#L117
Tool used
Manual Review
Recommendation
Use
_expiration * 86400
infundBountyToken()
:The same fix in
extendDeposit()
andfundBountyNFT()
.Duplicate of #77
The text was updated successfully, but these errors were encountered: