Sparkn

CodeFox Inc.
DeFiFoundryProxy
15,000 USDC
View results
Submission Details
Severity: medium

Lack of checks in the constructor can lead to funds being stuck.

Summary

FACTORY_ADDRESS == STADIUM_ADDRESS is not checked in the constructor function of Distributor.sol, which can lead to funds being stuck in the ProxyFactory.sol contract.

Vulnerability Details

In the constructor of Distributor.sol, the only thing being checked is this:

file: 2023-08-sparkn/src/Distributor.sol
constructor(
if (factoryAddress == address(0) || stadiumAddress == address(0)) revert Distributor__NoZeroAddress();
)

If both addresses are identical, every commissionFee will effectively be transferred to the FACTORY_ADDRESS.

However, the FACTORY_ADDRESS(ProxyFactory.sol) doesn't have a withdraw function. This leads to these funds being stuck in the FACTORY_ADRESS with no way of getting them out.

Impact

High

Tools Used

Manual Review

Recommendations

Add an extra check in the constructor of Distributor.sol:

file: 2023-08-sparkn/src/Distributor.sol
constructor(
if (factoryAddress == address(0) || stadiumAddress == address(0)) revert Distributor__NoZeroAddress();
)
+ if(factoryAddress == stadiumAddress) revert;

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.