[RFC][VOTE] Enable session.use_strict_mode by default

php.internals

Yasuo Ohgaki

10 years ago
Hi all, Vote for "Enable session.use_strict_mode by default" RFC has started. https://wiki.php.net/rfc/session-use-strict-mode Vote ends 2017/07/19 UTC. Thank you for voting!
-- Yasuo Ohgaki yohgaki@ohgaki.net

Yasuo Ohgaki

10 years ago
Hi, On Tue, Jul 12, 2016 at 10:01 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> Vote for "Enable session.use_strict_mode by default" RFC has started. > > https://wiki.php.net/rfc/session-use-strict-mode > > Vote ends 2017/07/19 UTC.
Some of us against this RFC. The consequences of disabling use_strice_mode (allowing uninitialized session ID by session module) are severe. I would like to know the reason why. Thank you! P.S. This RFC requires 2/3 in favor to pass.
-- Yasuo Ohgaki yohgaki@ohgaki.net

Yasuo Ohgaki

10 years ago
Hi all, Reminding the end of the vote. On Fri, Jul 15, 2016 at 7:06 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> On Tue, Jul 12, 2016 at 10:01 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: >> Vote for "Enable session.use_strict_mode by default" RFC has started. >> >> https://wiki.php.net/rfc/session-use-strict-mode >> >> Vote ends 2017/07/19 UTC. > > Some of us against this RFC. > The consequences of disabling use_strice_mode > (allowing uninitialized session ID by session module) are severe. > > I would like to know the reason why. > > Thank you! > > P.S. This RFC requires 2/3 in favor to pass.
The vote will end in 2 hours and 2 more in favor is required to pass at least. I don't know the reason why some of us against this RFC, but vote is the vote. My guess is you prefer more precise timestamp based session managed which has declined. Regards, P.S. Waiting the reason why against this RFC regardless of the vote result. Sites that have URL style such as http://www.example.com/ or http://example.com/app/ could be compromised very easily without session ID validation. Attacker can exploit them by unchangeable cookies via a single JavaScript injection. i.e. session_regenerate_id(true) wouldn't help to make sure users get new ID and system may use attacker supplied session ID.
-- Yasuo Ohgaki yohgaki@ohgaki.net

Stas Malyshev

10 years ago
Hi!
> The vote will end in 2 hours and 2 more in favor is required to pass at least. > > I don't know the reason why some of us against this RFC, but vote is > the vote. My guess is you prefer more precise timestamp based session > managed which has declined.
The number of votes (7) suggests most people either don't care or don't understand the issue enough to vote. Note that default is not necessary to run a secure setup, strictly speaking - you can always recommend using non-default setting. It'd be useful to hear from people voting "no" of course.
-- Stas Malyshev smalyshev@gmail.com

Yasuo Ohgaki

10 years ago
Hi Stas, On Tue, Jul 19, 2016 at 7:24 AM, Stanislav Malyshev <smalyshev@gmail.com> wrote:
>> The vote will end in 2 hours and 2 more in favor is required to pass at least. >> >> I don't know the reason why some of us against this RFC, but vote is >> the vote. My guess is you prefer more precise timestamp based session >> managed which has declined. > > The number of votes (7) suggests most people either don't care or don't > understand the issue enough to vote. > > Note that default is not necessary to run a secure setup, strictly > speaking - you can always recommend using non-default setting. It'd be > useful to hear from people voting "no" of course.
I agree. We should recommend safer usage. In case if this is not passed, I'll improve the manual. BTW, I wrote some example URLs. http://example.com/ is also vulunerable. Attackers can use httponly and secure attributes. I'm stunned by a browser prefers non-httponly cookie over httponly cookie years ago. In general, http://example.com/ is the safest URL, but not secure. Regards,
-- Yasuo Ohgaki yohgaki@ohgaki.net

Yasuo Ohgaki

10 years ago
Hi all, On Tue, Jul 12, 2016 at 10:01 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> Vote for "Enable session.use_strict_mode by default" RFC has started. > > https://wiki.php.net/rfc/session-use-strict-mode > > Vote ends 2017/07/19 UTC. >
Thank you for voting! Vote is finish 4 vs 4. The RFC is declined. I'll improve the manual so that attackers would not enjoy stealing PHP web app accounts. Besides documentation, we must improve the way it is now. i.e. Do not let attackers steal accounts easily with default configuration. To decide next move, I would like to start hearing the reason why from those who are against this RFC. Regards, BTW, we cannot blame browser developers because cookie spec is broken in first place.
-- Yasuo Ohgaki yohgaki@ohgaki.net

