29270 - [SC - High] The main functionality of the contract EarlyZER...

Submitted on Mar 12th 2024 at 22:40:12 UTC by @stiglitz for Boost | ZeroLendarrow-up-right

Report ID: #29270

Report type: Smart Contract

Report severity: High

Target: https://github.com/zerolend/governance

Impacts:

  • Protocol insolvency

  • Protocol contract does not work

Description

Brief/Intro

The function EarlyZEROVesting::startVesting is broken due to missing allowances between contracts.

Vulnerability Details

The problem is in the following function call in the startVesting function:

uint256 id = vesting.mint(
            stake ? address(this) : msg.sender, // address _who,
            (amount * 75) / 100, // uint256 _pending,
            (amount * 25) / 100, // uint256 _upfront,
            86400 * 30 * 3, // uint256 _linearDuration,
            86400 * 30, // uint256 _cliffDuration,
            block.timestamp, // uint256 _unlockDate,
            false, // bool _hasPenalty
            IVestedZeroNFT.VestCategory.EARLY_ZERO
);

Inside the VestedZeroNFT::mint, almost the last line contains the following call:

Where msg.sender == EarlyZEROVesting.

Because there is no allowance set from == EarlyZEROVesting to spender == VestedZeroNFT, the TX will always revert (IERC20Errors.ERC20InsufficientBalance)


This approval is necessary for the function EarlyZEROVesting::startVesting:

Impact Details

The main functionality of the contract EarlyZEROVesting, which is startVesting is broken and always reverts

References

PoC and .png shows the problem

Proof of Concept

Test

tests/test_vested.py

Last updated

Was this helpful?