FloorDAO / floor-v2

Floor aims to create a fully onchain governance mechanism for sweeping and deploying NFTs to profitable NFT-Fi strategies as well as seeding liquidity for its own NFT-Fi products.
https://floor.xyz
2 stars 0 forks source link

[VFS-01M] Incorrect Inheritance of `ERC20Permit` #80

Closed tomwade closed 1 year ago

tomwade commented 1 year ago

VFS-01M: Incorrect Inheritance of ERC20Permit

Type Severity Location
Logical Fault VeFloorStaking.sol:L33

Description:

The VeFloorStaking is meant to be represented by an EIP-20 token that cannot be transferred nor approved as per the VeFloorStaking::approve, VeFloorStaking::increaseAllowance, and VeFloorStaking::decreaseAllowance function overrides.

Despite this, it inherits the ERC20Permit contract of OpenZeppelin which exposes the ERC20Permit::permit function and thus allows an allowance to be set and the ERC20::_approve function to be invoked bypassing the aforementioned overrides.

Impact:

While the approval overrides can be bypassed, they cannot be actuated rendering this exhibit to be of minor severity.

Example:

contract VeFloorStaking is EpochManaged, ERC20, ERC20Permit, ERC20Votes, IVeFloorStaking, IVotable {

Recommendation:

We advise the code to remove inheritance of the ERC20Permit contract to avoid such unintended behaviour as the VeFloorStaking is meant to be non-transferrable.