code-423n4 / 2021-07-sherlock-findings

0 stars 0 forks source link

Missing verification on `tokenInit`'s lock #105

Open code423n4 opened 3 years ago

code423n4 commented 3 years ago

Handle

cmichel

Vulnerability details

The Gov.tokenInit skips the underlying token check if the _token is SHERX:

if (address(_token) != address(this)) {
  require(_lock.underlying() == _token, 'UNDERLYING');
}

Impact

This check should still be performed even for _token == address(this) // SHERX, otherwise, the lock can have a different underlying and potentially pay out wrong tokens.

Recommendation

Verify the underlying of all locks.

Evert0x commented 3 years ago

Good catch!