TempleGold

TempleDAO
Foundry
25,000 USDC
View results
Submission Details
Severity: high
Invalid

Attackers can withdraw what they never staked... Leading to loss of funds.

Summary

Attackers can withdraw what they never staked... Leading to loss of funds.

Vulnerability Details

Here is the withdrawfunction in TempleGoldStaking.sol:

function withdraw(uint256 amount, uint256 index, bool claim) external override {
StakeInfo storage _stakeInfo = _stakeInfos[msg.sender][index];
_withdrawFor(_stakeInfo, msg.sender, msg.sender, index, amount, claim, msg.sender);
}

The logic behind this function is so those who staked can call it to withdraw.

As seen above, practically anyone can call this withdrawal function; all they need to do is input the amount, index, and indicate true.

This way, an attacker can withdraw successfully from the contract without any hinderance without staking at all.

Impact

Loss of funds.

Tools Used

Manual review.

Recommendations

Only those who have staked should be able to withdraw.

Updates

Lead Judging Commences

inallhonesty Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

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