Skip to content
DoS Audit finding Intermediate

NFTs that don’t have a checkpoint can’t be transferred

The removeDelegation function underflows when a token has no checkpoints, causing a revert that prevents transferring such tokens. An attacker could not exploit this for gain, but it temporarily blocks transfers for affected tokens.

0x52 Follow

Originally disclosed on Code4rena

Submitted by 0x52, also found by 0xsanson

Submitting as high risk because it breaks a fundamental operation (transferring) for a large number of tokens.

Proof of Concept

https://github.com/code-423n4/2022-07-golom/blob/7bbb55fca61e6bae29e57133c1e45806cbb17aa4/contracts/vote-escrow/VoteEscrowDelegation.sol#L212-L213

    uint256 nCheckpoints = numCheckpoints[tokenId];
    Checkpoint storage checkpoint = checkpoints[tokenId][nCheckpoints - 1];

L242 of transferFrom() calls removeDelegation() with the tokenId of the token being transferred. For tokens that don’t have any checkpoints, L212 will return 0. This was cause an underflow error and revert in L213.

Recommended Mitigation Steps

Make removeDelegation simply return if nCheckpoints = 0.

kenzo (warden) commented:

Unsure if high risk, but warden correctly identified the issue (that some others didn’t) that the underflow in removeDelegation will prevent tokens from being transferred.

zeroexdead (Golom) disagreed with severity

LSDan (judge) decreased severity to Medium and commented:

Marking this as a medium risk because it only temporarily breaks functionality. The workaround would be to delegate the token and then transfer it, making the impact aggravating but ultimately minimal.


The original report as published on Code4rena, by 0x52. 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 code assumes at least one checkpoint exists and subtracts one from zero, causing an underflow.

Impact

Transfers of tokens without checkpoints revert, temporarily breaking a core function; a workaround exists by delegating first, so impact is limited.

What the attacker needed

Token has no checkpoints; transfer attempted

The fix

The function should return early when there are no checkpoints, avoiding the underflow.

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 an NFT, the contract tries to remove any voting delegation attached to it. If the NFT never had a delegation, the code still tries to read a list entry that doesn't exist, which makes the transaction fail. So some NFTs simply cannot be transferred until the owner first delegates them.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by 0x52

View all

211 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.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.