Doc #66564 [NEW]: crypt() seems to silently discard input after a certain length
| From: | ss23 at ss23 dot geek dot nz | Date: | Fri, 24 Jan 2014 00:06:22 +0000 |
| Subject: | Doc #66564 [NEW]: crypt() seems to silently discard input after a certain length | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-10878@lists.php.net to get a copy of this message | ||
From: ss23 at ss23 dot geek dot nz
Operating system:
PHP version: Irrelevant
Package: Documentation problem
Bug Type: Documentation Problem
Bug description:crypt() seems to silently discard input after a certain length
Description:
------------
It seems there is a limit to the input length of the password/str
parameter to crypt(), however this is not documented anywhere.
This has profound security implications, and all users should be aware
of the issue.
My preference would be a warning/notice triggered when you exceed the
length, as well as documentation on this.
Test script:
---------------
$long = str_repeat('a', 100);
var_dump(crypt($long . "1", '$2y$04$saltysaltysaltysaltytt'));
var_dump(crypt($long . "2", '$2y$04$saltysaltysaltysaltytt'));
var_dump(crypt($long . "12", '$2y$04$saltysaltysaltysaltytt'));
Expected result:
----------------
A different hash in each case
Actual result:
--------------
string(60)
"$2y$04$saltysaltysaltysaltyte9usMwh4/IIx0al18sl5oEFVM2Z/XJ7q"
string(60)
"$2y$04$saltysaltysaltysaltyte9usMwh4/IIx0al18sl5oEFVM2Z/XJ7q"
string(60)
"$2y$04$saltysaltysaltysaltyte9usMwh4/IIx0al18sl5oEFVM2Z/XJ7q"
--
Edit bug report at https://bugs.php.net/bug.php?id=66564&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66564&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66564&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66564&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66564&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66564&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66564&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66564&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66564&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66564&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66564&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66564&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66564&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66564&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66564&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66564&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66564&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66564&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66564&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66564&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66564&r=mysqlcfg