gsskrb5: CVE-2022-3437 Check buffer length against overflow for DES{,3} unwrap
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>
This commit is contained in:

committed by
Nicolas Williams

parent
4aca82c7d0
commit
6a48779651
@@ -64,6 +64,8 @@ unwrap_des
|
|||||||
|
|
||||||
if (IS_DCE_STYLE(context_handle)) {
|
if (IS_DCE_STYLE(context_handle)) {
|
||||||
token_len = 22 + 8 + 15; /* 45 */
|
token_len = 22 + 8 + 15; /* 45 */
|
||||||
|
if (input_message_buffer->length < token_len)
|
||||||
|
return GSS_S_BAD_MECH;
|
||||||
} else {
|
} else {
|
||||||
token_len = input_message_buffer->length;
|
token_len = input_message_buffer->length;
|
||||||
}
|
}
|
||||||
@@ -76,6 +78,11 @@ unwrap_des
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
len = (p - (u_char *)input_message_buffer->value)
|
||||||
|
+ 22 + 8;
|
||||||
|
if (input_message_buffer->length < len)
|
||||||
|
return GSS_S_BAD_MECH;
|
||||||
|
|
||||||
if (memcmp (p, "\x00\x00", 2) != 0)
|
if (memcmp (p, "\x00\x00", 2) != 0)
|
||||||
return GSS_S_BAD_SIG;
|
return GSS_S_BAD_SIG;
|
||||||
p += 2;
|
p += 2;
|
||||||
@@ -219,6 +226,8 @@ unwrap_des3
|
|||||||
|
|
||||||
if (IS_DCE_STYLE(context_handle)) {
|
if (IS_DCE_STYLE(context_handle)) {
|
||||||
token_len = 34 + 8 + 15; /* 57 */
|
token_len = 34 + 8 + 15; /* 57 */
|
||||||
|
if (input_message_buffer->length < token_len)
|
||||||
|
return GSS_S_BAD_MECH;
|
||||||
} else {
|
} else {
|
||||||
token_len = input_message_buffer->length;
|
token_len = input_message_buffer->length;
|
||||||
}
|
}
|
||||||
@@ -231,6 +240,11 @@ unwrap_des3
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
len = (p - (u_char *)input_message_buffer->value)
|
||||||
|
+ 34 + 8;
|
||||||
|
if (input_message_buffer->length < len)
|
||||||
|
return GSS_S_BAD_MECH;
|
||||||
|
|
||||||
if (ct_memcmp (p, "\x04\x00", 2) != 0) /* HMAC SHA1 DES3_KD */
|
if (ct_memcmp (p, "\x04\x00", 2) != 0) /* HMAC SHA1 DES3_KD */
|
||||||
return GSS_S_BAD_SIG;
|
return GSS_S_BAD_SIG;
|
||||||
p += 2;
|
p += 2;
|
||||||
|
Reference in New Issue
Block a user