The pause function in the Timelock contract could be temporarily subjected to a DoS attack due to the unbounded iteration over the liveProposals array. #51
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
duplicate-24
partial-75
Incomplete articulation of vulnerability; eligible for partial credit only (75%)
🤖_06_group
AI based duplicate group recommendation
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-10-kleidi/blob/ab89bcb443249e1524496b694ddb19e298dca799/src/Timelock.sol#L687-L700
Vulnerability details
Proof of Concept
The Timelock contract has a
pause
function that pauses and deletes allactiveProposals
that were scheduled before or have already expired but were not cleaned up (https://github.com/code-423n4/2024-10-kleidi/blob/ab89bcb443249e1524496b694ddb19e298dca799/src/Timelock.sol#L691-L692). Because we simply iterate over allliveProposals
without any restrictions (an unbounded array), this means that more proposals result in a more expensivepause
function, and in some circumstances, this could become an issue. For example:liveProposals
array very large.PauseGuardian
tries to callpause
to stop the spam, allowing time to address the leaked private key.liveProposals
already contains over 1,000 entities, the loop that deletes each entity exceeds the available block gas limit for the current chain, causing thepause
transaction to fail.The only available option is to cancel or clean up those proposals manually. However, the problem is that the Timelock allows for the deletion of only one proposal (by id), and there is no batch cancel function. This means deleting entities one by one is ineffective because the attacker can spam transactions at the same or a higher frequency.
Recommended Mitigation Steps
Restrict the number of proposals a user can schedule, and add a function to cancel or clean up several proposal IDs at once.
Assessed type
DoS
The text was updated successfully, but these errors were encountered: