Open jamuir opened 3 years ago
The test vector for #507 is expected to cause a failure (i.e. fail is good).
The reason it still fails when the fix is reverted/removed is because the ASN1 parser encounters invalid data when it reads beyond the test vector (typically it will read a byte that is not a valid ASN1 type id).
I think the primary vulnerability uncovered in #507 is not in utf-8 decoding; it is the underflow of the unsigned computation "*inlen -= len;" inside src/pk/asn1/der/sequence/der_decode_sequence_flexi.c
.
There should be an underflow check added inside der_decode_sequence_flexi.c
. I have a change ready that does that, but we still need a good test for #507. This is why I opened the current issue.
Description
There is a test vector for issue #507 in
tests/der_test.c
. However, if you revert the fix for #507, the test still passes (so the test in its current form doesn't really tell us much).Steps to Reproduce
One way is to reset to d2027d60, revert 25c26a3b and then run the tests.
Another way is to revert the fix for #507 manually:
To run the der test, I do this: