SafeHandler contract doesn’t have any method to call to ODSafeManager.allowHandler() , lead to DOS in some function
The SAFEHandler contract lacks any method to call ODSafeManager.allowHandler(), so the handlerCan mapping is never set for a safe handler. Consequently, the handlerAllowed modifier always reverts for enterSystem() and quitSystem(), making these functions uncallable.
tnquanghuy0512 Follow with 0xprinc, MrPotatoMagic and 3 others
Originally disclosed on Code4rena
Submitted by tnquanghuy0512, also found by 0xprinc, MrPotatoMagic, Baki, Tendency, and COSMIC-BEE-REACH
SafeHandler contract doesn’t have any method to call to ODSafeManager.allowHandler(). Because of that, functions in ODSafeManager contract which use handlerAllowed modifier will never be called successfully. There’re two function quitSystem() and enterSystem() that use handlerAllowed modifier.
Proof of Concept
This is the whole SAFEHandler contract, it doesn’t have any method that call to ODSafeManager.allowHandler()
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.19;
import {ISAFEEngine} from '@interfaces/ISAFEEngine.sol';
contract SAFEHandler {
constructor(address _safeEngine) {
ISAFEEngine(_safeEngine).approveSAFEModification(msg.sender);
}
}
Hence, it can’t call to allowHandler(), which give users permission to execute action within the safe
function allowHandler(address _usr, uint256 _ok) external {
handlerCan[msg.sender][_usr] = _ok;
emit AllowHandler(msg.sender, _usr, _ok);
}
Because of that, no one can surpass the handlerAllowed modifier with valid handler address:
modifier handlerAllowed(address _handler) {
if (msg.sender != _handler && handlerCan[_handler][msg.sender] == 0) revert HandlerNotAllowed();
_;
}
enterSystem() and quitSystem() use handlerAllowed modifier:
function enterSystem(address _src, uint256 _safe) external handlerAllowed(_src) safeAllowed(_safe)
function quitSystem(uint256 _safe, address _dst) external safeAllowed(_safe) handlerAllowed(_dst)
Recommended Mitigation Steps
I can think of two way to achieve this:
- Add a function in SafeHandler contract that can call to
ODSafeManager.allowHandler() - Add an immutable variable
SAFE_IDin SafeHandler contract and change this toODSafeManager.allowHandler():
- function allowHandler(uint256 _safeId, address _usr, uint256 _ok) external {
+ function allowHandler(address _usr, uint256 _ok) external {
+ SAFEData memory _sData = _safeData[_safeId];
+ require(_sData.owner == msg.sender);
- handlerCan[msg.sender][_usr] = _ok;
+ handlerCan[_sData.safeHandler][_usr] = _ok;
- emit AllowHandler(msg.sender, _usr, _ok);
}
The warden has demonstrated how
allowHandler()can never be called withmsg.senderas a user’s safe handler, causingenterSystem()andquitSystem()to become uncallable. As this affects the functionality of the protocol but does not cause any loss of assets or affect the protocol’s core functionality, I believe medium severity is appropriate.
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 SAFEHandler contract was not given a function to call ODSafeManager.allowHandler(), so the handlerCan mapping is never populated for the handler, causing the handlerAllowed modifier to always revert.
Impact
The functions enterSystem() and quitSystem() become uncallable, disrupting protocol functionality but not causing loss of assets.
What the attacker needed
None
The fix
Add a function in SAFEHandler that calls ODSafeManager.allowHandler(), or modify allowHandler to accept a safe ID and set permissions for the safe's handler after verifying ownership.
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 smart contract called SAFEHandler is supposed to give permission to another contract (ODSafeManager) so that certain actions can be performed on a safe. But SAFEHandler has no function to grant that permission, so the permission check always fails. As a result, two functions that let users enter or quit the system cannot be used at all.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.