The applyCover() function is called by the insurance pool owner and intends to store data related to an insurance incident. Upon function execution, applyCover() iterates over all available index markets and calls lock(), denying all deposits and withdrawals from IndexTemplate.sol. However, due to the fact that IndexTemplate.resume() does not perform a proper check on PoolTemplate.sol, anyone can resume the market immediately and continue to deposit and withdraw while the insurance pool is paying out for an incident.
This may cause issues when the insurance pool resumes as any insolvency must be compensated from these other markets. By not locking pools during incident payouts, users can avoid having to compensate the insurance pool.
Consider fixing the IndexTemplate.resume() function such that it also checks if IPoolTemplate(poolList[i]).marketStatus() == MarketStatus.Trading. This should properly enforce the lock while the insurance pool pays out funds to the policy holder(s).
Handle
leastwood
Vulnerability details
Impact
The
applyCover()
function is called by the insurance pool owner and intends to store data related to an insurance incident. Upon function execution,applyCover()
iterates over all available index markets and callslock()
, denying all deposits and withdrawals fromIndexTemplate.sol
. However, due to the fact thatIndexTemplate.resume()
does not perform a proper check onPoolTemplate.sol
, anyone can resume the market immediately and continue to deposit and withdraw while the insurance pool is paying out for an incident.This may cause issues when the insurance pool resumes as any insolvency must be compensated from these other markets. By not locking pools during incident payouts, users can avoid having to compensate the insurance pool.
Proof of Concept
https://github.com/code-423n4/2022-01-insure/blob/main/contracts/PoolTemplate.sol#L655-L686
https://github.com/code-423n4/2022-01-insure/blob/main/contracts/IndexTemplate.sol#L459-L481
Tools Used
Manual code review. Discussions with Oishun.
Recommended Mitigation Steps
Consider fixing the
IndexTemplate.resume()
function such that it also checks ifIPoolTemplate(poolList[i]).marketStatus() == MarketStatus.Trading
. This should properly enforce the lock while the insurance pool pays out funds to the policy holder(s).