Skip to content
Audit finding Beginner

Missing Revert Message in require statement lea

Three functions in the Bribe contract use a require check without a revert message, so a failed call gives no explanation. The author states this has no direct security impact and only makes debugging harder for developers and users.

Wizard Follow

Originally disclosed on Immunefi

Informational View original
  • Disclosed after under an hour

31226 - [SC - Insight] Missing Revert Message in require statement lea...

Submitted on May 15th 2024 at 08:49:18 UTC by @Wizard for Boost | Alchemix

Report ID: #31226

Report type: Smart Contract

Report severity: Insight

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

Impacts:

  • missing revert message leading to difficulty in debugging

Description

Brief/Intro

require statement in the deposit, withdraw, and restVoting functions does not include a revert message.

Vulnerability Details

The require statement in the deposit, withdraw, and restVoting functions does not include a revert message, this would make it harder to debug and understand why a transaction is reverting for both developers and protocol users.

Impact Details

the lack of feedback on reverting functions would make it harder to trace back the errors and know where the execution is going wrong, this doesn't have a direct security impact on the contract, but it can make things easier to debug as those three functions are important functions in the protocol.

References

https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/Bribe.sol?utm\\_source=immunefi#L303

https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/Bribe.sol?utm\\_source=immunefi#L319

https://github.com/alchemix-finance/alchemix-v2-dao/blob/main/src/Bribe.sol?utm\\_source=immunefi#L332

Proof of Concept

/// @inheritdoc IBribe
    function deposit(uint256 amount, uint256 tokenId) external {
        //@audit missing revert message
      --  require(msg.sender == voter);
      ++  require(msg.sender == voter, " not a voter");
        totalSupply += amount;
        balanceOf[tokenId] += amount;

        totalVoting += amount;

        _writeCheckpoint(tokenId, balanceOf[tokenId]);
        _writeSupplyCheckpoint();
        _writeVotingCheckpoint();

        emit Deposit(msg.sender, tokenId, amount);
    }

    /// @inheritdoc IBribe
    function withdraw(uint256 amount, uint256 tokenId) external {
         -- require(msg.sender == voter);
       ++  require(msg.sender == voter, " not a voter");

        totalSupply -= amount;
        balanceOf[tokenId] -= amount;

        _writeCheckpoint(tokenId, balanceOf[tokenId]);
        _writeSupplyCheckpoint();

        emit Withdraw(msg.sender, tokenId, amount);
    }

    /// @inheritdoc IBribe
    function resetVoting() external {
      require(msg.sender == voter);
  ++  require(msg.sender == voter, " not a voter");

        totalVoting = 0;
    }```

The original report as published on Immunefi, by Wizard. 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

The require checks on the caller identity in deposit, withdraw and resetVoting were written without a revert message string.

Impact

There is no direct security impact; the only effect is that failed calls are harder to trace and debug.

What the attacker needed

None

The fix

The report suggests adding a revert message to each of the three require checks.

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.

A smart contract can stop a transaction with a check called require. When the check fails, the transaction is cancelled and any message attached to the check is shown. Here the checks have no message, so people only see that something failed, not why.

More by Wizard

View all

1 more disclosed report, best first.

More from Alchemix

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.