Scruffy Concrete Swift
Medium
The absence of a graduation check in the buyVotes
function will cause financial manipulation and potential token distribution discrepancies for Ethos as a malicious actor will purchase votes in graduated markets, inflating or deflating vote prices postgraduation.
-In ReputationMarket.sol
:443 :absence of graduated market check in 'buyVotes'
https://github.com/sherlock-audit/2024-12-ethos-update/blob/main/ethos/packages/contracts/contracts/ReputationMarket.sol#L440C2-L499C6
1.The contract owner sets graduatedMarkets[profileId] to true to mark the market as graduated.
2.A malicious user needs to call the buyVotes
function in ReputationMarket.sol
with a profileId that has already been graduated.
3.The contract needs to allow the purchase of votes without verifying the market's graduated status, as there is no check for graduated markets in the buyVotes function.
External Pre-conditions
- No external protocols need to change for this vulnerability to occur, as it solely depends on the contract's internal logic.
- The attacker needs to have enough ETH to fund the vote purchase transaction, but no specific conditions on external protocols are required for the exploit to be possible.
Attack Path
- A malicious user identifies a graduated market by checking the
graduatedMarkets
status for a specificprofileId
. - The malicious user calls the
buyVotes
function inReputationMarket.sol
, passing in theprofileId
of the graduated market. - Since there is no check for graduated markets in the
buyVotes
function, the transaction proceeds, and the malicious user is able to purchase votes. - The user inflates or deflates the vote prices by purchasing votes in the graduated market, manipulating the market dynamics.
the inflation/deflation can cause discrepancies in the protocol
-
Implement a check in the
buyVotes
function to verify that the market is not graduated before allowing votes to be purchased. This can be done by adding a condition likeif (graduatedMarkets[profileId]) revert MarketAlreadyGraduated();
at the beginning of the function. -
Enhance the
graduateMarket
function to lock the market completely after graduation, preventing any further transactions or interactions with the market. -
Introduce a more robust mechanism for locking the market state, ensuring that once the market is graduated, no further actions can be taken that could affect vote prices or the funds in the market.