Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126363 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 79CEB1A00BC for ; Sun, 9 Feb 2025 20:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1739134531; bh=ZIkTlDITUJDBhoX6mI4vQZyGZZNnc/Tn7CvDNlFxOpM=; h=Date:From:To:Cc:In-Reply-To:References:Subject:From; b=jNUyBfjz5bYraLogD7TbpNSZXBgiJotbYelXlv3oyFSBAhkBW21UKmjALDeFz0RyR zXEvMWSJULIGf9c6Tf0bQD2GXmwY70/EJnM2qK4UV7UsU+v4qAIkJAQLWqvHlZHKsr +ADNNZoMTXdGf/39AYP2Y1/rT68FE0P4ZAoycgsF7TEjF/fhjPqctgHlCG42W6qZc/ Ff8AcfEAS67OBcOGGZxH3W+TzLQotNCS3jb8YxfFVfLZyZWhl4YyiTyn4pbLnibcI5 54or5xGHSMk1PIus81aiTdQHOS6cQXgf7DO3UqZGlpyiA4xCbMvuXlTNOfowKKeJtJ KxFN47Z9jXo+Q== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 052D61801D5 for ; Sun, 9 Feb 2025 20:55:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,HTML_MESSAGE, RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-b6-smtp.messagingengine.com (fhigh-b6-smtp.messagingengine.com [202.12.124.157]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 9 Feb 2025 20:55:29 +0000 (UTC) Received: from phl-compute-01.internal (phl-compute-01.phl.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 13E0225401F2; Sun, 9 Feb 2025 15:58:13 -0500 (EST) Received: from phl-imap-09 ([10.202.2.99]) by phl-compute-01.internal (MEProxy); Sun, 09 Feb 2025 15:58:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bottled.codes; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1739134692; x= 1739221092; bh=ZIkTlDITUJDBhoX6mI4vQZyGZZNnc/Tn7CvDNlFxOpM=; b=p 0aVA1AOAMiYcsY9IwAtrLVHaluNCayMLTvjPjwoGkSxOMNwpShjxBLO8QmYcMdMm Vq7qVhcqjwg90nKvOLQF/Ewx679S9M1KDI/jnLntXy9E0FYC+xd1/jglBPerTrcv gwEgXNcnCyFiErKVpT0OGWhmL8/ZQQNtuFm9ge0JzxgsJq4+Tj4xklKWHe0YBjHh hYx3vb3Dgj/Z9r8YAZcc80zXElwBMx/jx9F63OrU5VFPxrWWwIimAqtpkt2cEkOt PAgad0nK7ePbCqVK9AQQXt5s/s8wuFoobOe5J5iJbi/j72haPAFzKo4gnAtRJP9w pzQ56a/bl1YoZL7vzSyCw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1739134692; x=1739221092; bh=ZIkTlDITUJDBhoX6mI4vQZyGZZNnc/Tn7Cv DNlFxOpM=; b=rR3a9yctnMT/6A0wrlF53t4ueN3XVFniL77fuIuWA4ZYPO1ktJ4 /KbWhihGFaHKHEqcJWicF/zo5nIz7YDgHhiGBzXPfddDU2XXTyGEe1VTI6/LCPve Diex7MTeXbSJ1eO5WH+IoMmuyXzPgdF2Yg5inObEjDZk6c3eYyHxDKg1ji2SbEAU jh++Q9jEc8tDLJku3v/e1k5PEZ08bE5Stp6yy5h8Dy3mGurfHj02rnkI9gs7I0fA IzOkzMza3wSyb5g3sKVvLlm5L3FVifMCBtTYxe9QyjunFN/f9KV36EFAddOCJb0R 7Edik44/+IxUhflHICb9Gs8I0zr2fYjFfBg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdefiedukecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefoggffhffvvefkjghfufgtsegrtderreertdej necuhfhrohhmpedftfhosgcunfgrnhguvghrshdfuceorhhosgessghothhtlhgvugdrtg houggvsheqnecuggftrfgrthhtvghrnhepffegveevgedtfffgffdvffdtvdehueelgeev keetffeuleeitdegkeejtedtteeknecuffhomhgrihhnpehphhhprdhnvghtnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhhosgessghothht lhgvugdrtghouggvshdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepthgvkhhivghlrgdvgeeisehgmhgrihhlrdgtohhmpdhrtghpthhtohep ihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: ifab94697:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 5D1B9780068; Sun, 9 Feb 2025 15:58:12 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Sun, 09 Feb 2025 21:57:51 +0100 To: "Kamil Tekiela" Cc: internals@lists.php.net Message-ID: <634b8634-5845-40bb-8b7b-758e953db696@app.fastmail.com> In-Reply-To: References: <4e41929c-fbd8-44f3-b72d-1b4e6526d001@app.fastmail.com> Subject: Re: [PHP-DEV] bcrypt warning on long passwords Content-Type: multipart/alternative; boundary=d443af81d2be416e965b4e225b5cc3fc From: rob@bottled.codes ("Rob Landers") --d443af81d2be416e965b4e225b5cc3fc Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sun, Feb 9, 2025, at 16:20, Kamil Tekiela wrote: > Hi, >=20 > I would say that this is a pretty bad idea. 72 bytes of entropy are > quite a lot for *PASSWORDS*. Even if some users use a pass phrase > longer than that, the first 72 bytes are enough to provide sufficient > security. People who use it for other stuff, like in the linked > article, are only to blame themselves. They use the wrong tool for the > job. The limitation of bcrypt is very clearly documented[1]. >=20 > Triggering a warning at runtime wouldn't be useful to the developer. > To avoid such a warning they would need to either reject passwords > longer than 72 bytes or truncate them before passing it to > password_hash. Both approaches provide no additional security or any > other value. That would only annoy either the developers or the users. >=20 > Letting bcrypt use only the first 72 bytes is a very safe and easy > solution. No need to overcomplicate it. >=20 > Regards, > Kamil >=20 > [1]: https://www.php.net/manual/en/function.password-hash.php#refsect1= -function.password-hash-parameters >=20 I fully agree with you, however it is also the default password hashing = algorithm. People may not read the docs and assume a generic implementat= ion that isn=E2=80=99t constrained. Since it is the default and has cons= traints, we should probably at least warn people when they are using it = wrong. They can then do whatever they want (ignore it, migrate to a diff= erent hashing algorithm, turn it into an exception, or adjust their inpu= ts). =E2=80=94 Rob --d443af81d2be416e965b4e225b5cc3fc Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

=
On Sun, Feb 9, 2025, at 16:20, Kamil Tekiela wrote:
Hi,

I would say that this is a pretty bad idea. 72 bytes of= entropy are
quite a lot for *PASSWORDS*. Even if some use= rs use a pass phrase
longer than that, the first 72 bytes = are enough to provide sufficient
security. People who use = it for other stuff, like in the linked
article, are only t= o blame themselves. They use the wrong tool for the
job. T= he limitation of bcrypt is very clearly documented[1].
Triggering a warning at runtime wouldn't be useful to the de= veloper.
To avoid such a warning they would need to either= reject passwords
longer than 72 bytes or truncate them be= fore passing it to
password_hash. Both approaches provide = no additional security or any
other value. That would only= annoy either the developers or the users.