Open code423n4 opened 3 years ago
simomonica1997@gmail.com
s1m0
0x9b3E9e3E4a174d59279FC7cd268e035992412384
The constructor of IncentiveDistribution https://github.com/code-423n4/marginswap/blob/main/contracts/IncentiveDistribution.sol#L32 take as argument the address of MFI token but it doesn't check that is != address(0). Not worth an issue alone but IncentiveDistribution imports IERC20.sol and it never use it.
In case the address(0) is passed as arguement the withdrawReward woul fail https://github.com/code-423n4/marginswap/blob/main/contracts/IncentiveDistribution.sol#L261 and due to the fact that MFI is immutable the only solution would be to redeploy the contract meanwhile losing trust from the users.
Deploy IncentiveDistribution with 0 as _MFI argument and then call withdrawReward.
Manual analysis
Check _MFI != address(0)
Email address
simomonica1997@gmail.com
Handle
s1m0
Eth address
0x9b3E9e3E4a174d59279FC7cd268e035992412384
Vulnerability details
The constructor of IncentiveDistribution https://github.com/code-423n4/marginswap/blob/main/contracts/IncentiveDistribution.sol#L32 take as argument the address of MFI token but it doesn't check that is != address(0). Not worth an issue alone but IncentiveDistribution imports IERC20.sol and it never use it.
Impact
In case the address(0) is passed as arguement the withdrawReward woul fail https://github.com/code-423n4/marginswap/blob/main/contracts/IncentiveDistribution.sol#L261 and due to the fact that MFI is immutable the only solution would be to redeploy the contract meanwhile losing trust from the users.
Proof of concept
Deploy IncentiveDistribution with 0 as _MFI argument and then call withdrawReward.
Tools used
Manual analysis
Recommended mitigation steps
Check _MFI != address(0)