Repository navigation
Conversation
This is a security bug, since it makes PBKDF2 faster for attackers than defenders. So it should be fixed from PHP 8.2 on. Fixes php#9604
0e39d92 to
690e0ac
Compare
LamentXU123
left a comment
There was a problem hiding this comment.
Have you benchmarked the difference between it? Generally we treat performance improvements as a feature to be landed on master only and only vulnerbility fixes qualifies for 8.2. @php/release-managers-82 ?
| due to partial address comparison). (CVE-2026-91768) (Alexandre Daubois) | ||
|
|
||
| - Hash: | ||
| . Improved performance of hash_pbkdf2. (Sjoerd Langkemper) |
There was a problem hiding this comment.
Feel free to add a UPGRADING entry.
|
|
|
I measured this on PHP-8.2 03e9593 (5db5b7a merges cleanly) with GCC 13.3, GCC 14.2, clang 18.1 and clang 20.1 on an i7-13700H, built with the flags of the official Docker image; PHP-8.2 does not build with Change in CPU cycles per call with the PR, relative to PHP-8.2 (negative = fewer cycles, faster); median of five alternating runs, a fixed 28-byte password and 16-byte salt (
Correctness: I compared the output with PHP-8.2 for all 44 algorithms of Code: one suggestion. ZEND_SECURE_ZERO(inner_context, ops->context_size);
ZEND_SECURE_ZERO(outer_context, ops->context_size);
efree(inner_context);
efree(outer_context);The About security: the speed-up does not make passwords stronger by itself. With the same iteration count an attacker's cost per guess is the same as before; the gain becomes strength only where an application raises the count. It also does nothing for existing hashes: PBKDF2 uses the password in every iteration, so a stored hash cannot be extended to more iterations without the original password, only recomputed with a higher count when the user next logs in. For applications concerned about password storage, I would recommend No correctness issues found. LGTM. Full tables, scripts and data: https://github.com/ArtUkrainskiy/php-src-bench/tree/main/reports/pr-24188-pbkdf2 |
- Drop const signature change, that was unnecessary - Add UPGRADING message that iteration count can be increased - Securely zero HMAC contexts before freeing
|
Ping @adoy @saundefined @ramsey as PHP 8.2 release managers. |
LamentXU123
left a comment
There was a problem hiding this comment.
I think this is correct. I agree to merge it to master at least but for lower branches I don't have strong opinions.
This is a security bug, since it makes PBKDF2 faster for attackers than defenders. So it should be fixed from PHP 8.2 on.