Bishop Bettini

10 years ago
On Mon, Jul 18, 2016 at 9:40 PM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> Hi all, > > On Tue, Jul 12, 2016 at 10:01 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: > > Vote for "Enable session.use_strict_mode by default" RFC has started. > > > > https://wiki.php.net/rfc/session-use-strict-mode > > > > Vote ends 2017/07/19 UTC. > > > > Thank you for voting! > > Vote is finish 4 vs 4. The RFC is declined. > I'll improve the manual so that attackers would not enjoy stealing PHP > web app accounts. > > Besides documentation, we must improve the way it is now. i.e. Do not > let attackers steal accounts easily with default configuration. > > To decide next move, I would like to start hearing the reason why from > those who are against this RFC. >
I abstained from voting. While I would be a "Yes" in principle, two specific statements in the RFC made me wary of following that instinct: 1. "external session data storage may have noticeable impact" 2. "lost sessions are far better than stolen sessions" I can hand waive the first one away, as performance can be optimized usually. But I can't really agree that, in general, lost sessions are "far better" than stolen ones: if lost sessions happen 1% of the time, and stolen sessions happen .001% of the time, then to me lost sessions are worse.

Yasuo Ohgaki

10 years ago
Hi Bishop, On Wed, Jul 20, 2016 at 9:47 AM, Bishop Bettini <bishop@php.net> wrote:
>> To decide next move, I would like to start hearing the reason why from >> those who are against this RFC. > > > I abstained from voting. While I would be a "Yes" in principle, two specific > statements in the RFC made me wary of following that instinct: > > 1. "external session data storage may have noticeable impact" > 2. "lost sessions are far better than stolen sessions" > > I can hand waive the first one away, as performance can be optimized > usually. But I can't really agree that, in general, lost sessions are "far > better" than stolen ones: if lost sessions happen 1% of the time, and stolen > sessions happen .001% of the time, then to me lost sessions are worse.
Thank you for feedback! 1. This overhead could be avoided. I'll add this to my task list. 2. This could be avoided by timestamp based session management. Lost sessions could happen: - When session_regenerate_id(true) which deletes old session data immediately. by: a. Race condition in browser by multiple requests. (Result in empty session ID) b. Race condition between server and browser by multiple requests. (Result in empty session data) c. Unstable network connection. (Server use new session ID, but browser didn't get new ID. Result in empty session data) It is advised to change session ID periodically. Obsolete(old) session data should be _deleted_. i.e. Simply calling session_regenerate_id() is not good enough because delete flag is false by default. However immediate removal causes above races. Therefore, short TTL for obsolete session is required. Chance of c. does not change regardless of session.use_strict_mode. session.use_strict_mode=1 increases chance of a. and b. because session module will try to set new session ID many times. e.g. Session could be expired while browser is loading resources. It uses multiple connections for access to images, css, js, etc. These resources could be using session for access control, customization, etc and result in many set-cookie headers for session. i.e. many set-cookies more chances for races. session.use_strict_mode=0 uses supplied old session ID and less likely to have race. i.e. No set-cookie headers are sent for new session ID. I cannot mention specific probability change. Hopefully, it would not be too much. (I don't like this, so I proposed timestamp based session management RFC) If session module removes old session data a little after session_regenerate_id() is called, chances to have races will not increase. This could be done by user script also. It might be an off topic, but FYI. PHP 5.x and 7.x --- Set TTL before regenerate and save --- $_SESSION['TTL'] = time() + 300; session_commit(); session_start(); session_regenerate_id(); // It simply generates and sets new session ID. unset($_SESSION['TTL'); ------------------------------------------------------------ PHP 7.x only. More efficient. --- Set TTL before regenerate and save --- $_SESSION['TTL'] = time() + 300; session_regenerate_id(); // It writes and closes old session data and // creates new session data since 7.0 unset($_SESSION['TTL']) ----------------------------------------------------------- And check TTL value where normal session_start() is called and destroy when it is expired. My other declined RFC does this for users automatically (no code at all) as well as other convenient things. Regards,
-- Yasuo Ohgaki yohgaki@ohgaki.net