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.
Submitted by reassor
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:
- Bidder initiates buyout through
initiateBuyout - Administrator of the protocol updates the
vaultImplementationthroughproposeNewVaultImplementation - Bidder really does not like new implementation but cannot cancel buyout process
- Administrator waits 2 days (the
UPDATE_TIME) usesupdateVaultImplementationand changes the implementation - Bidder loses funds/fait in the protocol
Proof of Concept
- 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
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.
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
- Bidder initiates buyout through `initiateBuyout`
- Administrator updates the `vaultImplementation` through `proposeNewVaultImplementation`
- Bidder cannot cancel buyout process
- 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.