Skip to content
Business logic Audit finding Intermediate

NibblVault buyout duration longer than update timelock

The buyout duration (5 days) is longer than the timelock for updating the vault implementation (2 days), so a bidder who initiates a buyout cannot cancel it before the administrator can change the implementation. This could leave the bidder in a bad state, potentially losing funds or trust.

reassor Follow

Originally disclosed on Code4rena

Submitted by reassor

https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/Utilities/NibblVaultFactoryData.sol#L6

https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVaultFactory.sol#L158-L169

https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVault.sol#L37

Impact

User can buy out NFT by initiating the process through initiateBuyout, then he has to wait BUYOUT_DURATION which is 5 days and if the buyout will not get rejected he can claim the NFT. During that period bidder cannot cancel the process. The issue is that since NibblVault is used through proxy it is possible to change its implementation through administrative functionality in NibblVaultFactory and the timelock for update’ing implementation is only 2 days.

Attack Scenario:

  1. Bidder initiates buyout through initiateBuyout
  2. Administrator of the protocol updates the vaultImplementation through proposeNewVaultImplementation
  3. Bidder really does not like new implementation but cannot cancel buyout process
  4. Administrator waits 2 days (the UPDATE_TIME) uses updateVaultImplementation and changes the implementation
  5. Bidder loses funds/fait in the protocol

Proof of Concept

Tools Used

Manual Review / VSCode

Recommended Mitigation Steps

It is recommended to either implement functionality for bidder to cancel the bid or increase/decrease the UPDATE_TIME/BUYOUT_DURATION so the invariant BUYOUT_DURATION < UPDATE_TIME holds.

mundhrakeshav (Nibbl) acknowledged, but disagreed with severity

HardlyDifficult (judge) decreased severity to Medium and commented:

It seems the bidder could be left in a bad state, and updating the thresholds here may be a nice way to maintain expectations. Since this scenario is based on the admin making an undesirable change, this is a Medium risk report.


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

The buyout duration is longer than the timelock for updating the vault implementation, and the bidder cannot cancel the buyout.

Impact

The bidder could lose funds or trust in the protocol if the administrator changes the implementation during the buyout period.

What the attacker needed

Bidder initiates buyout; admin proposes new implementation; admin waits 2 days

The fix

The report recommends either allowing the bidder to cancel the bid or adjusting the timelock and buyout duration so that the buyout duration is shorter than the update timelock.

How it was found

  1. Bidder initiates buyout through `initiateBuyout`
  2. Administrator updates the `vaultImplementation` through `proposeNewVaultImplementation`
  3. Bidder cannot cancel buyout process
  4. Administrator waits 2 days and uses `updateVaultImplementation` to change the implementation

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 user starts a process to buy an NFT, which takes 5 days and cannot be cancelled. Meanwhile, the protocol admin can change the underlying code of the vault after only 2 days. So the user might be stuck with a changed system they did not agree to.

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 reassor

View all

5 more disclosed reports, best first.

More from Nibbl 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.