Re: Re: [PHP-DEV] [RFC] more secure unserialize()

2013-04-02 Thread Michael Gauthier
On 2013-03-31 00:27, Stas Malyshev wrote: Hi! I think Stas proposes a solution to the problem and I think Anthony proposes a viable alternative. I would say that Anthony has found the shortest distance between the two points (the problem and the solution), however. The fact is that people do

Re: [PHP-DEV] [RFC] more secure unserialize()

2013-04-01 Thread Steve Clay
On 4/1/13 3:18 PM, Stas Malyshev wrote: Why? Making use of one parameter is orders of magnitude easier than refactoring your whole application to not use serialize() (especially if you need object support). Under the RFC, unserialize could potentially create __PHP_Incomplete_Class objects (inc

Re: [PHP-DEV] [RFC] more secure unserialize()

2013-04-01 Thread Stas Malyshev
Hi! > Yeah, well, the people who do that are also the ones that are unlikely > to make use of the new parameters to secure themselves. In order to make Why? Making use of one parameter is orders of magnitude easier than refactoring your whole application to not use serialize() (especially if you

Re: [PHP-DEV] Re: [lists.php] Re: [PHP-DEV] [RFC] more secure unserialize()

2013-03-31 Thread Ángel González
On 31/03/13 23:18, ALeX wrote: >> JSON and serialize() are (inherently) different serialization formats with >> different use-cases [...] > Yes, and json requires that all strings (including the keys) has to be > valid utf-8, and I'm sure that's not always the case (serialize can > use binary data

[PHP-DEV] Re: [lists.php] Re: [PHP-DEV] [RFC] more secure unserialize()

2013-03-31 Thread ALeX
> JSON and serialize() are (inherently) different serialization formats with > different use-cases [...] Yes, and json requires that all strings (including the keys) has to be valid utf-8, and I'm sure that's not always the case (serialize can use binary data in both places). -- PHP Internals -

Re: [PHP-DEV] [RFC] more secure unserialize()

2013-03-31 Thread Steve Clay
I think this RFC would worsen the problem of misusing the serialize round-trip. Even if we make the docs clearer, we'd still be sending the message that there's a new "safer" unserialize and some would certainly use that new feature to be more lax about guarding serialized structures. It also

Re: [PHP-DEV] [RFC] more secure unserialize()

2013-03-31 Thread Nikita Popov
On Sun, Mar 31, 2013 at 5:27 AM, Stas Malyshev wrote: > > I think Stas proposes a solution to the problem and I think Anthony > > proposes a viable alternative. I would say that Anthony has found the > > shortest distance between the two points (the problem and the solution), > > however. > > The

Re: [PHP-DEV] [RFC] more secure unserialize()

2013-03-31 Thread Anthony Ferrara
Stas, The fact is that people do use serialize() for data that may be > accessible by the user (or made accessible by unrelated security issues, > which may be upgraded in severity by this - e.g. from SQL injection to > persistent code backdoor on the server). There are many ways to do > things d

Re: [PHP-DEV] [RFC] more secure unserialize()

2013-03-31 Thread Sanford Whiteman
>> And what about automatic un/serialize() of objects in $_SESSION? >> People don't even see those function calls in their code, so dropping >> the function/ality would be a wildly drastic move. > Nothing about it, the change is for unserialize() function. OK. I thought of this as one core securi

Re: [PHP-DEV] [RFC] more secure unserialize()

2013-03-30 Thread Stas Malyshev
Hi! > And what about automatic un/serialize() of objects in $_SESSION? > People don't even see those function calls in their code, so dropping > the function/ality would be a wildly drastic move. Nothing about it, the change is for unserialize() function. > tread gently, as in your suggestion of

Re: [PHP-DEV] [RFC] more secure unserialize()

2013-03-30 Thread Sanford Whiteman
> This is not a good situation, and presently there are no way to > avoid it except dropping serialize() completely - which may not be > an option is some cases and in any case would require serious > changes to the production code. And what about automatic un/serialize() of objects in $_SESSION?

Re: [PHP-DEV] [RFC] more secure unserialize()

2013-03-30 Thread Stas Malyshev
Hi! > I think Stas proposes a solution to the problem and I think Anthony > proposes a viable alternative. I would say that Anthony has found the > shortest distance between the two points (the problem and the solution), > however. The fact is that people do use serialize() for data that may be

Re: [PHP-DEV] [RFC] more secure unserialize()

2013-03-30 Thread Sherif Ramadan
On Sat, Mar 30, 2013 at 11:05 PM, Anthony Ferrara wrote: > Stas, > > Serious question: Why bother trying to clean this up? Why not just > recommend using JSON or some other generic serialization without tieing > into specific objects, and pushing the creation logic into userland (where > it belong

Re: [PHP-DEV] [RFC] more secure unserialize()

2013-03-30 Thread Anthony Ferrara
Stas, Serious question: Why bother trying to clean this up? Why not just recommend using JSON or some other generic serialization without tieing into specific objects, and pushing the creation logic into userland (where it belongs IMHO, at least from a security perspective). At least for any times

[PHP-DEV] [RFC] more secure unserialize()

2013-03-30 Thread Stas Malyshev
Hi! As many probably know, unserialize() has a security issue following from the fact that you can create objects with data from unserialize(), and these object may have behavior that is invoked automatically - namely __destruct - that can result in unintended results. See e.g. http://heine.famili