Skip to content
Access control Audit finding Intermediate

Previous owner still hold manager role after ownership transfer

The Manager contract does not automatically revoke the previous owner's manager role when ownership is transferred. If the previous owner's account is compromised, an attacker could use the retained manager privileges to call reward distribution functions and redirect rewards to their own address.

merlinboii Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#41659 [SC-Insight] Previous owner still hold manager role after ownership transfer

Submitted on Mar 17th 2025 at 11:19:43 UTC by @merlinboii for Audit Comp | Yeet

Description

Brief/Intro

The Manager contract allows previous owners to retain their manager role even after ownership transfer. This could lead to unauthorized access to manager's privileged functions: executeRewardDistributionYeet() and executeRewardDistribution(). If proper role cleanup is not performed manually, potentially compromising the protocol's access control system.

Vulnerability Details

Manager roles handling in the Manager contract are not automatically revoked during ownership transfer:

  1. In the constructor, both owner and manager get manager roles:
Solidity
constructor(address _owner, address _manager) Ownable(_owner) {
    managers[_owner] = true;
    managers[_manager] = true;
}
  1. When ownership is transferred using Ownable's transferOwnership, the previous owner's manager status remains as there is no override logic to cleanup of manager roles:
  2. The removeManager function exists but must be called manually:
Solidity
function removeManager(address _manager) external override onlyOwner {
    require(managers[_manager], "Manager does not exist");
    require(_manager != address(0), "Invalid address");
    managers[_manager] = false; 
}

Impact Details

This could be considered a Security best practicesassuming that all setup roles are trusted, including the previous owner, who was trusted before the transfer.

However, if the previous owner was compromised and their address has not yet been removed from the manager role, it creates an opportunity for an attacker to frontrun the removeManager() and operate crucial functions.

References

https://github.com/immunefi-team/audit-comp-yeet/blob/main/src/StakeV2.sol#L35-L59

Proof of Concept

Proof of Concept

  1. During deployment, Trusted-Owner-A (EOA) is used as the deployer of the contract and holds both owner and manager roles
  2. After setup is complete, ownership is transferred from Trusted-Owner-A to Trusted-Owner-B (The Multisig)
  3. Trusted-Owner-A retains their manager role
  4. Over time, if Trusted-Owner-A's account becomes compromised or experiences key leakage, attacker can still race to call executeRewardDistributionYeet() and executeRewardDistribution() to distribute and redirect reward distributions to their own addresses (by setting vaultParams.receiver != StakeV2)

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

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

The ownership transfer function does not automatically remove the previous owner from the managers mapping, and the removal must be done manually via a separate function.

Impact

If the previous owner's account is compromised, an attacker could call reward distribution functions to redirect rewards to their own addresses, but this requires the previous owner to be compromised and the manager role not manually removed.

What the attacker needed

Previous owner's account compromised; manager role not manually removed

The fix

The contract should automatically remove the previous owner's manager role during ownership transfer, or the transfer process should include a mandatory call to removeManager.

How it was found

  1. Deploy the contract with a trusted owner who also gets the manager role.
  2. Transfer ownership to a new owner (e.g., a multisig).
  3. The previous owner still has the manager role.
  4. If the previous owner's account is compromised, an attacker can call reward distribution functions to redirect rewards.

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.

In smart contracts, roles like 'owner' and 'manager' give special permissions. When ownership changes, the old owner should lose all special rights, but here they keep the manager role unless someone manually removes it. If that old account is later hacked, the attacker can still use those manager powers to redirect rewards.

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 merlinboii

View all

9 more disclosed reports, best first.

More from Yeet

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.