php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71087 Phar - cannot use OpenSSL signatures with custom stub
Submitted: 2015-12-10 21:49 UTC Modified: 2021-02-07 04:22 UTC
From: securtiy at paragonie dot com Assigned: cmb (profile)
Status: No Feedback Package: PHAR related
PHP Version: 5.6.16 OS: Debian 8.1 Jessie with Dotdeb
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
7 + 5 = ?
Subscribe to this entry?

 
 [2015-12-10 21:49 UTC] securtiy at paragonie dot com
Description:
------------
Is there any reason why we can't use Phar::setSignatureAlgorithm() after Phar::setStub()?

https://github.com/defuse/php-encryption/pull/139

If there's a reason this shouldn't allowed, could the documentation please be updated to reflect this decision?

If this is a bug, it's breaking our ability to publish signed a .phar for defuse/php-encryption


Test script:
---------------
https://raw.githubusercontent.com/paragonie/php-encryption/29dc5e866bb08dac38fef721f3356f2e2fea76c3/other/build_phar.php

Expected result:
----------------
Silent success, but if I do this:

$phar = new \Phar(dirname(__DIR__).'/dist/defuse-crypto.phar');
$signature = $phar->getSignature();
var_dump($signature);

...it shouldn't say its "hash_type" is "SHA-1"

Actual result:
--------------
PHP Fatal error:  Uncaught exception 'PharException' with message 'unable to copy stub of old phar to new phar "/var/www/defuse/php-encryption/dist/defuse-crypto.phar"' in /var/www/defuse/php-encryption/other/build_phar.php:37
Stack trace:
#0 /var/www/defuse/php-encryption/other/build_phar.php(37): Phar->setSignatureAlgorithm(16, '-----BEGIN PRIV...')
#1 {main}
  thrown in /var/www/defuse/php-encryption/other/build_phar.php on line 37

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-10 21:58 UTC] security at paragonie dot com
In our use case, this resolved the problem...

https://github.com/paragonie/php-encryption/commit/72418c9c9c4b244523da678a629227e16840de51

...but that's a workaround, not a solution.
 [2021-01-27 11:51 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-01-27 11:51 UTC] cmb@php.net
I cannot reproduce this issue with PHP-7.4 on Windows.  That
operation should be allowed anyway, so either the bug has been
fixed in the meantime, or there is some relevant difference in our
environments, or maybe my reproduce script doesn't exactly
reproduce your build script.

So, if you still have this issue with any of the actively
supported PHP versions[1], please provide a minimal self-contained
test script.

[1] <https://www.php.net/supported-versions.php>
 [2021-02-07 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 12:01:27 2024 UTC