The stakeFor
function in the TempleGoldStaking contract lacks a check to prevent staking for the zero address. This oversight could lead to permanent loss of funds if tokens are accidentally or maliciously staked to the zero address.
The stakeFor
function allows users to stake tokens on behalf of another address. However, it does not validate that the recipient address (_for
parameter) is not the zero address (0x0). As a result, it's possible to stake tokens for the zero address, which would effectively lock these tokens in the contract permanently, as there would be no way to withdraw them.
The impact of this vulnerability is potentially severe. If tokens are staked to the zero address, they become irretrievable, resulting in a permanent loss of funds. This could occur due to user error or could be exploited maliciously. The financial impact would be directly proportional to the amount of tokens staked to the zero address.
Manual Review
To address this vulnerability, implement a zero address check at the beginning of the stakeFor
function. Here's the recommended modification:
This check ensures that tokens cannot be staked for the zero address, preventing potential loss of funds.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.