Open code423n4 opened 1 year ago
"so DO NOT mark it as dupliate of the other one." -> I don't understand, is this an order (in which case it is a bit inappropriate), or a discussion between the warden and someone?
Picodes changed the severity to 2 (Med Risk)
Picodes marked the issue as primary issue
manoj9april marked the issue as sponsor confirmed
Sure, we will fix this.
Picodes marked issue #252 as primary and marked this issue as a duplicate of 252
Picodes marked the issue as selected for report
Isn't this same as just transfer role to the address 0 or any other address? Why protocol will need to change role to same address? Isn't this informative issue?
I believe this fall under the "Admin Privilege" category as such an issue should be marked as QA based on C4 docs and how similar issues got judged.
@rvierdiyev @Co0nan I respectfully disagree:
initialize
there is no call to setAccount(ADMIN, _admin);
(see https://github.com/code-423n4/2022-06-stader-findings/issues/133) then it becomes actually likely that the admin calls this function for himself@Co0nan for information "Admin Privilege" aren't always QA, it depends on the context and is up to the judge. See https://github.com/code-423n4/org/issues/54 and https://github.com/code-423n4/org/issues/59 for the ongoing discussion about this.
Here there is clearly a slight bug in the code.
@Picodes personally I got my reports downgraded to QA even though the bug was clearly in the code itself but because it only occurs through an action taken by a privileged user it's downgraded. Here, this bug occurs from Admin as he passes an address twice. I have to stand with @rvierdiyev this is likely to missing Zero address Check on onlyOwner functions.
However, It's up to you as the Judge and I respect your final conclusion.
This is fixed in the code
Lines of code
https://github.com/code-423n4/2023-06-stader/blob/7566b5a35f32ebd55d3578b8bd05c038feb7d9cc/contracts/StaderConfig.sol#L176-L183
Vulnerability details
Current admin will lose DEFAULT_ADMIN_ROLE role if updateAdmin issued with same address.
Impact
The is a possibility of loss of protocol admin access to this critical StaderConfig.sol contract, if updateAdmin() is set with same current admin address by mistake.
Proof of Concept
Contract : StaderConfig.sol Function : function updateAdmin(address _admin)
Using Brownie python automation framework commands in below examples.
Step#1 After initialization, admin-A is the admin which has the DEFAULT_ADMIN_ROLE
Step#2 update new Admin StaderConfig.updateAdmin(admin-B, {'from':admin-A}) The value of StaderConfig.getAdmin() is admin-B
Step#3 admin-B updates admin to itself again StaderConfig.updateAdmin(admin-B, {'from':admin-B}) The value of StaderConfig.getAdmin() is admin-B, but the DEFAULT_ADMIN_ROLE is revoked due to _revokeRole(DEFAULT_ADMIN_ROLE, oldAdmin); Now the protocol admin control is lost for StaderConfig contract
Recommended Mitigation Steps
Ref : https://github.com/code-423n4/2023-06-stader/blob/7566b5a35f32ebd55d3578b8bd05c038feb7d9cc/contracts/StaderConfig.sol#L177 In the updateAdmin() function, add a check for oldAdmin != _admin , like below