Bug #68920 [Opn->Ver]: php_x509_fingerprint_match need stricter checks
| From: | rdlowrey@php.net | Date: | Wed, 04 Mar 2015 16:57:58 +0000 |
| Subject: | Bug #68920 [Opn->Ver]: php_x509_fingerprint_match need stricter checks | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-191149@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68920&edit=1
ID: 68920
Updated by: rdlowrey@php.net
Reported by: erik at datahack dot se
Summary: php_x509_fingerprint_match need stricter checks
-Status: Open
+Status: Verified
Type: Bug
Package: OpenSSL related
PHP Version: 5.6.5
-Assigned To:
+Assigned To: rdlowrey
Block user comment: N
Private report: N
New Comment:
+1 ... fixed locally. Will update/close once I push relevant commits upstream.
Previous Comments:
------------------------------------------------------------------------
[2015-01-27 12:51:33] erik at datahack dot se
Description:
------------
In php_x509_fingerprint_match() and its caller, due to its logic the "SSL context" option
'peer_fingerprint' may pass and establish the connection with or without a warning, if set
to an invalid value (specifically data type).
Test script:
---------------
<?php
error_reporting(E_ALL);
// pass, warning
var_dump(stream_socket_client("ssl://php.net:443", $errno, $errstr, 30,
STREAM_CLIENT_CONNECT, stream_context_create([
'ssl' => ['verify_peer'=> false, 'peer_fingerprint'
=> true]
])));
// pass, no warning
var_dump(stream_socket_client("ssl://php.net:443", $errno, $errstr, 30,
STREAM_CLIENT_CONNECT, stream_context_create([
'ssl' => ['verify_peer'=> false, 'peer_fingerprint'
=> null]
])));
// pass, no warning
var_dump(stream_socket_client("ssl://php.net:443", $errno, $errstr, 30,
STREAM_CLIENT_CONNECT, stream_context_create([
'ssl' => ['verify_peer'=> false, 'peer_fingerprint'
=> []]
])));
// pass, no warning
var_dump(stream_socket_client("ssl://php.net:443", $errno, $errstr, 30,
STREAM_CLIENT_CONNECT, stream_context_create([
'ssl' => ['verify_peer'=> false, 'peer_fingerprint'
=> ['foo']]
])));
Expected result:
----------------
All these connections should fail or at least give a warning.
Actual result:
--------------
Connection is established in all cases...
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68920&edit=1