Open hats-bug-reporter[bot] opened 1 month ago
Wtf You gotta look up the meaning of length bro
I can't really understand this report, and as @greenlucid pointed out, the most plausive explanation for this report is that the hunter is confused to the way arrays work in solidity.
Github username: @a12jmx Twitter username: a12jmx Submission hash (on-chain): 0xdc7536ba44de0140420850294b1b484ca657cd3c7e1933822b75e195e67b4010 Severity: high
Description: Description\
Note:
Highlighted words with a=>
in front of them links directly to the code if clicked.The functions
MarketFacotry::createCategoricalMarket
,MarketFacotry::createMultiCategoricalMarket
,MarketFacotry::createScalarMarket
, &MarketFacotry::createMultiScalarMarket
all use the same array which gets set in a struct =>CreateMarketParams
This array adds up strings of relevant outcomes in a prediction.
Basic example, for instance:
Question: "Insert anything?"
Outcome 1: Yes
Outcome 2: No
or,
Question: "Insert anything possible?"
Outcome 1: Yes
Outcome 2: No
Outcome 3: Only if (insert certain params to meet)
Looking at the code, 3 functions intend to proceed in execution only if the
outcomes
array is filled with 2 or more outcomes:=>
MarketFacotry::createCategoricalMarket
=>
MarketFacotry::createMultiCategoricalMarket
=>
MarketFacotry::createMultiScalarMarket
One function only proceeds to execute if the
outcomes
array have only 2 outcomes:=>
MarketFacotry::createScalarMarket
The intention is to only follow through with these functions if the outcome count in the
outcomes
array have at least 2 outcomes filled in all scenarios. Technically, it only starts checking at the 3rd position of theoutcomes
array within these functions.Array indexes start at 0, unlike normal counting where you typically begin at 1. So the 1st item is the 0th, the 2nd item is the 1st, the 3rd item is the 4th, etc… So an array with 4 items would only go to the 3rd index.
So, briefly:
Array position
0
will == real position1
Array position
1
will == real position2
Array position
2
will == real position3
Array position
3
will == real position4
This leads to, if there are 2 outcomes, i.e.
Yes
orNo
, which are extremely popular outcomes in predication markets, the outcomes will never occur on a smart contract level and essentially, whoever predicted will have their collateral stuck as the outcome never technically follows through.Impact\
Classifying this as a
High
vulnerability for the following reasons:No external or internal malicious actions need to occur for this to take effect.
This will happen every time there are a minimum of 2 outcomes.
The protocol, at a fundamental level offers prediction markets, and 2 outcomes such as
Yes
orNo
as an example are incredibly prevelant in prediction markets.Seer has 4 different types of prediction markets in reference to =>
Key Components:Prediction market:
in it's docs:Categorical Markets: Select one out of multiple outcomes.
Multi-Categorical Markets: Similar to categorical market but allowing selection of multiple outcomes.
Scalar Markets: Numeric outcome within a specified range.
Multi-Scalar Markets: Multiple numeric outcomes.
These prediction types are the 4 functions outlayed above which gets effected where the 2 outcomes can be techincally anything in regards to it's specific prediction type with the array being a string, on a coding level, anything that has double qoutions arround it, i.e.
"quote"
or"1"
, is a string, but this will not change the lack of execution of the functions above mentioned.Attachments
Revised Code File (Optional)
Given arrays start at the 0th position, the checks to see if the
outcomes
array has at least 2 values should be revised down from a check of2
to a check of1
as follows:=>
MarketFacotry::createCategoricalMarket
=>
MarketFacotry::createMultiCategoricalMarket
=>
MarketFacotry::createScalarMarket
=>
MarketFacotry::createMultiScalarMarket