Closed c4-bot-8 closed 7 months ago
If the attacker immediately calls the confirmBaseInterestAllocator() function with _newBaseInterestAllocator = address(0), the getPendingBaseInterestAllocator will reset, preventing the owner from ever setting a new base interest allocator.
If the attacker calls confirmBaseInterestAllocator()
with the zero address then the owner can call this again with the right address.
If the attacker calls this with anything else then the owner can call again setBaseInterestAllocator()
and then confirmBaseInterestAllocator()
Tending to mark this as low severity
0xA5DF marked the issue as primary issue
Low sev
0xA5DF changed the severity to QA (Quality Assurance)
Marking as low due to my explanation above
0xA5DF marked the issue as grade-c
Moved to #70
Lines of code
https://github.com/code-423n4/2024-04-gondi/blob/b9863d73c08fcdd2337dc80a8b5e0917e18b036c/src/lib/pools/Pool.sol#L202
Vulnerability details
Impact
The base interest allocator is set in the Pool through two steps:
setBaseInterestAllocator()
andconfirmBaseInterestAllocator()
. TheconfirmBaseInterestAllocator()
function can be called by anyone.This function executes the logic using the
_newBaseInterestAllocator
input from the caller, not the value set by the owner insetBaseInterestAllocator()
. The check for_newBaseInterestAllocator == getPendingBaseInterestAllocator
is only done whencachedAllocator != address(0)
.After all, the pending values are reset.
getPendingBaseInterestAllocator
is reset toaddress(0)
andgetPendingBaseInterestAllocatorSetTime
is reset totype(uint256).max
. An attacker could exploit this to prevent the owner from changing the allocator address fromaddress(0)
.Proof of Concept
When the owner tries to change the allocator address from an
address(0)
allocator, they need to callsetBaseInterestAllocator()
. This function records the request ingetPendingBaseInterestAllocator
andgetPendingBaseInterestAllocatorSetTime
.If the attacker immediately calls the
confirmBaseInterestAllocator()
function with_newBaseInterestAllocator = address(0)
, thegetPendingBaseInterestAllocator
will reset, preventing the owner from ever setting a new base interest allocator.Tools Used
Manual Review
Recommended Mitigation Steps
Only allow owner to call
confirmBaseInterestAllocator()
.Assessed type
DoS