Skip to content
Business logic Audit finding Beginner

Missing Validation to Prevent Self-Assignment of Work Address

The setWorkAddress function in the AgentOwnerRegistry contract does not check that the work address differs from the caller's management address, allowing a manager to set their own address as the work address. This breaks the intended separation between management and operational roles, which could cause confusion in off-chain systems and undermine access control patterns.

elyas6126 Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#46534 [SC-Insight] Missing Validation to Prevent Self-Assignment of Work Address

Submitted on Jun 1st 2025 at 08:54:07 UTC by @elyas6126 for Audit Comp | Flare | FAssets

Description

Brief/Intro

The setWorkAddress function in the AgentOwnerRegistry contract lacks validation to prevent a management address from setting itself as the work address. This breaks the intended separation between management and operational addresses, potentially leading to confusion in the system's address hierarchy and undermining the designed access control patterns.


Issue Details

The setWorkAddress function allows agent managers to assign a work address for operational activities separate from their management address. However, the function does not validate that the work address differs from the caller's address (management address). This allows a manager to set their own address as both the management and work address, which defeats the purpose of having separate roles.

Relevant code snippet:

Solidity
function setWorkAddress(address _ownerWorkAddress)
    external
{
    require(isWhitelisted(msg.sender), "agent not whitelisted");
    require(_ownerWorkAddress == address(0) || workToMgmtAddress[_ownerWorkAddress] == address(0),
        "work address in use");
    // Missing: require(_ownerWorkAddress != msg.sender, "Work address cannot be management address");
    
    // rest of function logic...
}

The absence of this check allows the same address to serve dual roles, which contradicts the system's design of separating management and operational responsibilities.


Impact Details

This missing validation could result in:

  • Breakdown of the intended address separation model, where management and work addresses should serve different purposes
  • Potential confusion in off-chain systems or UI components that expect distinct management and work addresses
  • Undermining of access control patterns that rely on the separation between these two address types
  • Possible operational complications when the same address is used for both management decisions and routine operations

While this issue does not directly lead to loss of funds or protocol failure, it compromises the architectural integrity of the agent management system and could cause confusion in system operations.


References

https://github.com/flare-foundation/fassets/blob/fc727ee70a6d36a3d8dec81892d76d01bb22e7f1/contracts/assetManager/implementation/AgentOwnerRegistry.sol#L53

Proof of Concept

Proof of Concept

TypeScript

## Proof of Concept

Here's a simple PoC demonstrating that a manager can set their own address as the work address:

```typescript
it("should allow manager to set themselves as work address (demonstrates issue)", async () => {
    const manager = agentOwner1;
    
    // First whitelist the manager
    await agentOwnerRegistry.addAddressToWhitelist(manager, { from: governance });
    
    // Manager sets their own address as work address (should not be allowed)
    await agentOwnerRegistry.setWorkAddress(manager, { from: manager });
    
    // Verify that manager is now both management and work address
    const workAddress = await agentOwnerRegistry.getWorkAddress(manager);
    assert.equal(workAddress, manager, "Manager successfully set themselves as work address - demonstrates the issue");
    
    // This breaks the intended separation between management and work addresses
    assert.equal(manager, workAddress, "Same address serves as both management and work address");
});

Mitigation

To address this issue and improve code quality, add the following require checks at the beginning of the setWorkAddress function:

Solidity
require(msg.sender != _ownerWorkAddress, "Work address can not be management address")

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

Likely, the setWorkAddress function is missing a require statement that would reject the caller's own address as the work address.

Impact

This could break the intended address separation model and cause confusion in off-chain systems or UI components, but it does not directly lead to loss of funds or protocol failure.

What the attacker needed

Manager must be whitelisted

The fix

Add a require check at the beginning of setWorkAddress to ensure the work address is not the same as the caller's address.

How it was found

  1. Whitelist the manager address.
  2. Manager calls setWorkAddress with their own address.
  3. Verify that the work address now equals the manager 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.

In this smart contract, there are two roles: a management address (which controls the agent) and a work address (used for daily operations). The code that assigns the work address forgot to check that it is different from the management address. So a manager can make both roles the same address, which defeats the purpose of having separate roles.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More from Flare | FAssets

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.