Open hats-bug-reporter[bot] opened 5 months ago
Sorry is a missed some text in an part of the Description of the Diagram, but into the diagram itself can check that method removeSafe
, is possible to call from Root Safe and Super Safe, inclusive we check internally that: https://github.com/hats-finance/Palmera-0x5fee7541ddcd51ba9f4af606f87b2c42eea655be/blob/1ac35880b5d45154267788e2db548eaaae0beaa0/src/PalmeraModule.sol#L416, https://github.com/hats-finance/Palmera-0x5fee7541ddcd51ba9f4af606f87b2c42eea655be/blob/1ac35880b5d45154267788e2db548eaaae0beaa0/src/PalmeraModule.sol#L417, https://github.com/hats-finance/Palmera-0x5fee7541ddcd51ba9f4af606f87b2c42eea655be/blob/1ac35880b5d45154267788e2db548eaaae0beaa0/src/PalmeraModule.sol#L418
soo is Non-Issue, @0xRizwan @0xmahdirostami let me know your comments
@alfredolopez80 Upon further research on this issue, It seems the issue is valid. Below are my few points for your consideration:
IsRootSafe()
implementation can be checked here. This IsRootSafe()
modifier is used to Validate if the address is a Safe Smart Account Wallet and Root Safe.
and isRootSafeOf()
is implementation can be checked here and isRootSafeOf()
is used to check if the address, is a rootSafe of the safe within an organisation.
1) First point, All critical functions in PalmeraModule
contract like
setRole()
-Can only be accessed by root safe i.e IsRootSafe()
as well as it checks for isRootSafeOf()
in function.promoteRoot()
-Can only be accessed by root safe i.e IsRootSafe()
as well as it checks for isRootSafeOf()
in function.updateSuper()
-Can only be accessed by root safe i.e IsRootSafe()
as well as it checks for isRootSafeOf()
in function.disconnectSafe()
-Can only be accessed by root safe i.e IsRootSafe()
as well as it checks for isRootSafeOf()
in function.createRootSafe()
, -Can only be accessed by root safe i.e IsRootSafe()
removeWholeTree()
-Can only be accessed by root safe i.e IsRootSafe()
updateDepthTreeLimit()
-Can only be accessed by root safe i.e IsRootSafe()
addToList()
-Can only be accessed by root safe i.e IsRootSafe()
dropFromList()
-Can only be accessed by root safe i.e IsRootSafe()
enableAllowlist()
-Can only be accessed by root safe i.e IsRootSafe()
enableDenylist()
-Can only be accessed by root safe i.e IsRootSafe()
As you can see all of these critical functions can only be accessed by root safe
and has nothing to do with superSafe
access. If you observe carefully, in functions like disconnectSafe()
which also checks for isRootSafeOf()
as well as IsRootSafe()
. So similarly, removeSafe()
should use both isRootSafeOf()
as well as IsRootSafe()
, as highlighted by you removeSafe()
only checks for isRootSafeOf()
but it does not check the msg.sender is a safe root of safe smart wallet address so it must use IsRootSafe()
modifer as shown in above recommendation.
2) Second point, Based on Palmera documentation- superSafe
can not add or remove safe which is explicitely written in it can not
section.
3) Third point, the documentation is correct and stresses on ONLY use of safeRoot
Based on above points, its clear only root safe must be given access to removeSafe()
function.
OK, @0xRizwan letme clarify pount by point, why is Non-Issue and is only a expected behavior!!
removeSafe()
is a method not only for RootSafe, and I explained why in the role analysis the weakness was that in case a SuperSafe detected a ChildSafe that should not belong to its branches, it should wait for a RootSafe remove or disconnect them, which at an operational level can be very hierarchical, that is why it was decided (and this was a protocol design decision), to allow a SuperSafe to remove the ChildSafe that are below it in the first level Only, I mean and clarify this detail, the SuperSafe can only remove the Safe that has been connected to it at the level immediately below itself!!!. It is because of this that we cannot use the IsRootSafe() modifier because if we set this modifer, then only RootSafe would be able to execute this method. Additionally, it is important to clarify that the remove method produces a condition that has an additional Tier
Type called REMOVED, which basically leaves the safe disabled below the RootSafe of its branch, and waiting for it to decide when is the right time to disconnect it ( For example, if that Safe has assets from the Onchain Organization, the RootSafe can transfer it to another Safe of the Organization or to itself and then distribute it appropriately).
Github username: -- Twitter username: -- Submission hash (on-chain): 0x23a6cabda11ab9239e0276fc86820ace1efb5cb48b94811ea20f35345fe1e528 Severity: high
Description: Description\
removeSafe()
is used to remove safe and reasign all child to the superSafe. This is implemented as:The shared Palmera documentation specifically states:
The documentation states,
removeSafe()
MUST be called by root safe, however the current implementation does not implement it and unsafe from intended protocol design forremoveSafe()
. This would not ensure, the strict access control onremoveSafe()
as intended by Palmera protocol as the access to such critical function is given in wrong hands and no where it mentions to allowSafeRegistered()
to accessremoveSafe()
.Recommendation\ only allow root safe to access the
removeSafe()
function as intended in documentation.For example: Consider below changes: