Hi Arvids, On Wed, May 11, 2016 at 5:54 PM, Arvids Godjuks <arvids.godj...@gmail.com> wrote: > 2016-05-11 11:05 GMT+03:00 Yasuo Ohgaki <yohg...@ohgaki.net>: >> >> Hi Arvids, >> >> On Wed, May 11, 2016 at 4:33 PM, Arvids Godjuks >> <arvids.godj...@gmail.com> wrote: >> > i'm -1 on the CSRF in the sessions at all. Even more -1 on having it on >> > by >> > default and having any INI settings that affect how engine processes >> > data in >> > runtime. >> > People just don't learn until they shotgun themselves I guess. >> >> Override them if you don't like admins to set INI values. I've >> modified session_start() so that it can set INI values as function >> parameter. >> http://php.net/session_start > > > Admins can just forbid to change any settings. And there is an ini setting > "disable_functions" and alike. They will setup up session auto start and > forbid usage of the session_start. And force the CSRF. Been in similar > situations, done that, never want to deal with it again.
Then you should check offending settings. INI system has downsides, but it has lots of upsides. You just have to live with it. Regarding this RFC, you don't have to care "don't work situation" because it's obvious to users. I'll make sure the manual has proper warnings. I understand you don't like INI system, but it cannot be good reason for declining tool for major security issue. There should be stronger reason to decline. IMHO. > I'm not even talking about the fact, that I may have reasons to use a > different hashing algorithm in the first place. > Dealing with JS side, when you need to pass the CSRF token there is next can > of worms. > And then you get to the part, where you need to use a distributed session > management, that has it's own can of worms. And forcing CSRF handling into > the session module probably is going to make it hard to deal with it at all. > > So no, sessions are sessions, they should have only one thing to be > responsible for - storing data. Nothing else. It's a module that already has > a lot of issues. What you are proposing, is to do what APC did - mixing code > opcache with shared memory storage. We all know how it ended. Session task is not a storing data. If you need storage, you can simply use file, database, etc. Session task, by definition, is to manage state of connections/requests, distinguish connections/requests i.e. provide authenticity. CSRF is authenticity problem by its definition. Therefore, it is a task of session manager. I know other system's session managers fail to cover it, but we don't have to follow inferior design. > >> >> >> >> > What I personally would be for, is a CSRF aPI module that comes as >> > default, >> > like the Password API one, that gives ability to generate good quality >> > CSRF >> > tokens and manage it. >> >> Imagine number of CSRF vulnerabilities in PHP apps. It's countless. >> >> Letting users to choose right way is not an good options. It is >> proven. I've added session.use_strict_mode (disallows permanent >> session hijack, etc) many years ago, but fair number of users aren't >> enabling this option. I suspect most majority of users aren't enabled >> it. Even if we provide solution, it's hard to be adopted. If there is >> no solution, outcome is easy to imagine. IMHO. >> >> Users had access to good PRNG. Even if mt_rand() is used, it is hard >> enough for attackers to guess, yet there are countless CSRF >> vulnerabilities. What's the reason to ignore the fact, huge number of >> CSRF vulnerabilities exist in PHP apps? >> >> I cannot understand rationale behind you and others think it should be >> users task completely... > > > If user does not want to use CSRF, you can't force him. And realisticly > speaking, how are you going to force the tokents on the GET urls? Rewrite > them. In JSON? In XML? etc? C'mon, these days url's there are single page > apps with their own routing and stuff and you will never get a CSRF token in > any automated maner there. It needs to be done by developer of the app. I don't force, but CSRF protection is optional. If you don't need it, don't use simply. > >> >> >> Anyway, I fails to see the reason why PHP should not invalidate CSRF >> attacks against POST requests with 2 simple parameter or INI... > > > Because they may be out of your control and just forced on you by a 3rd > party. > Not to mention that 3rd party libraries will do stuff that will not take into > account > this setting or do some hack, and that will negate any security. If apps has its own CSRF protection, it works independently. What will negate security? I can think of "session.csrf_domains" misuse/abuse, but it is the same as cross origin request misuse/abuse. Cross origin request is common these days and user should be able to use them correctly. "session.csrf_domains" misuse/abuse is not our problem. Regards, -- Yasuo Ohgaki yohg...@ohgaki.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php