Issue:
It is observed that current owner can designate a new owner by calling setAdmin function at Swivel.sol#L428 in a single step. This is a risky operation which could lead to access loss for all Admin privilleged functions
Steps:
Current Admin accidentally sets the new Admin incorrectly
Since new Admin was set incorrectly, all functions requiring Admin privillege cannot be accessed like withdraw, authRedeemZcToken etc
Recommendation:
It is recommended to move to a two step Admin change.
a. First function should decide the pending owner
b. Second function which is only callable by pending owner should actually change the Admin
Issue:
ecrecover returns empty (0x0) address when the signature is invalid. validOrderHash indirectly makes use of ecrecover while checking Signatures and missing the zero address checking
Steps:
Assume validOrderHash function is called with an invalid signature.
Now if order maker is address 0 (not sure even if it is possible) then this order will be considered valid which is incorrectly (Since o.maker and recovered both are zero address)
Admin change should be 2 step process
Contract: https://github.com/code-423n4/2022-07-swivel/blob/main/Swivel/Swivel.sol#L428
Issue: It is observed that current owner can designate a new owner by calling setAdmin function at Swivel.sol#L428 in a single step. This is a risky operation which could lead to access loss for all Admin privilleged functions
Steps:
Recommendation: It is recommended to move to a two step Admin change.
a. First function should decide the pending owner b. Second function which is only callable by pending owner should actually change the Admin
Recovered address should not be zero
Contract: https://github.com/code-423n4/2022-07-swivel/blob/main/Swivel/Swivel.sol#L693
Issue: ecrecover returns empty (0x0) address when the signature is invalid. validOrderHash indirectly makes use of ecrecover while checking Signatures and missing the zero address checking
Steps:
Recommendation: Add zero address check
Existing timelock gets delayed
Issue: If admin accidentally calls scheduleApproval twice on same address then Timelock will get extended even though address for approval is same
Steps:
Recommendation: Add a check to see if approval is already requested for a given address