snarkVM
snarkVM copied to clipboard
[Bug] Remaining deserialization issues
Other than the pending changes in https://github.com/AleoHQ/snarkVM/pull/1985 (including the ones in the review comments), the following issues were found via snarkOS network message fuzzing:
- [x] the
size
member ofEvaluationDomain
is used to resize vectors; it'su64
, which can be maliciously crafted to be large enough to cause an OOM - proposed solution: manually implement
CanonicalDeserialize
and limit the maximum allowedsize
to some concrete value or a smaller data type - [ ] The
degree
of theEpochChallenge
, which is derived from theepoch_polynomial
member, can cause an OOM when used inhash_to_polynomial
(and ultimately inhash_to_coefficients
), as it's used to determine the number ofcoefficients
collected into a vector - proposed solution: check for a fixed maximum value for the
degree
after it's read inEpochChallenge::read_le
or reduce its data type belowu32
- [x] (varuna)
Commitments::deserialize_with_mode
can panic due to integer overflow when callingbatch_sizes.iter().sum()
at the very beginning - proposed solution: change that line to
let mut w = Vec::new();
- [x]
BatchCertificate::read_le
needs to useIndexMap::new
instead of::with_capacity
(no longer an issue with the 2nd version of this object, and the 1st one is going to be removed)
I'm now fuzzing the current version; the 1st point is no longer applicable, the next 2 can still cause an OOM, and the recent deserialization patches omitted a bit in the BatchCertificate
, probably because it's being deprecated (added to the list).
Closing due to the final open point no longer being applicable. A new round of fuzzing will follow soon.