Skip to content
Access control Audit finding Beginner

Documentation-Implementation Discrepancy in Agent Vault Access Control

The Agent Vault contract's depositCollateral and updateCollateral functions are documented as callable by anyone, but are implemented with an onlyOwner modifier. This prevents third parties from depositing collateral on behalf of the vault owner, reducing flexibility.

Victor_TheOracle Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

#46218 [SC-Insight] Documentation-Implementation Discrepancy in Agent Vault Access Control

Submitted on May 26th 2025 at 20:30:49 UTC by @Victor_TheOracle for Audit Comp | Flare | FAssets

Description

Brief/Intro

The depositCollateral and updateCollateral functions in the Agent Vault contract are documented to be callable by anyone but are implemented with onlyOwner modifiers, restricting access to vault owners only. This prevents third-party funding mechanisms and flexible collateral management as described in the documentation.

Vulnerability Details

The documentation explicitly states that both depositCollateral and updateCollateral should be callable by anybody:

Documentation Claims:

  • depositCollateral: "NOTE: anybody can call this method, to allow the owner to deposit from any wallet."
  • updateCollateral: "NOTE: anybody can call this method, to allow the owner to deposit from any source."

Actual Implementation:

Solidity
function depositCollateral(IERC20 _token, uint256 _amount)
    external override
    onlyOwner  //@audit Contradicts documentation
{
    _token.safeTransferFrom(msg.sender, address(this), _amount);
    assetManager.updateCollateral(address(this), _token);
    _tokenUsed(_token, TOKEN_DEPOSIT);
}

function updateCollateral(IERC20 _token)
    external override
    onlyOwner  //@audit Contradicts documentation
{
    assetManager.updateCollateral(address(this), _token);
    _tokenUsed(_token, TOKEN_DEPOSIT);
}

This implementation shows that it has deviated from what was documented.

Impact Details

The primary consequence of this access control discrepancy is loss of flexibility as third parties cannot assist with collateral management despite this functionality being explicitly documented.

References

  1. AgentVault documentation for the depositCollateral, and updateCollateral functions: https://github.com/flare-foundation/fassets/blob/fc727ee70a6d36a3d8dec81892d76d01bb22e7f1/docs/IAgentVault.md?plain=1#L1-L5
  2. AgentVault implementation: https://github.com/flare-foundation/fassets/blob/fc727ee70a6d36a3d8dec81892d76d01bb22e7f1/contracts/assetManager/implementation/AgentVault.sol#L93-L109

Proof of Concept

  1. The documentation clearly states that anybody can call the depositCollateral and updateCollateral methods, to allow the owner to deposit from any wallet or source.

https://github.com/flare-foundation/fassets/blob/fc727ee70a6d36a3d8dec81892d76d01bb22e7f1/docs/IAgentVault.md?plain=1#L1-L5

**depositCollateral** - Deposit vault collateral. Parameter `_token` is explicit to allow depositing before collateral switch.
NOTE: owner must call `token.approve(vault, amount)` before calling this method. NOTE: anybody can call this method, to allow the owner to deposit from any wallet.

**updateCollateral** - Update collateral after `transfer(vault, some amount)` was called (alternative to depositCollateral). Parameter `_token` is explicit to allow depositing before collateral switch.
NOTE: anybody can call this method, to allow the owner to deposit from any source.
  1. Owner tries to deposit or update collateral from another wallet, but the transaction fails with the "Ownable: caller is not the owner" error.
  2. This does not align with the documentation and it should be corrected.

The original report as published on Immunefi, by Victor_TheOracle. 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 developers added an onlyOwner modifier to the functions but forgot to update the documentation, or vice versa.

Impact

The discrepancy reduces flexibility because third parties cannot assist with collateral management as documented.

What the attacker needed

Access to the contract; non-owner wallet

How it was found

  1. Read the documentation stating anyone can call depositCollateral and updateCollateral.
  2. Attempt to call depositCollateral or updateCollateral from a non-owner wallet.
  3. Observe the transaction fails with an ownership error.

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.

This report is about a mismatch between what the code's documentation says and what the code actually does. The documentation says anyone can call two functions to add collateral to a vault, but the code only lets the vault owner call them. That means a feature described in the docs does not work as promised.

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 Victor_TheOracle

View all

4 more disclosed reports, best first.

More from Flare | FAssets

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.