Commit Graph

25 Commits

Author SHA1 Message Date
Joseph Sutton
22749e918f gsskrb5: CVE-2022-3437 Check for overflow in _gsskrb5_get_mech()
If len_len is equal to total_len - 1 (i.e. the input consists only of a
0x60 byte and a length), the expression 'total_len - 1 - len_len - 1',
used as the 'len' parameter to der_get_length(), will overflow to
SIZE_MAX. Then der_get_length() will proceed to read, unconstrained,
whatever data follows in memory. Add a check to ensure that doesn't
happen.

Samba BUG: https://bugzilla.samba.org/show_bug.cgi?id=15134

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-11-15 17:51:45 -06:00
Joseph Sutton
4aca82c7d0 gsskrb5: CVE-2022-3437 Check the result of _gsskrb5_get_mech()
We should make sure that the result of 'total_len - mech_len' won't
overflow, and that we don't memcmp() past the end of the buffer.

Samba BUG: https://bugzilla.samba.org/show_bug.cgi?id=15134

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-11-15 17:51:45 -06:00
Joseph Sutton
ce6d8bbdbb gsskrb5: CVE-2022-3437 Avoid undefined behaviour in _gssapi_verify_pad()
By decrementing 'pad' only when we know it's safe, we ensure we can't
stray backwards past the start of a buffer, which would be undefined
behaviour.

In the previous version of the loop, 'i' is the number of bytes left to
check, and 'pad' is the current byte we're checking. 'pad' was
decremented at the end of each loop iteration. If 'i' was 1 (so we
checked the final byte), 'pad' could potentially be pointing to the
first byte of the input buffer, and the decrement would put it one
byte behind the buffer.

That would be undefined behaviour.

The patch changes it so that 'pad' is the byte we previously checked,
which allows us to ensure that we only decrement it when we know we
have a byte to check.

Samba BUG: https://bugzilla.samba.org/show_bug.cgi?id=15134

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2022-11-15 17:51:45 -06:00
Stefan Metzmacher
63ed962041 lib/gssapi/krb5: make _gssapi_verify_pad() more robust
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Love Hornquist Astrand
fcfa32b0b9 Use constant time memcmp 2009-08-17 12:04:51 +02:00
Love Hörnquist Åstrand
c99b2003e2 Implement gss_wrap_iov, gss_unwrap_iov for CFX type encryption types.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@25286 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-06-22 17:56:41 +00:00
Love Hörnquist Åstrand
269a7a057b flatten include headers
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@24382 ec53bebd-3082-4978-b11e-865c3cabbd6b
2009-01-25 00:35:00 +00:00
Love Hörnquist Åstrand
6937d41a02 remove trailing whitespace
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23815 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 09:21:03 +00:00
Love Hörnquist Åstrand
e172367898 switch to utf8 encoding of all files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@23814 ec53bebd-3082-4978-b11e-865c3cabbd6b
2008-09-13 08:53:55 +00:00
Love Hörnquist Åstrand
dfa6f7b248 reference all include files using krb5/
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@18334 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-10-07 22:16:04 +00:00
Love Hörnquist Åstrand
ee09f98c15 Rename local include file, remove global files.
Stop exposing global gssapi symbols.
Rename gss_context_id_t and gss_cred_id_t to local names.
Remove SPNEGO code, its now in its own gssapi module.
Add mechglue inquire functions.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17697 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-06-28 08:54:04 +00:00
Love Hörnquist Åstrand
a2dc8c858e Use const void * to instead of unsigned char * to avoid pointer
signedness warnings.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17563 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-05-13 15:30:37 +00:00
Love Hörnquist Åstrand
4e6c7cbe57 Less pointer signedness warnings.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17562 ec53bebd-3082-4978-b11e-865c3cabbd6b
2006-05-13 15:19:48 +00:00
Love Hörnquist Åstrand
6ff139c34a use rk_UNCONST
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@15452 ec53bebd-3082-4978-b11e-865c3cabbd6b
2005-06-16 20:40:49 +00:00
Love Hörnquist Åstrand
a3139e092e (gssapi_krb5_get_mech): make non static
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12789 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-09-09 02:09:03 +00:00
Love Hörnquist Åstrand
9ef52e1041 (_gssapi_verify_pad): verify padding of a gss wrapped message and
return its length


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12686 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-08-28 10:22:03 +00:00
Love Hörnquist Åstrand
9db3c84953 add _gssapi_decapsulate
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12645 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-08-26 02:20:08 +00:00
Love Hörnquist Åstrand
b50861a481 add decap functions that doesn't take the token type
also make all decap function take the oid mech that they should use


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@12637 ec53bebd-3082-4978-b11e-865c3cabbd6b
2003-08-25 19:57:43 +00:00
Assar Westerlund
e129105771 handle minor_status more consistently
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@10533 ec53bebd-3082-4978-b11e-865c3cabbd6b
2001-08-23 04:35:55 +00:00
Assar Westerlund
66dc0b483c (gssapi_krb5_verify_header): sanity-check length
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@8873 ec53bebd-3082-4978-b11e-865c3cabbd6b
2000-07-29 05:48:13 +00:00
Johan Danielsson
c5b916ca6f remove advertising clause
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7464 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-12-02 17:05:13 +00:00
Assar Westerlund
a69f4cf6dc signedness
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7376 ec53bebd-3082-4978-b11e-865c3cabbd6b
1999-11-13 04:18:09 +00:00
Johan Danielsson
5a32a5c8e7 Add copyright notice.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2389 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-07-16 21:40:05 +00:00
Assar Westerlund
a3fcb19867 New funtion `gssaspi_krb5_verify_header'
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@2275 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-07-14 11:40:31 +00:00
Assar Westerlund
16f56ac4cd new files
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1579 ec53bebd-3082-4978-b11e-865c3cabbd6b
1997-04-13 22:18:46 +00:00