-
Notifications
You must be signed in to change notification settings - Fork 3
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
getWord in XRandom.sol, produces inconsistent output #1008
Comments
141345 marked the issue as duplicate of #508 |
alex-ppg marked the issue as selected for report |
The Warden has illustrated that the While a correct observation, this would simply double the chance of |
alex-ppg changed the severity to QA (Quality Assurance) |
alex-ppg marked the issue as grade-b |
alex-ppg marked the issue as not selected for report |
Lines of code
https://github.com/code-423n4/2023-10-nextgen/blob/main/smart-contracts/XRandoms.sol#L28-L32
Vulnerability details
Impact
getWord() never returns the last element and returns the element at index 0 with twice the possibility compared to others
Proof of Concept
getWord
function is called from insiderandomWord
the value of
randomNum
always will remain between 0 <= randomNum < 100But the
getWord
is implemented correctly for this value rangeHere is a relationship between
randomNum
variable and the output ofgetWord
functionAs it can be seen,
wordsList[0]
which is "Acai" will be returned twice andwordlist[99]
which is "Watermelon" will never be returned.Tools Used
Manual
Recommended Mitigation Steps
Should be changed to
Assessed type
Other
The text was updated successfully, but these errors were encountered: