The QuantAMMWeightedPool::onSwap function lacks validation for incorrect token indices.This absence of checks could result in errors or unintended behavior when an invalid token index is used.
In the onSwap function, the indexIn and indexOut are passed via a request struct.
Since the protocol allows a maximum of 8 tokens, the indices should be greater than or equal to 0 and less than 8.
However, the function does not implement any check to ensure the indices are within this valid range.
Index out of range can be given to the function.
Without the proper index validation, incorrect values could be calculated, or the function may behave unexpectedly. This could lead to errors or unintended outcomes during the swap process.
Manual review
Add a check to mitigate the bug :-
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.