Commit Graph

28 Commits (798d8746620187eb1a825f3d5233fcea3a30cd0d)

Author SHA1 Message Date
Victor Julien ba24bb82fa der: don't overwrite errcode
If the code has already been set it is more detailed than the more
generic 'invalid object'.
9 years ago
Pierre Chifflier 3140e4598a DER parser: ensure errcode is set for every return path 9 years ago
Pierre Chifflier 2d34e402c0 DER parser: fix undefined behaviors and add missing length tests
Fix several undefined behaviors, caused by possible use or read of
uninitialized memory.
9 years ago
Victor Julien 12c350f77d der/afl: free data during fuzzing 9 years ago
Victor Julien 261f15a146 der: fix recursion depth not being handled correctly
In a mix of sequences the 'depth reached' error would not
be fully propagated.

Found with AFL.
9 years ago
Victor Julien 7ac041b872 der: warn if null passed to decoders
Remove null checks for errcode.
9 years ago
Victor Julien df3a3c7857 der/asn1: limit recursion
Limit the number of recursive calls in the DER/ASN.1 decoder to avoid
stack overflows.

Found using AFL.
9 years ago
Mats Klepsland 03cda74b95 util-decode-der: decode GeneralizedTime
Decode ASN.1 element type GeneralizedTime in DER-encoded
structures.
10 years ago
Mats Klepsland 45d87d66c0 afl: add support for AFL PERSISTANT_MODE
Add support for AFL PERSISTANT_MODE when Suricata is compiled with
a supported compiler (only afl-clang-fast for now).

This gives a ~10x performance boost when fuzzing.
10 years ago
Mats Klepsland 8111eb934f QA: add --afl-der=<file>
Expose SSL/TLS certificate decoding (DER) to commandline
using --afl-der=<file>.
10 years ago
Mats Klepsland c2f0f82bb4 util-decode-der: fix hang detected by AFL
Fix hang that occurs when child->length is zero, resulting in an
endless loop.
10 years ago
Mats Klepsland a985b450e3 util-decode-der: code cleanup 10 years ago
Mats Klepsland f9ac42b36f util-decode-der: fix NULL dereference bug
Make sure that the length is not longer than the size of the buffer
provided.
11 years ago
Mats Klepsland c0dd911591 util-decode-der: fix heap-buffer-overflow 11 years ago
Victor Julien 2fbfd6efcc DER decoder: don't use strlcpy on non-strings 11 years ago
Pierre Chifflier fa73a0bb8f Fix possible wrap in uint32_t addition in DER parser
Signed-off-by: Pierre Chifflier <pierre.chifflier@ssi.gouv.fr>
11 years ago
Victor Julien b605ee6fb2 DER decoding: fix potential memory leak
This would only happen in memory failure conditions.

util-decode-der.c:634:27: warning: Potential leak of memory pointed to by 'child'
    return (Asn1Generic *)node;
13 years ago
Victor Julien 472e061c6d build: more checking for includes 14 years ago
Victor Julien f9cde717e7 Use SCFree instead of free in DER decoder. 14 years ago
Pierre Chifflier d866f38982 TLS: add variable to store the error code in the decoder
Use a variable to store the decoding error code if required, and remove
the calls to SCLogInfo and SCLogDebug.
15 years ago
Eric Leblond a9bb17e097 tls-handshake: add sanity checks. 15 years ago
Eric Leblond 01c7e5bde6 tls-handshake: Add some missing free in error handling.
When DecodeAsn1BuildValue function fails, it may be necessary to
do some clean-up in the calling functions.
15 years ago
Eric Leblond 480db00fd7 tls-handshake: DecodeAsn1BuildValue should return -1 for error
This patch modifies DecodeAsn1BuildValue to have it return -1 when
there is a too big number of bytes announced in the ASN.1 message.
15 years ago
Eric Leblond 8f885ce810 TLS parser: add sanity checks on loop
It was possible in some loop to read data placed after the buffer
resulting in invalid/unpredictable value. This patch fixes two of
this issues.
15 years ago
Eric Leblond cb1a75fc9e TLS parser: modify OCTETSTRING
This patch does on over allocation of 1 for the OCTETSTRING
to be able to add a 0 at the end. This will then
allow us to use the string in printf.
15 years ago
Pierre Chifflier 5a65a17f00 TLS parser: add handing of UTF8STRING
Some certificate contains UTF8STRING which is a subset of
OCTETSTRING. This patch adds support for this type of string.
15 years ago
Eric Leblond afba81bb27 decode ASN.1: Factorize value reading
This patch factorizes the reading of integer value and fix some
indentation. By convention, a value of 0xffffffff is returned
if the size of the integer is too big. In this case, the hexadecimal
value (which is also read) must be used.
15 years ago
Pierre Chifflier f77fcdb3e8 Add ASN.1 parser for X509 certificates (in DER format)
Signed-off-by: Pierre Chifflier <pierre.chifflier@ssi.gouv.fr>
15 years ago