Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121144 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 56352 invoked from network); 25 Sep 2023 20:45:42 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 25 Sep 2023 20:45:42 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0FDDE1804C1 for ; Mon, 25 Sep 2023 13:45:42 -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,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 25 Sep 2023 13:45:41 -0700 (PDT) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4056ce55e7eso40259985e9.2 for ; Mon, 25 Sep 2023 13:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=craigfrancis.co.uk; s=default; t=1695674740; x=1696279540; darn=lists.php.net; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6p2B2QjMjSfXtjFnqGm1sTBABaorPqqvIsIPNBxrrY8=; b=J4ygJwP0bDJr1beiEdHQqLHzNHTOwA/dm5QJPvpwlEQRVe6a0w3c4I6e5Z1Ll2JASL 32Qoy+v0uRyaMamqlDjQR1GEEv/SBbrQYojceP6fa4WmulBt7Irgluw7BqfHNbv+SXbW Z3Pjf/rjhk0htMSGhWN33dkFmHZcTjN4S/6sM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695674740; x=1696279540; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6p2B2QjMjSfXtjFnqGm1sTBABaorPqqvIsIPNBxrrY8=; b=JgnycVcGh+SP97oGroMwClhtV2LtCj/yYcbK484INdmbAFVXyXFXrjmzXfjVEcNbu2 yowyJMfoyQvddjHfMx4pCIZx+Bh69JDg4tg+BCZIRi9FvciWu9+7J+cjF/8lursELSR3 OFoOUEipSf9e0vWbcoMQqDiXWHt2QsLBdW1Q2SF72ZJIU57WDXiyQPqPnQxjfDcdNGse ahF/1GgGMv2FwU48FgivQ/7a5LCyCoDCBGy3banCuS6cY7YRmFzzfTeStetDlDj6kf+p y/416zm+U+cfVSke602n16c2U4PRbuW0UCNx21dHv8iKgNhe6t9B5VsPzHHt9C4mWW8s mjNQ== X-Gm-Message-State: AOJu0Yzo+SWmFHHOSS6WRi1gDuBMAP96uVD06ncFRHs+p9h4RI6uiapZ d6dPyrsirZrADhK7Tctn/Nb6aA== X-Google-Smtp-Source: AGHT+IG1+eJ9lT8ybtmOwnzSHNzujXkGSCu6ZhX49cSBhlm5hWvM90CzyP0C97HQO8Ax6B7E36m4Ow== X-Received: by 2002:a1c:7c07:0:b0:401:b1c6:97dc with SMTP id x7-20020a1c7c07000000b00401b1c697dcmr6733274wmc.23.1695674739873; Mon, 25 Sep 2023 13:45:39 -0700 (PDT) Received: from smtpclient.apple ([92.234.79.97]) by smtp.gmail.com with ESMTPSA id v20-20020a05600c215400b00401b242e2e6sm10618696wml.47.2023.09.25.13.45.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Sep 2023 13:45:39 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) In-Reply-To: <05ef9741-7a5d-cfc7-1e3d-42071fac232a@bastelstu.be> Date: Mon, 25 Sep 2023 21:45:36 +0100 Cc: Nicolas Grekas , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <27DD144B-31CC-44D1-B20A-9C6254F8D853@craigfrancis.co.uk> References: <44945ACB-066E-4805-8EF2-26796BA01671@craigfrancis.co.uk> <05ef9741-7a5d-cfc7-1e3d-42071fac232a@bastelstu.be> To: =?utf-8?Q?Tim_D=C3=BCsterhus?= X-Mailer: Apple Mail (2.3731.700.6) Subject: Re: [PHP-DEV] [VOTE] Increasing the default BCrypt cost From: craig@craigfrancis.co.uk (Craig Francis) On 25 Sep 2023, at 18:07, Tim D=C3=BCsterhus wrote: > I've now did the maths and you really need rate limiting no matter if = you use costs 10, 11 or 12, so I believe the DoS argument is a little = moot. Yes, someone being malicious could easily generate enough requests to = create an Denial of Service Attack, but I was referring to normal users = logging in, on a small hosting service. Think of a little web-shop that has just sent out an email to ~30,000 = customers, and initially they get a gentle ~20 customers logins at a = time... with a cost of 10, that causes the HTML for other all other = pages to go from 0.09 seconds to ~1.1 seconds, not good, but manageable; = cost of 11 takes that to ~2.1 seconds; cost of 12 goes to ~4.2 seconds. (I got those numbers with a simple `ab -n 200 -c 20` to call = password_hash, and `while true; do curl -o /dev/null -s -w = '%{time_total}\n'` to request a basic page while this is running to get = some rough averages). >> While a high cost might make you *feel* good, the DoS problem is = real, especially on older hardware - 10 is still fine today, 11 is a = fair improvement against brute force guessing, 12 is just burning CPU = cycles today, simply because the difference does not address the problem = of commonly used passwords (like 123456, password1, monkey, etc). >=20 > The attacker does not know which users use less secure passwords and = thus will spend effort for "secure" and "insecure" passwords alike. = Doubling the costs will mean that each password takes twice as long to = crack on average, making cracking twice as expensive. For less secure = passwords that can make the difference between "being cracked" and "not = being cracked" if the attacker is willing to spend a given amount of CPU = time per password. Yep, and we are defining a baseline, a default that is good enough for = everyone; this is why I'd consider what is being achieved, think of = normal customers, choosing passwords that can be found on the 14.3 = million record RockYou list, to test that at "640 hashes per second", = would be 6.2 hours per hash, so the 11 vs 12 cost for these people won't = really make much of a difference to them. Craig For those who want a bit of background, while this 3 years old video = covers a different subject, @chick3nman (of hashcat fame) notes the = use/value of bcrypt: https://www.youtube.com/watch?v=3DOQD3qDYMyYQ&t=3D381s