code-423n4 / 2021-12-amun-findings

0 stars 0 forks source link

SingleTokenJoin.sol constructor does not ensure that addresses are different #51

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

jayjonah8

Vulnerability details

Impact

In SingleTokenJoin.sol, the constructor accepts 2 addresses which are _INTERMEDIATE_TOKEN and _uniSwapLikeRouter and sets them in storage without ensuring that they are both different. This check can avoid costly mistakes during deployment.

Proof of Concept

https://github.com/code-423n4/2021-12-amun/blob/main/contracts/basket/contracts/singleJoinExit/SingleTokenJoin.sol#L30

Tools Used

Manual code review

Recommended Mitigation Steps

Add to constructor: require(_INTERMEDIATE_TOKEN != _uniSwapLikeRouter, "DUPLICATE ADDRESS")

loki-sama commented 2 years ago

No need to check for every value that could be set wrong

0xleastwood commented 2 years ago

Agree with sponsor, this adds unnecessary overhead for a trusted deployment setup.