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

1 stars 0 forks source link

`Factory.createNewExchange` can be frontrun with stupid names #105

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

cmichel

Vulnerability details

The Factory.createNewExchange allows only a single exchange to exist for any (base, quote) pair. The function also allows setting a name for this unique exchange. An attacker can frontrun the createNewExchange call and create an exchange for the same pair but with a different name.

They can choose stupid/offensive names which can make the pair look untrustworthy.

Recommended Mitigation Steps

Disallow choosing the name. Deterministically create the name and symbol by combining the base and quote token pair's name() and symbol().

0xean commented 2 years ago

dupe of #110