Closed sherlock-admin closed 9 months ago
Invalid, lack of proof to show how this is possible and also impractical usage of parameters to reach OOG based on sherlock rules.
Exception: In case the array length is controlled by the trusted admin/owner or the issue describes an impractical usage of parameters to reach OOG state then these submissions would be considered as low.
djanerch
medium
Functions can reach block gas-limit via unbounded operations
Summary
Smart contract vulnerabilities, particularly related to gas limit issues, can have severe consequences. One critical vulnerability arises when functions demand more gas than the block limit allows, commonly occurring in loops that iterate over dynamic data structures.
Vulnerability Detail
Certain smart contract functions are at risk due to inadequate size validation of arrays, particularly in loops iterating over dynamic data structures. Neglecting to check input array sizes before execution can lead to computational requirements exceeding the block gas limit, resulting in transaction failures and state rollback. This vulnerability is especially crucial in decentralized finance (DeFi) applications where precise function execution is vital.
Impact
Gas limit vulnerabilities extend beyond transaction failures, potentially causing funds locking, contract freezing, operational disruptions, and broader economic consequences for users and the ecosystem.
Funds Locking: Users may struggle to access or withdraw funds, leading to financial losses and trust erosion.
Contract Freezing: Gas limit failures can freeze the contract's state, affecting DApps relying on its functionality.
Operational Disruption: Disruptions in DeFi protocols may inconvenience users and harm the project's reputation.
Economic Consequences: Gas-related failures can have economic repercussions for users, investors, and the ecosystem.
Code Snippet
Tool Used
Manual Review
Recommendation
To strengthen smart contracts against gas limit vulnerabilities and mitigate their impact, consider implementing the following measures:
Check Array Length:
require
statement before iterating to prevent exhaustion.Limit Iteration:
for
loop with proper indexing to iterate over array elements, ensuring bounds are respected.Gas Limit Consideration: