lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 29 Nov 2017 16:26:37 +1100
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     Eric Biggers <ebiggers3@...il.com>
Cc:     linux-crypto@...r.kernel.org,
        "David S . Miller" <davem@...emloft.net>,
        linux-kernel@...r.kernel.org, Eric Biggers <ebiggers@...gle.com>,
        stable@...r.kernel.org
Subject: Re: [PATCH] crypto: salsa20 - fix blkcipher_walk API usage

On Tue, Nov 28, 2017 at 08:56:59PM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@...gle.com>
> 
> When asked to encrypt or decrypt 0 bytes, both the generic and x86
> implementations of Salsa20 crash in blkcipher_walk_done(), either when
> doing 'kfree(walk->buffer)' or 'free_page((unsigned long)walk->page)',
> because walk->buffer and walk->page have not been initialized.
> 
> The bug is that Salsa20 is calling blkcipher_walk_done() even when
> nothing is in 'walk.nbytes'.  But blkcipher_walk_done() is only meant to
> be called when a nonzero number of bytes have been provided.
> 
> The broken code is part of an optimization that tries to make only one
> call to salsa20_encrypt_bytes() to process inputs that are not evenly
> divisible by 64 bytes.  To fix the bug, just remove this "optimization"
> and use the blkcipher_walk API the same way all the other users do.
> 
> Reproducer:
> 
>     #include <linux/if_alg.h>
>     #include <sys/socket.h>
>     #include <unistd.h>
> 
>     int main()
>     {
>             int algfd, reqfd;
>             struct sockaddr_alg addr = {
>                     .salg_type = "skcipher",
>                     .salg_name = "salsa20",
>             };
>             char key[16] = { 0 };
> 
>             algfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
>             bind(algfd, (void *)&addr, sizeof(addr));
>             reqfd = accept(algfd, 0, 0);
>             setsockopt(algfd, SOL_ALG, ALG_SET_KEY, key, sizeof(key));
>             read(reqfd, key, sizeof(key));
>     }
> 
> Reported-by: syzbot <syzkaller@...glegroups.com>
> Fixes: eb6f13eb9f81 ("[CRYPTO] salsa20_generic: Fix multi-page processing")
> Cc: <stable@...r.kernel.org> # v2.6.25+
> Signed-off-by: Eric Biggers <ebiggers@...gle.com>

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Powered by blists - more mailing lists