code-423n4 / 2021-07-spartan-findings

0 stars 0 forks source link

Missing critical checks in the `createPool` function of `PoolFactory` #228

Closed code423n4 closed 3 years ago

code423n4 commented 3 years ago

Handle

shw

Vulnerability details

Impact

The createPool function of PoolFactory does not check that the provided parameter token is valid, as done in a similar function, createPoolADD. Without these checks, it is possible to create a pool using a token with decimals other than 18, thus breaking all functions implemented based on this assumption.

Proof of Concept

Referenced code: poolFactory.sol#L50 poolFactory.sol#L65-L77

Recommended Mitigation Steps

Add a require(_token != BASE && iBEP20(_token).decimals() == 18); check in the createPool function after line 68.

SamusElderg commented 3 years ago

Duplicate of #136