Skip to content
Access control Audit finding Intermediate

Missleading onlyDAO modifiers

Several contracts have an onlyDAO modifier that incorrectly allows the deployer (and sometimes only the deployer) to execute privileged functions, rather than restricting access to the DAO. This creates a centralisation risk, as the deployer can perform actions intended for the DAO, and in some cases the deployer cannot be removed, leading to systemic risk.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel, 0xRajeev, 0xsanson, gpersoon, also found by hickuphh3 and shw

Several contracts implement an onlyDAO modifier which, as the name suggests, should only authorize the function to be executed by the DAO. However, some implementations are wrong and either allow the DAO or the deployer to execute, or even only the deployer:

Incorrect implementations:

  • BondVault.onlyDAO: allows deployer + DAO
  • DAO.onlyDAO: allows deployer
  • DAOVault.onlyDAO: allows deployer + DAO
  • poolFactory.onlyDAO: allows deployer + DAO
  • Router.onlyDAO: allows deployer + DAO
  • Synth.onlyDAO: allows deployer
  • synthFactory.onlyDAO: allows deployer
  • synthVault.onlyDAO: allows deployer + DAO

In all of these functions, the deployer may execute the function as well which is a centralization risk. The deployer can only sometimes be purged, as in synthFactory, in which case nobody can execute these functions anymore.

Recommend renaming it to onlyDeployer or onlyDeployerOrDAO depending on who has access.

verifyfirst (Spartan) acknowledged:

This is by design a choice. However, there are current discussions around renaming the high level access modifiers to be more descriptive in their purpose.

ghoul-sol (judge) commented:

This is a non-critical issue because there’s no in-code bugs, it’s rather error-prone naming.

ghoul-sol (judge) commented:

On second look, I’ll keep it a medium risk as deployer cannot be purged in all contracts which introduces systemic risk.

The original report as published on Code4rena, by cmichel. 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

Root cause

Likely the modifier logic incorrectly checks the caller against the deployer address instead of (or in addition to) the DAO address.

Impact

The deployer can execute functions intended only for the DAO, and in some contracts the deployer cannot be purged, so if the deployer is removed, those functions become unusable, introducing systemic risk.

What the attacker needed

Deployer is an attacker or compromised; DAO cannot purge deployer in some contracts

The fix

The modifier should be renamed to onlyDeployer or onlyDeployerOrDAO to reflect actual access, or the logic should be corrected to restrict access to the DAO only.

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.

A modifier is a piece of code that checks who is allowed to run a function. Here, a modifier named onlyDAO was supposed to let only the DAO (a decentralised organisation) run certain functions, but it actually let the deployer (the person who deployed the contract) run them too, or even only the deployer. This means the deployer has extra power they should not have, which is a centralisation risk.

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 cmichel

View all

196 more disclosed reports, best first.

More from Spartan Protocol 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.