code-423n4 / 2021-06-gro-findings

0 stars 1 forks source link

Hardcoded 99 as deadcoin #96

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

cmichel

Vulnerability details

Vulnerability Details

The contract uses a magic number of 99 to indicate that no coin is "dead" (excluded by emergency calls). See Controller.deadcoin. This only works because N_COINS is currently set to less than 99.

Impact

While it's unlikely that the protocol will ever support 99 stablecoins, it would still fail in that case and setting it to such a meaningless arbitrary value might indicate a further special meaning to anyone reading the code.

Recommended Mitigation Steps

We recommend using more meaningful constants like type(uint256).max or setting it to N_COINS + 1.

kitty-the-kat commented 2 years ago

non critical

ghoul-sol commented 2 years ago

From practical point, before that happens, protocol will surely get an upgrade. Agree with non-critical.