SafeAccessControlEnumerableCaller and SafeOwnableCaller contracts lack access control
Two abstract helper contracts exposed privileged write functions without any access control, relying on inheriting contracts to override them. If an inheriting contract failed to override every write function, anyone could call the unoverridden privileged functions on the deployed contract.
prePO contest
Originally disclosed on Code4rena
The SafeAccessControlEnumerableCaller and SafeOwnableCaller contracts are abstract contracts that are used to call privileged functions in the SafeAccessControlEnumerable and SafeOwnable contracts.
Contracts that inherit from *caller are required to override the non-view functions in the *caller contract to prevent anyone from calling privileged functions in *caller.
But once the inheriting contract does not override all the non-view functions, anyone can call the unoverridden privileged functions in the *caller.
Since the functions implemented in the abstract contract are no longer forced to be implemented again by the inheriting contract, the contract can be deployed even if the inheriting contract does not override all the non-view functions.
Proof of Concept
Recommended Mitigation Steps
Consider adding simple access control to the *caller contract. Or instead of implementing functions in the *caller, provide the code as comments or documentation for use in inheriting contracts.
prePO (sponsor) confirmed and resolved:
Fixed in PR 352.
cccz (warden) reviewed mitigation:
Fixed by removing all write methods from
SafeOwnableCallerand SafeAccessControlEnumerableCallerto ensure that the inheriting contracts need to override all write methods. This will avoid missing out of access control on some critical write methods.
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 abstract caller contracts implemented privileged write functions without access control, relying on inheriting contracts to override them, which the compiler does not enforce.
Impact
Any inheriting contract that missed an override would let any user call the remaining privileged functions, potentially taking admin actions on that contract.
What the attacker needed
A contract inherits the caller without overriding all writes
The fix
The write methods were removed from both caller contracts so inheriting contracts must implement and protect every write method themselves; it was fixed in PR 352.
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 can inherit code from another contract, like a template. These two templates contained functions that call powerful admin actions, and they expected the child contract to replace each one with a protected version. If the child forgot one, that function stayed open and any user could trigger the admin action.
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.