Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lively Banana Gazelle - Gas Limit Issues in _rewardPreviousVouchers() leads dos #722

Open
sherlock-admin2 opened this issue Dec 5, 2024 · 0 comments

Comments

@sherlock-admin2
Copy link
Contributor

Lively Banana Gazelle

Medium

Gas Limit Issues in _rewardPreviousVouchers() leads dos

Summary

The function iterates through an array of vouchIds. If this array becomes very large, the loop could consume excessive gas and exceed the block gas limit.https://github.com/sherlock-audit/2024-11-ethos-network-ii/blob/main/ethos/packages/contracts/contracts/ReputationMarket.sol

Root Cause

  • Unbounded Iteration: The loop iteates up to totalVouches, which is the length of the vouchIds array. There's no inherent limit on how many vouches a profile can receive, so this array can grow very large.

  • Gas Cost per Iteration: Each iteration of the loop performs several storage reads (accessing vouches, vouch.archived, vouch.balance), calculations (amount.mulDiv), and storage writes vouch.balance += reward

  • Cumulative Gas Cost - vouchIds array grows cumulative gas cost of the loop increases proportionally. If the total gas cost exceeds the block gas limit, the transaction will fai preventing the distribution of rewards.

  • Denial-of-Service (DoS) Vector: A malicious actor could create a large number of vouches for a specific profile, making the _rewardPreviousVouchers() function prohibitively expensive to call.

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

No response

PoC

No response

Mitigation

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant