Skip to content
This repository was archived by the owner on Oct 20, 2023. It is now read-only.

Commit 4510a62

Browse files
committed
Tighten up a comparison in ssh2_userauth_add_sigblob.
If a malicious SSH agent were to send an RSA signature blob _longer_ than the key modulus while BUG_SSH2_RSA_PADDING was enabled, then it could DoS the client, because the put_padding call would keep allocating memory in 'strbuf *substr' until address space ran out.
1 parent f955300 commit 4510a62

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ssh2userauth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1788,7 +1788,7 @@ static void ssh2_userauth_add_sigblob(
17881788
/* debug("modulus length is %d\n", len); */
17891789
/* debug("signature length is %d\n", siglen); */
17901790

1791-
if (mod_mp.len != sig_mp.len) {
1791+
if (mod_mp.len > sig_mp.len) {
17921792
strbuf *substr = strbuf_new();
17931793
put_data(substr, sigblob.ptr, sig_prefix_len);
17941794
put_uint32(substr, mod_mp.len);

0 commit comments

Comments
 (0)