Bug #75494 [Opn->Dup]: php_openssl_setup_verify overzealously adds default files / dirs to trust store
| From: | cmb@php.net | Date: | Fri, 13 Aug 2021 11:37:42 +0000 |
| Subject: | Bug #75494 [Opn->Dup]: php_openssl_setup_verify overzealously adds default files / dirs to trust store | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-235798@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75494&edit=1
ID: 75494
Updated by: cmb@php.net
Reported by: luke at lerlacher dot de
Summary: php_openssl_setup_verify overzealously adds default
files / dirs to trust store
-Status: Open
+Status: Duplicate
Type: Bug
Package: OpenSSL related
PHP Version: 7.2.0RC5
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This has already been reported as bug #65154.
Previous Comments:
------------------------------------------------------------------------
[2017-11-07 07:08:19] luke at lerlacher dot de
Description:
------------
in interpreting $cainfo passed through the caller, php_openssl_setup_verify adds a default CA File
to the store using
X509_LOOKUP_load_file(file_lookup, NULL, X509_FILETYPE_DEFAULT)
if no valid CA file was passed, and a default CA dir using
X509_LOOKUP_add_dir(dir_lookup, NULL, X509_FILETYPE_DEFAULT)
if no valid CA dir was passed.
This means, if the user passes a single file location in $cainfo, indicating that they want only
this file checked, the default ca dir will nevertheless be added to the store.
Test script:
---------------
<?php
$ca = array(
// a random ca-certificate that the signed mail was *not* signed with is required here
'/etc/ca-certificates/extracted/cadir/T__RKTRUST_Elektronik_Sertifika_Hizmet_Sa__lay__c__s___H5.pem'
);
// a pkcs7-signed email signed by a certificate in the default trust store is required
$msg = 'signed_email.eml';
$verify = openssl_pkcs7_verify($msg, 0, $msg . '.cert', $ca);
var_dump($verify);
?>
Expected result:
----------------
The expected output is:
bool(false)
This indicates that the mail was not signed by any of the certificates passed in $cainfo.
Actual result:
--------------
The actual output is:
bool(true)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75494&edit=1