rfc:session-use-strict-mode

This is an old revision of the document!


PHP RFC: Your Title Here

Introduction

Due to HTTP cookie implementation, it is easy to create unchangeable/undeletable cookies via JavaScript injections. Single JavaScript injection vulnerability allows attackers to steal user session forever without session.use_strict_mode=1.

Proposal

Enable session.use_strict_mode INI setting by default.

  • session.use_strict_mode=1

in hard coded, php.ini-*.

Backward Incompatible Changes

session.use_strict_mode=1 can result in lost sessions without changes like

However, lost sessions are far better than stolen sessions.

3rf party session handlers must implement session ID validation handler for session.use_strict_mode=1 to work actually. i.e. PS_FUNCS_SID or PS_FUNCS_UPDATE_TIMESTAMP must be used. PS_FUNCS_UPDATE_TIMESTAMP is strongly recommended.

Proposed PHP Version(s)

PHP 7.1.0

RFC Impact

To SAPIs

None

To Existing Extensions

Session

To Opcache

None

New Constants

None

php.ini Defaults

session.use_strict_mode=1 for all

  • hardcoded default values
  • php.ini-development values
  • php.ini-production values

Open Issues

Unaffected PHP Functionality

3rd party and user defined session save handlers implementation is not affected.

3rf party session handlers must implement session ID validation handler for session.use_strict_mode=1 to work actually. i.e. PS_FUNCS_SID or PS_FUNCS_UPDATE_TIMESTAMP must be used. PS_FUNCS_UPDATE_TIMESTAMP is strongly recommended.

Future Scope

Session ID should be managed by TTL timestamp precisely in order to session ID is managed correctly.

Proposed Voting Choices

This project requires a 2/3

Patches and Tests

Not provided as this change is trivial INI default change. Tests scripts are modified to work regardless of session.use_strict_mode=0/1 already.

Implementation

After the project is implemented, this section should contain

  1. the version(s) it was merged to
  2. a link to the git commit(s)
  3. a link to the PHP manual entry for the feature

References

Rejected Features

Keep this updated with features that were discussed on the mail lists.

rfc/session-use-strict-mode.1467671224.txt.gz · Last modified: 2017/09/22 13:28 (external edit)