President Elector

First Flight #24
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Use of `block.timestamp` Can Be Manipulated by Miners

Summary

The contract relies on block.timestamp for critical time-based logic, such as determining when a new president can be selected. While block.timestamp is generally reliable, miners have limited ability to manipulate it within certain bounds. This could potentially allow a miner to influence the timing of elections slightly, although the impact is minimal.

Vulnerability Details

  • Affected Function: selectPresident

  • Issue Explanation:

    • Use of block.timestamp:

      if (
      block.timestamp - s_previousVoteEndTimeStamp <=
      i_presidentalDuration
      ) {
      revert RankedChoice__NotTimeToVote();
      }
    • Miner Influence: Miners can manipulate block.timestamp within a range of approximately ±15 seconds (the actual allowance depends on the consensus protocol and network conditions).

    • Potential Exploit Scenario:

      • A miner could slightly accelerate or delay the ability to call selectPresident by manipulating the timestamp, though only within a limited window.

      • This manipulation could allow a miner to be the first to call selectPresident, but only if the timing is extremely precise.

Impact

Severity: Low

  • Minor Influence on Election Timing: The miner's ability to manipulate block.timestamp is limited and unlikely to have a significant impact on the contract's functionality.

  • No Major Security Risk: The manipulation window is too small to cause substantial harm or provide a meaningful advantage.

  • Limited Practical Exploitability: Exploiting this would require significant effort for minimal gain.

Tools Used

  • Manual Code Review: Identified the reliance on block.timestamp in time-based conditions.

  • Understanding of Ethereum Consensus Rules: Knowledge of how miners can and cannot manipulate block timestamps.

Recommendations

  • Accept the Minor Risk:

    • Given the low impact and limited exploitability, it may be acceptable to continue using block.timestamp.

Updates

Lead Judging Commences

inallhonesty Lead Judge 9 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.