Skip to content
Access control Audit finding Intermediate

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.

WatchPug Follow

Originally disclosed on Code4rena

Submitted by WatchPug, also found by Meta0xNull, gzeon, fatimanaz, 0x0x0x, and ksk2345_

IbbtcVaultZap.sol L116-L119

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.

The original report as published on Code4rena, by WatchPug. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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.

More by WatchPug

View all

197 more disclosed reports, best first.

More from BadgerDAO Zaps contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

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.