31087 - [SC - Low] Colition between approve and _isApprovedOrOwner...

Submitted on May 12th 2024 at 14:40:44 UTC by @Ch301 for Boost | Alchemix

Report ID: #31087

Report type: Smart Contract

Report severity: Low

Target: https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/VotingEscrow.sol

Impacts:

  • Contract fails to deliver promised returns, but doesn't lose value

Description

Brief/Intro

Users with approve() can't trigger merge() function.

Vulnerability Details

When a user (has the approve) triggers VotingEscrow.sol#merge() the _burn() function will sub-call to approve()

File: VotingEscrow.sol

1601:     function _burn(uint256 _tokenId, uint256 _value) internal {
             /***/
1609:         // Clear approval
1610:         approve(address(0), _tokenId);

However, the approve() will revert if: msg.sender is not the owner and (ownerToOperators[owner])[msg.sender] returns false.

Impact Details

The owner sets both the NFTs approve() to the user. however, he cannot call merge() successfully.

References

non

Proof of Concept

Foundry PoC:

  1. Please copy the following POC in VotingEscrow.t.sol

  1. Test result:

Last updated

Was this helpful?