Bug #76972 [NEW]: Data truncation due to forceful ssl socket shutdown
| From: | manuel-php at mausz dot at | Date: | Thu, 04 Oct 2018 16:40:03 +0000 |
| Subject: | Bug #76972 [NEW]: Data truncation due to forceful ssl socket shutdown | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-217412@lists.php.net to get a copy of this message | ||
From: manuel-php at mausz dot at
Operating system: Linux
PHP version: 7.1.22
Package: FTP related
Bug Type: Bug
Bug description:Data truncation due to forceful ssl socket shutdown
Description:
------------
With TLS 1.3 session tickets get sent after the handshake has completed
(in TLS 1.2 this only happens upon renegotiation). With connections that
never read from the socket (like the FTP data connection) this data will
never actually be trained. However closing the socket without training
(unidirectional shutdown) causes an ECONNRESET on server side which
might lead to data truncation.
As explained in
https://www.openssl.org/docs/manmaster/man3/SSL_shutdown.html
PHP
instead should call SSL_read after calling SSL_shutdown until we've
received the servers close_notify alert.
For reference see CURLs implementation:
https://github.com/curl/curl/blob/e2dd435d473cdc97785df95d032276fafb4b7746/lib/vtls/openssl.c#L1267
As well as https://github.com/openssl/openssl/issues/6904
Test script:
---------------
ProFTPd with OpenSSL 1.1.1 and TLS 1.3.
Script is as simple as: ftp_put($ftp, "dest", "source", FTP_BINARY);
Results in: Transfer aborted. Link to file server lost
--
Edit bug report at https://bugs.php.net/bug.php?id=76972&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76972&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76972&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76972&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76972&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76972&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76972&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76972&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76972&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76972&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76972&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76972&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76972&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76972&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76972&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76972&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76972&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76972&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76972&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76972&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76972&r=mysqlcfg