php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30273 Apache crach when preforming openssl operations.
Submitted: 2004-09-29 13:34 UTC Modified: 2004-10-23 14:08 UTC
Votes:3
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: oskar at lanstorm dot org Assigned:
Status: Not a bug Package: Apache related
PHP Version: 5.0.2 OS: Linux 2.4.26-grsec
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: oskar at lanstorm dot org
New email:
PHP Version: OS:

 

 [2004-09-29 13:34 UTC] oskar at lanstorm dot org
Description:
------------
Hey.
I`ve tried to send encrypted and signed e-mail via php using the openssl_pkcs7* functions and they crash my apache.
Code looks like this...

<?
$data = <<<EOD

To jest test wiadomosci.
Powinna byc zaszyfrowana i podpisana cyfrowo.

EOD;

$plik = fopen('oskar.pem', 'r');
$key=fread($plik, 10000);
fclose($plik);

// save message to file
$fp = fopen('msg.txt', 'w');
fwrite($fp, $data);
fclose($fp);

//podpisz
if (openssl_pkcs7_sign('msg.txt', 'signed.txt', 'file:///usr/local/apache/htdocs/oskar.pem',
    array('file:///usr/local/apache/htdocs/oskar.pem', 'pass'),
    array('To' => 'Oskar <oskar@lanstorm.org>',
            'From' => 'oskar <oskar@lanstorm.org>'))) {

//szyfruj
if (openssl_pkcs7_encrypt('signed.txt', 'enc.txt', $key,
    array('To' => 'Oskar <oskar@lanstorm.org>',
          'From' => 'oskar <oskar@lanstorm.org>',
          'Subject' => 'Zaszyfrowana i podpisana elektronicznie wiadomosc ze strony www.'))) {
    // slij
    exec(ini_get('sendmail_path') . ' < enc.txt');
}
}
else {
echo(openssl_error_string());
}

?>

When i`m lunching the script apache child process segfault:|.

[Wed Sep 29 13:20:35 2004] [notice] child pid 2586 exit signal Segmentation fault (11)

Everything else is ok.PHP works fine on "normal" (not using openssl functions) scripts.But on this one it crash.Code is good because somethimes it works and don`t crash.

Regards.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-29 14:36 UTC] wez@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
 [2004-09-29 15:55 UTC] oskar at lanstorm dot org
Backtrace:

(gdb) run -X
Starting program: /usr/local/apache/bin/httpd -X

Program received signal SIGSEGV, Segmentation fault.
0x44041a3c in OBJ_obj2nid () from /usr/lib/libcrypto.so.0
(gdb) bt
#0  0x44041a3c in OBJ_obj2nid () from /usr/lib/libcrypto.so.0

That seems to be openssl bug.Maybe i shuld send it to they buglist?Dunno:|
 [2004-09-29 16:49 UTC] wez@php.net
Read the bt instructions again; the trace you've provided is not terribly helpful.
Make sure you build a debug build of PHP and paste the full trace.
 [2004-09-29 21:41 UTC] oskar at lanstorm dot org
Re.
I cannot provide more info cuz that all the output from gdb.PHP is compiled with --enable-debug option.And in gdb i see only this one frame.
 [2004-10-23 13:57 UTC] mikael dot suvi at trigger dot ee
Seems to me the problem is with openssl. After upgrading to openssl-0.9.7d-r1 the code is not crashing anymore.
 [2004-10-23 14:08 UTC] tony2001@php.net
Not a PHP bug -> bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 19:01:28 2024 UTC