php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Sec Bug #70498 SessionHandleInterface docs example allows users to read/write arbitrary files
Submitted: 2015-09-15 09:06 UTC Modified: 2017-09-06 09:52 UTC
From: lbarnaud@php.net Assigned: cmb (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2015-09-15 09:06 UTC] lbarnaud@php.net
Description:
------------
The SessionHandleInterface example allows users to read or write arbitrary files on the system by passing an evil session id:


function read($id):

    file_get_contents("$this->savePath/sess_$id");


function write($id):

    file_put_contents("$this->savePath/sess_$id", $data);


$id is the value of the SESSID cookie and it is allowed to contain any string, including "/../var/www/backdoor.php".

Since this is a documentation example, users are expecting it to be correct, and might copy/paste it as-is.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-09-28 23:06 UTC] stas@php.net
-Summary: Security issue in SessionHandlerInterface +Summary: SessionHandleInterface docs example allows users to read/write arbitrary files
 [2017-08-26 12:11 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=342943
Log: Fix bug #70498 (SessionHandlerInterface example is vulnerable)

Instead of actually adding proper input validation to the example,
we prominently note that this would have to be done for production
code.
 [2017-08-26 12:14 UTC] cmb@php.net
-Status: Open +Status: Suspended -Assigned To: +Assigned To: cmb
 [2017-08-26 12:14 UTC] cmb@php.net
Since the fix will not be rolled out immediately, I'm suspending
this ticket for a while. This also gives the translators some time
to update the translations.
 [2017-09-06 09:52 UTC] cmb@php.net
-Status: Suspended +Status: Closed
 [2020-02-07 06:06 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=e1d271d4ca935f631176000cd1625af88386fcd5
Log: Fix bug #70498 (SessionHandlerInterface example is vulnerable)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 21:01:29 2024 UTC