In LiquidityBasedTWAP.sol the constructor passes in _vader and _vaderPool as addresses to set in storage. It makes sure that they are not zero addresses but does not make sure they are unique or not the same as one another. This check should be added as a safe guard during deployment as it can prevent a costly mistake.
Handle
jayjonah8
Vulnerability details
Impact
In LiquidityBasedTWAP.sol the constructor passes in _vader and _vaderPool as addresses to set in storage. It makes sure that they are not zero addresses but does not make sure they are unique or not the same as one another. This check should be added as a safe guard during deployment as it can prevent a costly mistake.
Proof of Concept
https://github.com/code-423n4/2021-12-vader/blob/main/contracts/lbt/LiquidityBasedTWAP.sol#L38
Tools Used
Manual code review
Recommended Mitigation Steps
Add Check: require(address(_vader) != address(_vaderPool), "Addresses must be unique")