Emergency mode enable/disable issue
The emergency mode in a smart contract could be toggled on and off by the owner, allowing them to perform emergency withdrawals and then disable emergency mode, which gives them a privileged position. An attacker with owner privileges could exploit this to withdraw funds without restrictions and then revert the contract to normal operation.
Submitted by reassor
Enabling emergency mode should be one way process that sets contract(s) in emergency mode. It should be not possible to revert that process, otherwise it puts owner of the contract(s) in very privileged position. Owner can trigger emergency mode, perform emergency withdrawal operations without any restrictions and then disable emergency mode.
Proof of Concept
Recommended Mitigation Steps
It is recommended to remove bool trigger parameter from triggerEmergencyWithdraw function and set emergency to true after successfully executing function.
Kogaroshi (Paladin) acknowledged and commented:
This Issue is acknowledged. The current emergency system will not be updated. During deployment, the admin of the contract will be set to be the Paladin DAO multisig, and the Governance will decide on admin decision for this contract. Yet we don’t want the emergency system to totally kill the contract, but to allow users to exit if there is an issue that can be remediated.
As much as any version of this contract that will be deployed as a single signer being admin of this system could present the risk of the presented scenario, in our case we use the layer that is the multisig to prevent this type of abuse.
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
The emergency mode can be disabled by the owner, making it a reversible privileged state rather than a one-way safety mechanism.
What the attacker needed
Owner privileges
The fix
The emergency mode should be made irreversible by removing the trigger parameter and setting emergency to true after a successful withdrawal.
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.
In a smart contract, an 'owner' is an account with special permissions. This report says the owner could turn on an 'emergency mode' that lets them take funds out, and then turn it off again, which is unfair because it gives them extra power. The fix is to make emergency mode permanent once activated.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.