The FjordPoints::distributePoints is marked as public and there are no access control modifiers restricting who can call this function, allowing anyone to call it. While the function includes checks to return early if certain conditions are not met (the points are only distributed if the appropriate amount of time has passed EPOCH_DURATION and if there are tokens stakedtotalStaked > 0), it does not prevent repeated calls. An attacker can exploit this by repeatedly calling the function, consuming gas, leading to a Denial of Service (DoS) attack.
The lack of access control in the distributePoints function allows any external account or contract to call it repeatedly. This can result in unnecessary gas consumption, as each call, even if it returns early. Over time, this exhausts the gas limit for the block, making it difficult or expensive for legitimate users to interact with the contract.
Add this test in the points.t.sol file and
run: forge test --match-test test_NoAccessControl_DistributePoints -vv
The test shows that after 25.000 calls, the gas limit block is passed.
Although the function includes checks to return early if the conditions are not met, an attacker could still repeatedly call the function to consume gas and disrupt operations.
Likelihood: medium
Impact: medium/high
Manual review
Implement a modifier that restricts the function to be callable only by certain authorized address/addresses.
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.