note 126285 added to function.hash-equals
| From: | DimeCadmium at main dot php dot net | Date: | Wed, 28 Jul 2021 23:15:06 +0000 |
| Subject: | note 126285 added to function.hash-equals | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-216676@lists.php.net to get a copy of this message | ||
The code that examplehash is STILL not timing-attack-proof on the length, as PHP will do an implicit
bounds check when you attempt to index the user-input-string. However, the polyfills which he calls
incorrect are in fact correct polyfills. The problematic behavior he observes (a length oracle) does
in fact exist, *however it also exists in the built-in function which they are polyfilling* as is
clear from even a cursory read of the documentation on which examplehash was commenting. Tests on
the first parameter ($known_string, which he calls $secret) are NOT problematic as the first
parameter is trusted information - and that parameter determines the execution time of the function
anyway. (Telling the user how long it takes to process the number of characters in THEIR string,
which they know the length of, is ALSO a problem, which is what examplehash's code does.
Telling the user how long it takes to process the number of characters in YOUR string, which they do
NOT know the length
of, is NOT a problem.)
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 74.192.150.87)
----
Manual Page -- https://php.net/manual/en/function.hash-equals.php
Edit -- https://main.php.net/note/edit/126285
Del: integrated -- https://main.php.net/note/delete/126285/integrated
Del: useless -- https://main.php.net/note/delete/126285/useless
Del: bad code -- https://main.php.net/note/delete/126285/bad+code
Del: spam -- https://main.php.net/note/delete/126285/spam
Del: non-english -- https://main.php.net/note/delete/126285/non-english
Del: in docs -- https://main.php.net/note/delete/126285/in+docs
Del: other reasons-- https://main.php.net/note/delete/126285
Reject -- https://main.php.net/note/reject/126285
Search -- https://main.php.net/manage/user-notes.php