Skip to content
Business logic Audit finding Intermediate

ApprovalAll event is missing parameters

The beforeApprovalAll and afterApprovalAll event hooks in HolographERC721.sol only pass the 'to' and 'approved' parameters, omitting the 'owner' (the address granting approval). As a result, contracts listening to these events cannot determine who initiated the approval, making the event effectively unusable for reacting to approvals.

bin2chen Follow

Originally disclosed on Code4rena

Submitted by bin2chen

HolographERC721.sol#L392

beforeApprovalAll() / afterApprovalAll() can only pass “to” and “approved”, missing “owner”, if contract listening to this event,but does not know who approve it, so can not react to this event. Basically, this event cannot be used.

Proof of Concept

  function setApprovalForAll(address to, bool approved) external {
....

    if (_isEventRegistered(HolographERC721Event.beforeApprovalAll)) {
      require(SourceERC721().beforeApprovalAll(to, approved)); /***** only to/approved ,need owner
    }

    _operatorApprovals[msg.sender][to] = approved;

    if (_isEventRegistered(HolographERC721Event.afterApprovalAll)) {
      require(SourceERC721().afterApprovalAll(to, approved)); /***** only to/approved ,need owner
    }
  }

Recommended Mitigation Steps

Add parameter: owner

interface HolographedERC721 {
...

- function beforeApprovalAll(address _to, bool _approved) external returns (bool success);
+ function beforeApprovalAll(address owner, address _to, bool _approved) external returns (bool success);

- function afterApprovalAll(address _to, bool _approved) external returns (bool success);
+ function afterApprovalAll(address owner, address _to, bool _approved) external returns (bool success);
  function setApprovalForAll(address to, bool approved) external {

    if (_isEventRegistered(HolographERC721Event.beforeApprovalAll)) {
-     require(SourceERC721().beforeApprovalAll(to, approved));
+     require(SourceERC721().beforeApprovalAll(msg.sender,to, approved));
    }

    _operatorApprovals[msg.sender][to] = approved;

    if (_isEventRegistered(HolographERC721Event.afterApprovalAll)) {
-      require(SourceERC721().afterApprovalAll(to, approved));
+      require(SourceERC721().afterApprovalAll(msg.sender,to, approved));
    }
  }

alexanderattar (Holograph) commented:

Good catch. This will be updated so that beforeApprovalAll and afterApprovalAll passes in owner.

ACC01ADE (Holograph) linked a PR:

Feature/HOLO-605: C4 medium risk fixes


The original report as published on Code4rena, by bin2chen. 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 event hook functions beforeApprovalAll and afterApprovalAll were defined without an owner parameter, so the caller's address (msg.sender) is not passed to listeners.

Impact

Contracts listening to these events cannot identify the approving owner, so they cannot react correctly to approval changes.

What the attacker needed

None

The fix

The event hook functions should be updated to include the owner (msg.sender) as a parameter, and the setApprovalForAll function should pass it when calling these hooks.

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 some smart contracts, other contracts can listen for events to react when something happens, like when an owner approves someone to manage their tokens. Here, the event that fires when an owner approves all tokens for another address does not include the owner's address, so listeners cannot tell who did the approving. This makes the event useless for any contract that needs to know the owner.

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 by bin2chen

View all

139 more disclosed reports, best first.

More from Holograph contest

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.