Open code423n4 opened 2 years ago
Should be high right? Funds are locked. See https://github.com/code-423n4/2022-06-yieldy-findings/issues/245#issuecomment-1167616593
duplicate #245
Should be high right? Funds are locked. See #245 (comment)
Agree this should be high. The cost of the attack is negligible and could cause basic perpetual grievance on all users with one simple script.
Lines of code
https://github.com/code-423n4/2022-06-yieldy/blob/524f3b83522125fb7d4677fa7a7e5ba5a2c0fe67/src/contracts/Staking.sol#L435-L447
Vulnerability details
Staking.sol#stake()
is a public function and you can specify an arbitrary address as the_recipient
.When
warmUpPeriod > 0
, with as little as 1 wei ofYIELDY_TOKEN
, the_recipient
'swarmUpInfo
will be push back tilepoch.number + warmUpPeriod
.Recommendation
Consider changing to not allow deposit to another address when
warmUpPeriod > 0
.