code-423n4 / 2022-01-timeswap-findings

2 stars 0 forks source link

no contract check in function createPair #145

Open code423n4 opened 2 years ago

code423n4 commented 2 years ago

Handle

Tomio

Vulnerability details

Impact

no contract check in function createPair to check the address extcodesize/address.code.length whether is a contract or EOA

Proof of Concept

https://github.com/code-423n4/2022-01-timeswap/blob/main/Timeswap/Timeswap-V1-Core/contracts/TimeswapFactory.sol#L47

Tools Used

Recommended Mitigation Steps

add isContract function from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/Address.sol#L36 in function createPair

Mathepreneur commented 2 years ago

Does this mean we have to pre-calculate the address and do the isContract check? Or do we simply wrap require(isContract(...)) the new TimeswapPair line?