Re: Change User on a pconnect
| From: | Rasmus Lerdorf | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: Change User on a pconnect | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-12181@lists.php.net to get a copy of this message | ||
On Sat, 6 Nov 1999, Thies C. Arntzen wrote:
> On Sat, 6 Nov 1999, Rasmus Lerdorf wrote:
>
> > > > By the way, what prevents someone from guessing a persistent link
> > > > identifier and using it without authenticating on it right now? I don't
> > > > see the code that prevents this, but I should take a closer look. I'll
> > > > play with this stuff this afternoon. I'll probably wait until after
> > > > 3.0.13/4.0RC2 before I commit it though to avoid last-second breakage.
> > >
> > > hmm, in PHP 4 the link would be a resource and only c-modules can create
> > > resources. in PHP 3 this could be a problem, and thinking a bit longer
> > > .... i believe every script could guess a link-number - that's not good.
> >
> > Yeah, I was only looking at PHP 3 code where the thing is just an
> > integer. I'd like to verify/fix this before 3.0.13 and will get right on
> > it after lunch here.
>
> rasmus,
>
> that sounds non-trivial to me! in php4 we just need to make sure that only
> c-modules can create resources.
>
> the only thing that comes to mind is to offset link-id's by an offset
> that's randomly generated in the RINIT() function of the module (or
> global). that way link-id's would be "harder" to guess...
Hrm.. I was thinking more along the lines of either setting a flag
somewhere linked to the connection, or to somehow copy the connection from
the plist to the normal list on a connect and not let any of the other
functions access the plist directly.
> the whole thing is only an issue for ISP with evil customers, isn't
> it? (one customer tries to steal data from another customers table in the
> same database-instance)
Correct.
> i think we need to rethink the whole plist/pconnect stuff anyhow - the
> do_logon() functions are really, really hard to understand - and a lot of
> their complexity is repeated in every module that supports pconnects. (and
> now we have the same "bug" in all db-modules;-( a rewrite in that area
> would also be needed if we want to share connections between threads in
> ZTS mode. so: let's try to "close the hole" for PHP 3 and come up with
> something better form PHP 4 *after* B3.
I agree that the code is a little hairy.
-Rasmus