Closed code423n4 closed 2 years ago
Czar102
_atPhase internal function of LaunchEvent uses many ifs to determine if the phase is matching the desired one.
_atPhase
LaunchEvent
if
function _atPhase(Phase _phase) internal view { if (_phase == Phase.NotStarted) { require( currentPhase() == Phase.NotStarted, "LaunchEvent: not in not started" ); } else if (_phase == Phase.PhaseOne) { require( currentPhase() == Phase.PhaseOne, "LaunchEvent: not in phase one" ); } else if (_phase == Phase.PhaseTwo) { require( currentPhase() == Phase.PhaseTwo, "LaunchEvent: not in phase two" ); } else if (_phase == Phase.PhaseThree) { require( currentPhase() == Phase.PhaseThree, "LaunchEvent: not in phase three" ); } else { revert("LaunchEvent: unknown state"); } }
Manual analysis
First check if current phase and _phase match, pass if yes. If not, use switch-case syntax to determine the error thrown.
_phase
Duplicate of #162
Handle
Czar102
Vulnerability details
Impact
_atPhase
internal function ofLaunchEvent
uses manyif
s to determine if the phase is matching the desired one.Proof of Concept
Tools Used
Manual analysis
Recommended Mitigation Steps
First check if current phase and
_phase
match, pass if yes. If not, use switch-case syntax to determine the error thrown.