Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:114111 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 21820 invoked from network); 23 Apr 2021 19:38:26 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Apr 2021 19:38:26 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BD4D31804CC for ; Fri, 23 Apr 2021 12:41:46 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [85.215.255.24]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 23 Apr 2021 12:41:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619206903; cv=none; d=strato.com; s=strato-dkim-0002; b=ORPcv1oXx13Llt0vYC1ZL3ScWYh518h2+QjAdZ0eOSWu06IXA7FsS+A7xPwTrENJn2 aP+45716Tx8+Tz4QyL77N20jFQl5+37GVLoWmn1ZzIR2l9Com3Nh3VJMDtKP4t2HEM/W 7It87d2EjfqUIM+TIrFWbAF4TGIvl269jkKygVnEnBpQbUOLFhtEtbBU2eyqn+h0B4rG L9DuJTc1Mwgv5RujYYBFeQdExkxKKvMHwx1skNcUb0frQ/13D7jgTkcWp4G9l2obILU1 /2MP8BlYVySOjAVoDnDTlEvlxPTDHXq3vRofDLCuaHdBxsNjac5j/Dc3TPEnwVKuvExU 7cJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1619206903; s=strato-dkim-0002; d=strato.com; h=Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:Cc:Date: From:Subject:Sender; bh=Qcgdqn2+Je1/lcBlNwsxc7xhdPtHIoZxdtn+GrhNkkM=; b=adLZlomnyh+fPGSztErwVJcd2bqOHXHPCK9bBFKS1NIDNpYHrzBlBbuQ/6I0I4dHQp VsxH7Ao00LWAzt24Q/NhZaXvUuNu7A6DKZIe3BPYXHvhdCqoKrCIFDI6ABvi/llDMlbQ wR47HL6+PVjptKo1Dfej5xrxyDo+GyDr+C6wuvgzsx6tctqQN/BcDjaTL8jLU3obC8Ho Z68UHEpjLXEuxq5059YoAhTUmVhYLJ+/hqBZdWrWH4r2jtesN2ulIqkRQQaOSCFXYibc Ys4eFf/oGKkp1YJWwuqw2UhGEXIu+239EK1zKhdegh1sCnEAI4cQU8VcJof8crWsI8Sx 5MnQ== ARC-Authentication-Results: i=1; strato.com; dkim=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1619206903; s=strato-dkim-0002; d=kelunik.com; h=Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References:Cc:Date: From:Subject:Sender; bh=Qcgdqn2+Je1/lcBlNwsxc7xhdPtHIoZxdtn+GrhNkkM=; b=Qz+JedoZEk+/bHRYlhFj4OsSsqDCStkzM2+vHvk1JCWVOxlVMaZk8WzbGLFaUvJM7k +ZpbIGSNHS+ohHLbohBDCuMrMwEJ9dsQebqD2W8UtvCQMbMq8maAYKg1nDPbeH9YNKtf vt2azHeHhs0XvsmHKoh9U1hfvIxzM/VJsomWSvVNRhLzq6Lkx7a1qDUPk54vLFW7QiC6 EjpLE+f+CR/cCgNHQfXnB1AQNWzG8UcCGJMYsARai73cjYuOpo6ewKHgnzJoQy/obmAp rOJ4JpIrFreDuKd+Eik19H9Rw5DkswDzpCaUnq3Xatk706obYv7aE8UXVUV715S7UnLU iW1Q== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":IWkkfkWkbvHsXQGmRYmUo9mlsGbEv0XHBzMIJSS+jKTzde5mDb8AaBIcZi8tcA==" X-RZG-CLASS-ID: mo00 Received: from mail-pl1-f181.google.com by smtp.strato.de (RZmta 47.24.3 AUTH) with ESMTPSA id R0b4f3x3NJfhdH6 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate) for ; Fri, 23 Apr 2021 21:41:43 +0200 (CEST) Received: by mail-pl1-f181.google.com with SMTP id h20so25732374plr.4 for ; Fri, 23 Apr 2021 12:41:43 -0700 (PDT) X-Gm-Message-State: AOAM533+IvBdutU8Fqt4MJbtUpWEeoeaUwDzuBEoiZtFFjS6Z9ze+iSc nUJghbOwp8iMZJK5g0YLdNj2kaxJF7T2EdAhTMk= X-Google-Smtp-Source: ABdhPJx1aUVuaMAEnXybXheGCbP7rIfbiT17kCER02WIDHNw+BThw7xNcWZDQMAoJtWquivQ+RHllRCQCxPzKi0D0xM= X-Received: by 2002:a17:902:b18f:b029:ec:7ac0:fd1a with SMTP id s15-20020a170902b18fb02900ec7ac0fd1amr5356446plr.84.1619206902714; Fri, 23 Apr 2021 12:41:42 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Fri, 23 Apr 2021 21:41:33 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Sara Golemon Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000041151905c0a8fc41" Subject: Re: [PHP-DEV] Binary (un)safety of password_hash() used with PASSWORD_BCRYPT From: me@kelunik.com (Niklas Keller) --00000000000041151905c0a8fc41 Content-Type: text/plain; charset="UTF-8" Sara Golemon schrieb am Fr., 23. Apr. 2021, 00:21: > On Thu, Apr 22, 2021 at 3:27 PM Niklas Keller wrote: > >> Do you have a link to places where frameworks are doing this? I built a > >> contrived example which I think summarizes the behavior you described > here: > >> https://3v4l.org/6tunp > > > > I have links to a library / blog post: > > > > https://github.com/paragonie/password_lock > > > https://paragonie.com/blog/2016/02/how-safely-store-password-in-2016#why-bcrypt > > > > We're probably better off returning false for verify then instead of > throwing? Hash could hash a random password instead if NUL bytes are > present. > > > > So this library (which I'd need convincing is widely used) doesn't > actually have any null byte problems. > Yes, the digest produced by hash(...,true) could have null bytes, > but it's immediately piped into base64_encode() which papers directly over > that issue producing only ascii printable output. > Scott knows what he's doing, so yes, this library isn't vulnerable nor did I say that. It is rather an example of pre-encoding. People might remember the approach incorrectly or have a similar idea themselves and make mistakes in their own version of such code. Best, Niklas > --00000000000041151905c0a8fc41--