Rescue request timestamp not reset in TapiocaOptionLiquidityProvision.sol contract
The contract does not reset the rescue request timestamp after an asset is rescued, so if the same asset is added back, it can be rescued immediately without the intended cooldown. This bypasses a protection mechanism, allowing the admin to skip the waiting period.
carrotsmuggler Follow with immeas
Originally disclosed on Code4rena
Submitted by carrotsmuggler, also found by immeas
Impact
In order to put an asset in rescue mode, the admin first needs to call requestSglPoolRescue. This will start a cooldown period and the rescue can only be triggered after the cooldown period has passed. This is evident from the code in the activateSglPoolRescue function.
if (block.timestamp < sglRescueRequest[sgl.sglAssetID] + rescueCooldown) revert RescueCooldownNotReached();
The issue is that once the rescue has been carried out, the value in sglRescueRequest[sgl.sglAssetID] is not reset. This means if the same asset is added back in, it will now not have any cooldown anymore. The contract will treat the asset as if the rescue request is still ongoing.
The requestSglPoolRescue cannot be called to reset the cooldown, since the value stored is non 0. Since this bypasses a protection mechanism put in place by the devs, this is a medium severity issue.
Proof of Concept
The problem arises when an asset is rescued, and then added back in. sglRescueRequest[sgl.sglAssetID] is left untouched, and so after being added back in it can be immediately rescued without any cooldown time.
Recommended Mitigation Steps
Delete the entry in the sglRescueRequest mapping when the asset is rescued via the activateSglPoolRescue function.
0xRektora (Tapioca) confirmed, but disagreed with severity and commented:
Informational.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the contract fails to delete the rescue request timestamp after a rescue, leaving stale state that bypasses the cooldown for re-added assets.
Impact
The cooldown protection can be bypassed for re-added assets, allowing immediate rescue without the intended delay.
What the attacker needed
Admin privileges; asset must be rescued and re-added
How it was found
- Admin calls requestSglPoolRescue to start cooldown.
- After cooldown, admin calls activateSglPoolRescue to rescue the asset.
- The rescue request timestamp is not reset.
- The same asset is added back.
- The asset can be rescued immediately without cooldown.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A rescue mode lets an admin recover assets, but it requires a waiting period after requesting it. The contract forgets to clear the request time after a rescue, so if the same asset is added again, the waiting period is skipped. This means the safety delay can be bypassed.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.