A user can stake a very small amount (dust amount) and manipulate the checkpoints, potentially causing a Denial of Service (DoS) attack on the TempleGoldStaking.getPriorVotes()
.
The TempleGoldStaking
contract allows users to stake dust amounts of tokens.
An attacker can exploit this by staking dust amounts and repeatedly changing their delegatee to any victim address to create a large number of checkpoints.
This increases the computational load on the TempleGoldStaking.getPriorVotes()
, potentially leading to performance issues and a Denial of Service (DoS).
An attacker can cause TempleGoldStaking.getPriorVotes()
to incur high gas costs, potentially leading to a Denial of Service (DoS) attack.
Initial State: Attacker has not set their delegatee
delegates[attacker] = address(0)
Step 1: Attacker stake 1 wei
TGLD via the TempleGoldStaking.stake()
_balances[attacker] += 1 wei = 1
No delegates move as src: address(0) == dest: address(0)
Step 2: Attacker delegate their vote to Alice
=> TempleGoldStaking.delegate(address(Alice))
Previous delegatee = address(0)
Introduce the new Alice Checkpoint
struct
numCheckpoints[Alice]
is increased
Step 3: Attacker delegate their vote to Bob
=> TempleGoldStaking.delegate(address(Bob))
Previous delegatee = address(Alice)
Introduce the new Alice Checkpoint
struct
Introduce the new Bob Checkpoint
struct
numCheckpoints[Alice]
is increased
numCheckpoints[Bob]
is increased
Step 4: Repeat Step 2 and 3 to repeatedly change the delegatee between Alice
and Bob
, increasing numCheckpoints
and adding Checkpoints for both.
Manual Review
Introduce a minimum staking amount requirement in the TempleGoldStaking,stakeFor()
to prevent users from staking dust amounts.
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.