Open code423n4 opened 2 years ago
56
It's not clear to me how this is a dupe of #56
This is a valid concern and potentially a change worth making.
It will cause the TWAP to be updated and buyout to be rejected
This makes me think Medium risk is correct here. In this scenario a buyout could be rejected without allowing other users to challenge that -- seemingly breaking one of the benefits behind using Twap for this logic.
Lines of code
https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVault.sol#L443
Vulnerability details
Proof-of-Concept
Calling
NibblVault.updateTWAP
function will change the state of the system. It will cause the TWAP to be updated and buyout to be rejected in certain condition.When the system is in
Pause
mode, the system state should be frozen. However, it was possible someone to call theNibblVault.updateTWAP
function during thePause
mode, thus making changes to the system state.https://github.com/code-423n4/2022-06-nibbl/blob/8c3dbd6adf350f35c58b31723d42117765644110/contracts/NibblVault.sol#L443
Recommended Mitigation Steps
Ensure that the
NibblVault.updateVault
function cannot be called when the system is inPause
mode.Add the
whenNotPaused
modifier to the function.