You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While Loop with Decrementing Votes:
If the user cannot afford the maxVotesToBuy, the function iteratively decrements the currentVotesToBuy value and recalculates the total cost using _calculateBuy until the vote cost matches the funds provided (msg.value).
In cases where maxVotesToBuy is significantly high, and the provided funds are insufficient to purchase even one vote, the loop will execute until currentVotesToBuy reaches zero.
Gas Exhaustion Risk:
When a user sets maxVotesToBuy to a large value and provides insufficient funds to buy even a single vote, the while loop continues decrementing until it runs out of gas, causing the transaction to revert.
Internal Pre-conditions
No response
External Pre-conditions
No response
Attack Path
No response
Impact
User may spend too much gas and got his transaction reverted
Tall Daisy Mammoth
Medium
Vulnerability in
buyVotes
FunctionSummary
The
buyVotes
function is vulnerable to a potential Denial of Service (DoS) vector caused by inefficient handling of vote purchasing calculations.Root Cause
ReputationMarket.sol:460-467
https://github.com/sherlock-audit/2024-12-ethos-update/blob/main/ethos/packages/contracts/contracts/ReputationMarket.sol#L460-L467
While Loop with Decrementing Votes:
If the user cannot afford the
maxVotesToBuy
, the function iteratively decrements thecurrentVotesToBuy
value and recalculates the total cost using_calculateBuy
until the vote cost matches the funds provided (msg.value
).In cases where
maxVotesToBuy
is significantly high, and the provided funds are insufficient to purchase even one vote, the loop will execute untilcurrentVotesToBuy
reaches zero.Gas Exhaustion Risk:
When a user sets
maxVotesToBuy
to a large value and provides insufficient funds to buy even a single vote, the while loop continues decrementing until it runs out of gas, causing the transaction to revert.Internal Pre-conditions
No response
External Pre-conditions
No response
Attack Path
No response
Impact
User may spend too much gas and got his transaction reverted
No response
PoC
No response
Mitigation
Implement a better optimal buy vote calculation
The text was updated successfully, but these errors were encountered: