Beginner FriendlyFoundryDeFi
100 EXP
View results
Submission Details
Severity: medium
Invalid

Staking on behalf of Unauthorized addresses.

Description:

The _onBehalf parameter in the stake function allows users to stake on behalf of any address without validating if the address is authorized or intended to participate in the protocol.

def stake(_onBehalfOf: address):
assert not self._hasStakingPeriodEnded(), STEAK__STAKING_PERIOD_ENDED
assert msg.value >= MIN_STAKE_AMOUNT, STEAK__INSUFFICIENT_STAKE_AMOUNT
assert _onBehalfOf != ADDRESS_ZERO, STEAK__ADDRESS_ZERO
self.usersToStakes[_onBehalfOf] = msg.value
self.totalAmountStaked += msg.value
log Staked(msg.sender, msg.value, _onBehalfOf)

Impact:

This could lead to unauthorized addresses being included in staking, potentially skewing reward distribution or creating governance issues if the protocol expands to include voting or other decision-making process.

Proof of Concept:

A malicious user could stake ETH on behalf of an address not intended to participate in the staking process, such as contract a address with no logic to handle staked tokens. This could result in skewed reward allocations or unintended participation in protocol activities, such as future governance decisions. For example, a user might call the stake function with _onBehalfOf set to an arbitrary address, thereby manipulating the staking system.

Recommended Mitigation:

Implement validation to ensure that that the _onBehalfOf address is either a legitimate user or an authorized entity within the protocol. Consider integrating a whitelist or permissioning mechanism to control who can stake on behalf of others, and add checks to prevent staking on behalf of unverified or unintended addresses.

Updates

Lead Judging Commences

inallhonesty Lead Judge
10 months ago
inallhonesty Lead Judge 10 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.