setGuardian() Wrong implementation
The setGuardian function in two zap contracts assigns the new address to the governance variable instead of the guardian variable. An attacker who gains the guardian role could therefore overwrite governance, though the text does not show this being exploited.
Submitted by WatchPug, also found by Meta0xNull, gzeon, fatimanaz, 0x0x0x, and ksk2345_
function setGuardian(address _guardian) external {
_onlyGovernance();
governance = _guardian;
}
SettToRenIbbtcZap.sol L130-L133
function setGuardian(address _guardian) external {
_onlyGovernance();
governance = _guardian;
}
governance = _guardian should be guardian = _guardian.
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
What the attacker needed
Governance calls setGuardian; attacker controls the new guardian address
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.
These smart contracts have two special roles: a governance role that controls the contract and a guardian role meant for a lesser, safety-related job. The function that is supposed to change the guardian accidentally changes the governance role instead. That means whoever is set as guardian could end up with the top-level control they were never meant to have.
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.