Skip to content

[security] Lock down DEFAULT_ADMIN_ROLE after deploy — grantRole is a capture bypass #2028

Closed

Description

@alpergundogdu

Summary

The TimelockController holds DEFAULT_ADMIN_ROLE on every contract, so governance can grantRole/revokeRole (inherited AccessControl) to hand GOVERNANCE_ROLE or PAUSER_ROLE to any address. This is a meta-lever that bypasses every other hardening fix — freezing individual setters is moot if governance can simply grant itself (or an attacker) a fresh role on any contract.

Impact

Fix

After deploy wiring completes, renounce DEFAULT_ADMIN_ROLE so the role assignments become immutable — no path to add or rotate role-holders on any contract. Any role that genuinely must remain rotatable (e.g. buyback keeper) keeps its own scoped admin, explicitly and minimally, rather than the blanket DEFAULT_ADMIN_ROLE.

  • Audit every grantRole/revokeRole reachability and every role's admin (getRoleAdmin) across all contracts; confirm nothing but the intended minimal set survives renunciation.

Acceptance criteria

  • Post-deploy, no live holder of DEFAULT_ADMIN_ROLE (or it's provably scoped to nothing dangerous).
  • Deploy script asserts the final role table and renounces admin; test proves no new GOVERNANCE_ROLE/PAUSER_ROLE grant is possible afterward.

Activity

  1. added
    prio:critical
    kind:security
    on Sep 15, 2026
  2. alpergundogdu commented on Sep 15, 2026

    @alpergundogdu
    ContributorAuthor

    Deferred pending a team decision on the renunciation strategy. Renouncing the blanket DEFAULT_ADMIN_ROLE at deploy end freezes all role grants forever, which forces a fork: which roles, if any, stay rotatable?

    A — Max immutability: renounce DEFAULT_ADMIN entirely; every role frozen, including PAUSER and GOVERNANCE. Simplest. Downside: a compromised emergency pauser can't be rotated out, and governance can't migrate to a successor Governor — both require a full redeploy.

    B — (leaning): renounce DEFAULT_ADMIN, but make PAUSER_ROLE governance-administered (_setRoleAdmin(PAUSER_ROLE, GOVERNANCE_ROLE) in each pausable contract's constructor) so governance can rotate the emergency pauser via a timelocked proposal — important since a compromised pauser could grief by pausing intake. Leave GOVERNANCE_ROLE frozen (migration = redeploy, consistent with the no-proxy philosophy).

    C — B plus make GOVERNANCE_ROLE self-administered, so governance can hand GOVERNANCE_ROLE to a successor Governor without redeploying (a migration path). Adds no capture risk (a captured governance already controls the contract) but is a genuine extra power.

    The other 7 hardening issues in this milestone are implemented in #2038. This one is blocked on A/B/C.

  3. alpergundogdu commented on Sep 17, 2026

    @alpergundogdu
    ContributorAuthor

    Decision: go with B, extended beyond PAUSER_ROLE. Reject A and C.

    The milestone premise is: a captured or malicious governance must never reach a state the electorate can't vote its way back out of. Framed that way, DEFAULT_ADMIN_ROLE is the last open entrenchment hole, and the three options land very differently against it.

    The precise danger — not "governance can change things," but capture becoming permanent and unilateral

    DEFAULT_ADMIN is a master key over the role table. The sharp escalation is grantRole(GOVERNANCE_ROLE, attackerEOA):

    • Every governance setter is onlyRole(GOVERNANCE_ROLE), and the Timelock is just an address holding that role.
    • Grant GOVERNANCE_ROLE to a plain EOA and that EOA passes the same check — so it calls setShares, setWindowEpochs, etc. directly: no vote, no served-bytes weight, no 48h Timelock delay.

    So DEFAULT_ADMIN converts a transient, vote-gated, delayed capture (win each proposal, wait out the timelock) into permanent, unilateral, instant control (own a standing key that answers to nobody). Capture stops being something the electorate can reverse. That is the whole reason this issue is critical/prod-blocking, and it's a strictly worse failure than any individual frozen setter.

    Worth stating for scope: DEFAULT_ADMIN cannot resurrect the levers #2038 made immutable — no grantRole un-deletes setFeeRouter or rewrites an immutable. Its residual power is narrow but potent: mint/rotate holders of roles that still gate live functions, above all GOVERNANCE_ROLE itself.

    Correction to option C's premise

    The issue says C "adds no capture risk (a captured governance already controls the contract)." That's not quite right. Making GOVERNANCE_ROLE self-administered reopens exactly the grantRole(GOVERNANCE_ROLE, attackerEOA) escalation above. C's marginal risk isn't "more control" — it's immediacy and permanence: it lets a one-time captor drop the vote-and-wait envelope and hand themselves a standing key. C trades the entire Timelock+vote safety net for a migration convenience. Not free; reject.

    Why B, and why it must cover more than PAUSER

    B renounces the blanket DEFAULT_ADMIN but scopes the narrow, key-holder roles to GOVERNANCE_ROLE via _setRoleAdmin. Result:

    • GOVERNANCE_ROLE → frozen (admin is the now-unheld DEFAULT_ADMIN) → the entrenchment escalation is closed. Governance migration = redeploy, consistent with the no-proxy philosophy.
    • Key-holder roles → governance-administered → a compromised off-chain key can still be rotated out via a timelocked proposal.

    The issue only names PAUSER_ROLE. It should also cover the other roles with the same off-chain-key compromise exposure:

    • PAUSER_ROLE — PaymentPool, FeeRouter, CapacityBond, SlashJudge, SlashAppeal, BuybackBurner
    • EMERGENCY_MULTISIG_ROLE — ContentBlacklist, SlashAppeal
    • KEEPER_ROLE — BuybackBurner

    All three are held by an off-chain multisig/bot whose keys can be lost or stolen. VETTER_ROLE (ManualVettingPolicy) is already GOVERNANCE_ROLE-administered — same pattern, precedent exists.

    The contract-held roles (ROUTER_CALLER_ROLE, SLASH_ROLE, SLASH_APPEAL_ROLE, BLACKLIST_ROLE) point at immutable protocol-contract addresses — leave them frozen under the renounced DEFAULT_ADMIN. Replacing one of those is a redeploy anyway.

    Interaction with the pause kill-switch (deliberately not changing it)

    We are keeping the indefinite pause on purpose: pause() with no unpause() is a valid escape hatch for pausing/abandoning a faulty contract. That decision is why rotatable PAUSER matters — a compromised pauser could grief by freezing intake indefinitely (and, since the vote feed runs through FeeRouter.routeSettlement, a sustained FeeRouter pause eventually drains the trailing vote window, which is a separate accepted risk). Keeping PAUSER_ROLE governance-administered under B preserves the ability to evict such a pauser while the electorate still has standing. B is the fix that keeps our chosen kill-switch from becoming an un-evictable griefing lever.

    Implementation shape (maps to the acceptance criteria)

    1. In each affected contract's constructor: _setRoleAdmin(PAUSER_ROLE, GOVERNANCE_ROLE) (and EMERGENCY_MULTISIG_ROLE, KEEPER_ROLE where present). _setRoleAdmin is internal and ungated at construction, same as the existing VETTER_ROLE line.
    2. Deploy handoff: after all wiring, renounce DEFAULT_ADMIN_ROLE on every target (drop it from the deployer without granting it onward to the Timelock — the Timelock keeps only GOVERNANCE_ROLE). Handle the genesis-activated BuybackBurner in the same sweep.
    3. Flip the deploy assertions: _assertNoBackDoors / _requireRole currently assert the Timelock holds DEFAULT_ADMIN; they must assert no holder of DEFAULT_ADMIN on every target, and assert the scoped getRoleAdmin values (PAUSER/EMERGENCY_MULTISIG/KEEPER → GOVERNANCE_ROLE).
    4. Audit every grantRole/revokeRole reachability and every getRoleAdmin across all contracts; confirm the only surviving grant power post-renounce is GOVERNANCE_ROLE-administered rotation of the three key-holder roles, and that no path can mint a new GOVERNANCE_ROLE holder.
    5. Test: prove grantRole(GOVERNANCE_ROLE, x) and grantRole(<any contract-held role>, x) both revert post-handoff (no admin), while a timelocked governance proposal can still rotate PAUSER/EMERGENCY_MULTISIG/KEEPER.

    Net: A over-freezes (can't evict a rogue pauser — bad, given we're keeping the indefinite pause). C quietly re-arms the worst lever. B, extended to EMERGENCY_MULTISIG/KEEPER, reduces capture danger to reversible-only without kneecapping key rotation.

  4. moved this from Backlog to In progress in deCDNon Sep 17, 2026
  5. moved this from In progress to Done in deCDNon Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind:securityprio:critical

Type

No type

Fields

Priority

None yet

Projects

  • Status
    Done

Relationships

None yet

Development

No branches or pull requests

Issue actions