Platform: Code4rena
Start Date: 13/12/2022
Pot Size: $36,500 USDC
Total HM: 5
Participants: 77
Period: 3 days
Judge: gzeon
Total Solo HM: 1
Id: 191
League: ETH
Rank: 20/77
Findings: 1
Award: $110.27
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: Trust
Also found by: Apocalypto, Madalad, Matin, aga7hokakological, evan, kaliberpoziomka8552, mookimgo, poirots, subtle77, wagmi, yixxas
110.2711 USDC - $110.27
Constant MONTH_IN_SECONDS
has incorrect value. Instead of 1 month, it has the value of 7 months.
// @dev about 30 days in a month uint256 immutable MONTH_IN_SECONDS = (3600 * 24 * 7) * 30; // @audit wrong value, could allow bufferTime and recoverTimelock become too long
This constant is used to check some settings in function initialize()
if (_settings.drawBufferTime < HOUR_IN_SECONDS) { revert REDRAW_TIMELOCK_NEEDS_TO_BE_MORE_THAN_AN_HOUR(); } if (_settings.drawBufferTime > MONTH_IN_SECONDS) { revert REDRAW_TIMELOCK_NEEDS_TO_BE_LESS_THAN_A_MONTH(); } if (_settings.recoverTimelock < block.timestamp + WEEK_IN_SECONDS) { revert RECOVER_TIMELOCK_NEEDS_TO_BE_AT_LEAST_A_WEEK(); } if ( _settings.recoverTimelock > block.timestamp + (MONTH_IN_SECONDS * 12) ) { revert RECOVER_TIMELOCK_NEEDS_TO_BE_LESS_THAN_A_YEAR(); }
As we can see, the last check make sure recoverTimelock
cannot be longer than 1 year, but because MONTH_IN_SECONDS
, value of recoverTimelock
could be mistakenly set to 7 years.
/// @dev 60 seconds in a min, 60 mins in an hour uint256 immutable HOUR_IN_SECONDS = 60 * 60; /// @dev 24 hours in a day 7 days in a week uint256 immutable WEEK_IN_SECONDS = (3600 * 24 * 7); // @dev about 30 days in a month uint256 immutable MONTH_IN_SECONDS = (3600 * 24 * 7) * 30;
Value of MONTH_IN_SECONDS
should be 3600 * 24 * 30
Manual Review
Correcting the value of MONTH_IN_SECONDS
to (3600 * 24 * 30)
#0 - c4-judge
2022-12-17T12:53:15Z
gzeon-c4 marked the issue as duplicate of #273
#1 - c4-judge
2022-12-17T12:53:50Z
gzeon-c4 marked the issue as satisfactory
#2 - c4-judge
2023-01-24T09:14:41Z
gzeon-c4 changed the severity to 2 (Med Risk)