Skip to content
Smart contracts Audit finding Intermediate

Missing deadline parameter in register signatures

The registerAgentsWithSignature function in the ServiceManager contract omits a deadline from the signed message, so an operator's signature remains valid indefinitely. A service owner can reuse an old signature to register agents and force a bond transfer from the operator's account without current consent.

santipu_ Follow with Dinesh11G and SpicyMeatball

Originally disclosed on Code4rena

Submitted by santipu_, also found by Dinesh11G and SpicyMeatball

autonolas-registries/../contracts/ServiceManager.sol #L421

The registerAgentsWithSignature function in the ServiceManager contract allows a service owner to register agent instances on behalf of an operator using a signed message.

function registerAgentsWithSignature(
        address operator,
        uint256 serviceId,
        address[] memory agentInstances,
        uint32[] memory agentIds,
        bytes memory signature
    ) external payable returns (bool success) {
        // Check the service owner
        address serviceOwner = IERC721(serviceRegistry).ownerOf(serviceId);
        if (msg.sender != serviceOwner) {
            revert OwnerOnly(msg.sender, serviceOwner);
        }

        // Get the (operator | serviceId) nonce for the registerAgents message
        // Push a pair of key defining variables into one key. Service Id or operator are not enough by themselves
        // as another service might use the operator address at the same time frame
        // operator occupies first 160 bits
        uint256 operatorService = uint256(uint160(operator));
        // serviceId occupies next 32 bits as serviceId is limited by the 2^32 - 1 value
        operatorService |= serviceId << 160;
        uint256 nonce = mapOperatorRegisterAgentsNonces[operatorService];
        // Get register agents message hash
        bytes32 msgHash = getRegisterAgentsHash(operator, serviceOwner, serviceId, agentInstances, agentIds, nonce);

        // Verify the signed hash against the operator address
        _verifySignedHash(operator, msgHash, signature);

        // ...
    }

The signature is computed over the following parameters:

  • operator address
  • service owner address
  • service ID
  • agent instance addresses
  • agent IDs
  • nonce

However, the message hash omits a critical parameter: a deadline. Without a deadline, the operator’s signature remains valid indefinitely, unless invalidated by a nonce change. This allows the service owner to store a valid signature and use it arbitrarily far into the future.

For example:

  1. Bob creates a service and requests Alice to register agents using her signature.
  2. Alice signs the message, allowing Bob to register on her behalf.
  3. For whatever reason, Bob does ends up not using the signature. Instead, Alice registers the agents directly.
  4. Some time later, Alice unbonds from Bob and retrieves her deposit.
  5. Bob reconfigures the service and opens registrations again.
  6. Bob reuses Alice’s old signature to register her agents without consent.
  7. This triggers a bond transfer from Alice’s account, effectively locking her funds again.

This behavior is possible because registerAgentsWithSignature eventually calls registerAgentsTokenDeposit with the operator’s address:

        // Record the actual ERC20 bond
        bool isTokenSecured =
            IServiceTokenUtility(serviceRegistryTokenUtility).registerAgentsTokenDeposit(operator, serviceId, agentIds);

And within registerAgentsTokenDeposit, the contract transfers tokens directly from the operator:

safeTransferFrom(token, operator, address(this), totalBond);

As long as the operator has an active allowance for the ServiceRegistryTokenUtility contract, the bond can be forcibly transferred. Operators commonly maintain infinite allowances to save on gas when interacting with multiple services, increasing the likelihood of unintended bond transfers.

An operator’s valid signature can be reused at any point in the future, enabling a service owner to forcibly register agent instances and trigger bond transfers from the operator’s account without current consent. This undermines operator autonomy and can lead to unexpected token lockups. Because the token transfer depends only on a previously issued signature and an existing token allowance, malicious or careless reuse can silently lock operator funds in services they no longer intend to participate in.

Recommended mitigation steps

Introduce a deadline parameter to the signed message and include it in the hash computation. Then, enforce that the deadline has not passed before accepting the signature during execution.


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

The signed message hash does not include a deadline, so signatures never expire.

Impact

A service owner could force an operator to register agents and transfer bond tokens without current consent, potentially locking the operator's funds.

What the attacker needed

Operator has previously signed a register message; operator has an active token allowance; service owner acts maliciously or carelessly

The fix

A deadline parameter should be added to the signed message and included in the hash, and the contract should check that the deadline has not passed before accepting the signature.

How it was found

  1. Bob creates a service and requests Alice to register agents using her signature.
  2. Alice signs the message, allowing Bob to register on her behalf.
  3. Bob does not use the signature; Alice registers the agents directly.
  4. Later, Alice unbonds from Bob and retrieves her deposit.
  5. Bob reconfigures the service and opens registrations again.
  6. Bob reuses Alice’s old signature to register her agents without consent.

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.

When you sign a message to approve an action, that approval can be used later if it doesn't expire. Here, the approval to register agents has no expiry date, so a service owner can reuse it much later to take tokens from the operator's account.

What is Smart contracts?

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.

More by santipu_

View all

13 more disclosed reports, best first.

More from Olas

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Smart contract vulnerabilities

The lesson behind this report.

Flaws in on-chain code that let an attacker drain funds, freeze them or break the protocol's accounting.