Doc #76071 [Fbk->NoF]: function.openssl-encrypt php 5.6 code example it poor from a security standpoin
| From: | php-bugs at lists dot php dot net | Date: | Sun, 13 Jan 2019 04:22:04 +0000 |
| Subject: | Doc #76071 [Fbk->NoF]: function.openssl-encrypt php 5.6 code example it poor from a security standpoin | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16329@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76071&edit=1
ID: 76071
Updated by: php-bugs@lists.php.net
Reported by: junk at gathond dot dk
Summary: function.openssl-encrypt php 5.6 code example it poor
from a security standpoin
-Status: Feedback
+Status: No Feedback
Type: Documentation Problem
Package: OpenSSL related
Operating System: N/A
PHP Version: Irrelevant
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2019-01-01 22:18:13] girgias@php.net
Is this still the case?
Moreover, would it be possible to add a patch using the online editor, located at https://edit.php.net ?
------------------------------------------------------------------------
[2018-03-09 07:36:01] junk at gathond dot dk
Description:
------------
---
From manual page: http://www.php.net/function.openssl-encrypt
---
The example code has a few items which if not downright security issues, at least is bad practice
from a security POV.
issue 1:
The IV should be included in the HMAC calculation, otherwise this is left open to manipulation.
issue 2:
When decrypting the MAC should be verified before attempting to decrypt the contents, otherwise any
timing impacts on the decryption itself may still leak information about the correctness of the
guess.
Because of issue 1 it would probably also be better to reorder the data in the example so it is
$iv.$ciphertext_raw.$hmac instead.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76071&edit=1