Skip to content
Access control Audit finding Intermediate

Previous owner can steal unclaimed bribes from new owner of veNFTVault

Transferring ownership of a veNFT receipt does not update the vault's manager address, so the previous owner remains the manager. The previous owner can then claim unclaimed bribes that should belong to the new owner.

0xc0ffEE Follow with DenTonylifer, Flashloan44 and 5 others

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-10-debita-judging/issues/875

The protocol has acknowledged this issue.

Found by

0xc0ffEE, DenTonylifer, Flashloan44, Greese, KiroBrejka, VAD37, eeshenggoh, xiaoming90

Summary

Previous owner can steal unclaimed bribes from new owner of veNFT, because transfering ownership of veNFT does not change the manager (which can claim bribes, vote).

Root Cause

Link

Solidity
function claimBribesMultiple(
        address[] calldata vaults,
        address[] calldata _bribes,
        address[][] calldata _tokens
    ) external {
        for (uint i; i < vaults.length; i++) {
            require(
                msg.sender == veNFTVault(vaults[i]).managerAddress(),
                "not manager"
            );
            require(isVaultValid[vaults[i]], "not vault");
            veNFTVault(vaults[i]).claimBribes(msg.sender, _bribes, _tokens);
            emitInteracted(vaults[i]);
        }
    }

Each veNFTVault.sol has manager role, which by default is owner of veNFTVault:

Solidity
veNFTVault vault = new veNFTVault(
                nftAddress,
                address(this),
                m_Receipt,
                nftsID[i],
                msg.sender
            );
//...
          s_ReceiptID_to_Vault[m_Receipt] = address(vault);
//...
          _mint(msg.sender, m_Receipt);

But transfering ownership of veNFTVault by transfering receiptID does not change the manager - old manager can still call all of this functions: voteMultiple(), claimBribesMultiple(), resetMultiple(), extendMultiple() and pokeMultiple(). Main impact that old manager cam steal unclaimed bribes from new owner by calling claimBribesMultiple():

Solidity
 function claimBribesMultiple(
        address[] calldata vaults,
        address[] calldata _bribes,
        address[][] calldata _tokens
    ) external {
        for (uint i; i < vaults.length; i++) {
            require(
                msg.sender == veNFTVault(vaults[i]).managerAddress(),
                "not manager"
            );
            require(isVaultValid[vaults[i]], "not vault");
            veNFTVault(vaults[i]).claimBribes(msg.sender, _bribes, _tokens);
            emitInteracted(vaults[i]);
        }
    }

Internal pre-conditions

None

External pre-conditions

None

Attack Path

  • Malicious user wants to sell ownership of veNFTVault, which has for example 1000 USDC of unclaimed bribes;
  • Victim expects to become owner of veNFTVault and have the ability to claim unclaimed bribes, vote, and so on;
  • Malicious user claims bribes right after transfering receiptID, because he is still the manager of the vault;
  • Bribes are sent to previous malicious owner, not current holder of receiptID:
Solidity
SafeERC20.safeTransfer(
                    ERC20(_tokens[i][j]),
                    sender,
                    amountToSend
                );

Impact

Previous owner can still call all of this functions: voteMultiple(), claimBribesMultiple(), resetMultiple(), extendMultiple() and pokeMultiple(). Main impact that manager (previous owner) cam steal unclaimed bribes from new owner by calling claimBribesMultiple().

PoC

No response

Mitigation

Override transferFrom() function in that way that it also changes managerAddress to new owner's address.

The original report as published on Sherlock, by 0xc0ffEE. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

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

Likely, the manager address is set only at vault creation and is not updated when the receipt token is transferred.

Impact

The previous owner can steal unclaimed bribes from the new owner and still call functions like voteMultiple and claimBribesMultiple.

What the attacker needed

Attacker owns a veNFTVault with unclaimed bribes; attacker transfers the receipt to a victim

The fix

Override transferFrom() to also update managerAddress to the new owner's address.

How it was found

  1. The attacker owns a veNFTVault with unclaimed bribes.
  2. The attacker transfers the receipt to a victim.
  3. The attacker calls claimBribesMultiple because they are still the manager.
  4. The bribes are sent to the attacker, not the victim.

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.

When you transfer a receipt for a vault, the system still thinks the old owner is in charge. The old owner can then take rewards (bribes) that were meant for the new owner.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by 0xc0ffEE

View all

27 more disclosed reports, best first.

More from Debita Finance V3

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.