]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: fix integer overflow in XMSS private key parsing.
authordjm@openbsd.org <djm@openbsd.org>
Wed, 9 Oct 2019 00:02:57 +0000 (00:02 +0000)
committerDamien Miller <djm@mindrot.org>
Wed, 9 Oct 2019 00:11:41 +0000 (11:11 +1100)
Reported by Adam Zabrocki via SecuriTeam's SSH program.

Note that this code is experimental and not compiled by default.

ok markus@

OpenBSD-Commit-ID: cd0361896d15e8a1bac495ac583ff065ffca2be1

sshkey-xmss.c

index a29e33f395aecd42435aafbb46c7d7d91f81ec81..9e5f5e47565853dc6dab3df35d00c4a0376f2d61 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshkey-xmss.c,v 1.5 2019/06/28 13:35:04 deraadt Exp $ */
+/* $OpenBSD: sshkey-xmss.c,v 1.6 2019/10/09 00:02:57 djm Exp $ */
 /*
  * Copyright (c) 2017 Markus Friedl.  All rights reserved.
  *
@@ -977,7 +977,8 @@ sshkey_xmss_decrypt_state(const struct sshkey *k, struct sshbuf *encoded,
                goto out;
        }
        /* check that an appropriate amount of auth data is present */
-       if (sshbuf_len(encoded) < encrypted_len + authlen) {
+       if (sshbuf_len(encoded) < authlen ||
+           sshbuf_len(encoded) - authlen < encrypted_len) {
                r = SSH_ERR_INVALID_FORMAT;
                goto out;
        }