Skip to content
Business logic Audit finding Intermediate

NFT transferring won’t work because of the external call to removeDelegation .

The NFT transfer function calls an external function that changes the sender to the contract address, causing an ownership check to fail and the transfer to revert. This means users cannot transfer their delegation NFTs.

CertoraInc Follow

Originally disclosed on Code4rena

Submitted by CertoraInc, also found by 0xA5DF, 0xsanson, Bahurum, carlitox477, cryptphi, GalloDaSballo, kenzo, MEP, and TrungOre

https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/vote-escrow/VoteEscrowDelegation.sol#L242

https://github.com/code-423n4/2022-07-golom/blob/e5efa8f9d6dda92a90b8b2c4902320acf0c26816/contracts/vote-escrow/VoteEscrowDelegation.sol#L211

The VoteEscrowDelegation._transferFrom function won’t work because it calls this.removeDelegation(_tokenId). The removeDelegation function is external, so when the call is done by this.removeDelegation(_tokenId) msg.sender changes to the contract address.

This causes the check in the `` function to (most likely) fail because the contract is not the owner of the NFT, and that will make the function revert. require(ownerOf(tokenId) == msg.sender, 'VEDelegation: Not allowed');

Recommended Mitigation Steps

Make the removeDelegation function public and call it without changing the context (i.e. without changing msg.sender to the contract’s address).

zeroexdead (Golom) confirmed

zeroexdead (Golom) commented:

Fixed.

Ref: https://github.com/golom-protocol/contracts/commit/10ec920765a5ee2afc2fe269d32ea9138d1156b6

0xsaruman (Golom) resolved


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

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 use of an external self-call (`this.removeDelegation`) changes msg.sender to the contract address, breaking an ownership check.

Impact

Users cannot transfer their delegation NFTs because the transfer function reverts.

What the attacker needed

None

The fix

The removeDelegation function should be made public and called without changing the context, so msg.sender remains the original caller.

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 a smart contract calls one of its own functions using 'this', the call is treated as coming from the contract itself, not the original user. Here, a check that the caller owns the NFT then fails, so the transfer always fails. This is a bug that blocks a basic feature.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by CertoraInc

View all

16 more disclosed reports, best first.

More from Golom contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.