PHP 5.2.3 released...Friday, June 1. 2007Friday, June 1. 2007 PHP 5.2.3 was released with several security fixes.
Comments
Display comments as
(Linear | Threaded)
Why they always release fixes before the upcoming weekend? I believe it's an automated script that packages the sources with only a minimum of fixes because there are so many weeks left :X...
In my opinion _known_ bugs/security issues need to be fixed as other people can exploit those very easily now. It's kind of unsophisticated somehow However, have a nice day :), avarus. posted on Friday, June 1. 2007
#4
andreas
()
I know why they are rolling updates only on fridays... the get paid by Heise so that Heise has a topic for their friday-flame-wars in the forums... (s. http://www.heise.de/security/news/foren/go.shtml?list=1&forum_id=118168)
posted on Friday, June 1. 2007
PHP Releases have historically been packaged and tagged on Wednesday, and released on Thursday. This release is no different.
As far as the session_id() issue you did report it and even participated in the discussion regarding the problem with both Stas and I. As I am sure you know the patch to address the remote exploit of the problem via PATH_INFO was applied on May 15th. If you knew the problem was still there, it would've taken just a 2-3 line e-mail to security@php.net to identify that. For whatever reason you did not, so while the security team is at fault at not looking at the issue deeper, you must admit there was plenty of time to identify the error prior to the release. posted on Friday, June 1. 2007
What part of:
"Due to the failure of not encoding the session id when sending it trough a cookie it is possible to inject ';'" or "However, even if the cookie is not sent at all... It is a bad idea to put in session id and session name into the cookie without URL encoding." are so hard to understand? Both parts were written in the email conversation. I think this made it pretty clear that I do not consider it fixed until it is encoded. Before I quit the security team there was an arrogant statement by some of the members that there are plenty of security aware people on the security team. If that is true then it would be their job to fix it. It is not my job as external to do your work and the vulnerability is not even mentioned in the release notes. Additionally several guys of the Security Team believe they are competent enough to give PHP security talks. In these talks you claim that you should not trust user input and escape it before outputting it. You even cover header() Injection. So why in hell do I have to tell you that the session id is user input and needs to be encoded. posted on Friday, June 1. 2007
The goal of the fix was to address a remotely trigger-able issue, which your example sent to security list did not demonstrate.
I can understand now that your focus was an unpredictable behavior of session_id() with non-verified external input, unfortunately you never stated that was the case. Its not an excuse for the intended bug was being missed, my and Stas' bad since we were the ones looking at the issue. My question to you is why couldn't the information you've now posted in PMOPB-46 be provided to your e-mail to security? Since you spent the time and effort to clearly demonstrate the problem now, was it that difficult to do in the original e-mail? posted on Friday, June 1. 2007
Ilia,
nothing is unpredictable. The whole purpose of the session_id() function is to set a user supplied session id. This function is meant to take user input. You even have session_id() examples on your own security slides. You on the other hand were not reading my report, you were trying to outsmart me, because my inital example did not work, and get around the "encode it" suggestion and stop the cookie from being sent. Maybe one of the security team members was saying: Uhh no we cannot encode it. It will hit the performance. Yes I took the time and wrote the stuff to protect those using PHP. Those using PHP are also not the ones that write blog entries or mailinglist mails where they attack me for not helping, etc... But hey... Don't fear... When I finished my paper I have another round of vulnerabilities for PHP.net. PS: of course the session_id() issue is still remotely triggerable in applications using it to specify a session id. Because that is the purpose of the session_id() function. posted on Friday, June 1. 2007
I'm sorry but setting session ID manually in the script is not a vulnerability. There *WAS* the vulnerability that allowed to get externally supplied data injected in the cookie through PATH_INFO, and it was fixed. Setting session ID by the user is not a vulnerability in any way - even if we had made it impossible for some reason - which reason is still unclear - the user is perfectly capable to use header() command to produce any cookie he likes with any parameters attached, he doesn't have to resort to session_id tricks to do it.
The whole idea of "local vulnerabilities" is flawed from the start, but this time it is taken so far that it should be obvious for everybody there's no any "vulnerability" and not even close. On the other hand, if anybody knows real way to make PHP 5.2.3 to output *EXTERNALLY* supplied session ID without filtering - as opposed to internally supplied by the local user - please report it. I however find it interesting that no exploit was provided, even though it is trivial. If it is really trivial, why not provide a simple exploit against 5.2.3 so we could see how trivial it is? However, the only two examples we have seen so far are 1) one that doesn't work in 5.2.3 and 2) one that requires the user explicitly set the session ID. posted on Friday, June 1. 2007
Stanislav someone should really take your keyboard away.
Your statements gets more ridiculous by every day. You have obviously no fucking clue what you are talking about. And your involvement in the PHP security team throws a very bad reputation on the PHP project. session_id() is a function of PHP that is used by applications to supply their OWN session id to PHP. Where do you believe this session ID is coming from you dumbhead. It is coming from user input. posted on Friday, June 1. 2007
Stefan, I'm not going to answer all your insults and bile, I will answer the only substantial point you managed to squeeze among them. I hope some day you grow up enough to be able to maintain discussion without cursing and spitting.
"Where do you believe this session ID is coming from. It is coming from user input." Why on earth anybody would take user input and put it into the session ID? Is it "welcome session hijackers" application or what? Do you have an example of read-world application that takes session_id from user as a parameter and runs session_id() on it and has any imaginable reason to do it? posted on Friday, June 1. 2007
Stanislav,
you do understand that something like this index.php?PHPSESSID=xyz is putting user input in a session id? If you fail to understand that the session id is ALWAYS user input there is not much to discuss... Oh btw... A google code search for "lang:php session_id\(\$" will show you that it looks like the latest phpMyAdmin version does exactly this... posted on Friday, June 1. 2007
OK, phpmyadmin indeed does it, but I don't see how it can be exploited for anything - bad ID would be rejected as far as I can see.
posted on Friday, June 1. 2007
Great now you admit that software exists that does use the session_id() function in exactly the way I described. In case of phpMyAdmin it might not be exploitable but phpMyAdmin is not the only software in the world.
Case closed. posted on Friday, June 1. 2007
Yes, I didn't think people would do such code but I was wrong.
However encoding cookie won't help much with such code - if you don't use standard session module (which filters IDs) and you allow session IDs unfiltered you are in for a lot of surprises, regardless of URL encoding. For example, if you used user session code from comments here: http://www.php.net/manual/en/function.session-set-save-handler.php and use code like in phpmyadmin to manage sessions, you could have session ID like ../../etc/passwd passed to you and happily read and maybe also write random files as session (and this has nothing to do with header encoding). If you use unfiltered user input, it's going to lead to trouble and URL encoding is not going to be much help. I would rather drop any session ID that's not conforming to very strict character set altogether and not try to make it work at all. However such broken chunk of code can hardly be called "PHP vulnerability". We may try and make such code safe, but I'm not sure it's even possible - if one tries to circumvent session modules and does it in broken way it's quite hard to protect against it. posted on Friday, June 1. 2007
Sure, please tell me how you can exploit this and we'll fix it.
posted on Friday, June 1. 2007
There are 2 types of users, people who write php scripts and external users who access those scripts.
The session_id() function was provided to give the script developer the ability assign a specific session id to a user, it was never intended to let the application's user pick their own sessions. Many application authors incorrectly take data from GPC and pass it to this function, which can have sorts of bad consequences, which in some cases are exasperated by bugs in different PHP versions (header injection in old versions, something you've reported iirc). This is not much different then blaming PHP for echo $_GET['foo']; causing XSS/CSRF. As with content output, script developers should be careful when passing data to a function that's just a fancy wrapper around header(). It is a bug that the function could allow header parameters to be injected, sure. The security issue is caused by lack of validation not only in PHP (the language), but the user code as well. posted on Friday, June 1. 2007
Ilia,
do you want to make me laugh? The next argument is that the htmlentities() function was originally not designed for user input and therefore the bufferoverflow in htmlentities() does not count. People should filter the user input before giving it to htmlentities(). Guys you should better just shut up and never ever give any comment about security issues anymore. The session_id() function was designed to allow scripts to supply their own session ID in case ext/session cannot extract it from GPC vars. For example when the session id is supplied through a XML POST or by some other means. Your redefinition of the purpose of the session_id() function is just ridicolous. But that is typical for PHP developers. Blame the programmer, because PHP is bugfree. It is up to the session module f.e. a userspace handler and the script to decide what characters are legal for session ids. A PHP developer cannot know that by putting a ; into the session id PHP ext/session will completely break. Only ext/session is at fault here. If I have code like session_id($_GET['id']); then this is the same situation as if I only have session_name('id'); So how can it be MY FAULT that case 1 breaks PHP and case 2 is properly handled? Beside the fact that ext/session should be avoided anyway because it makes PHP applications vulnerable to DOS. posted on Friday, June 1. 2007
Now you are just comparing apples an oranges. As a high-level scripting language, as a rule PHP should not crash. There is only one exception to that rule relating to recursive functions and stack size.
So, an overflow in a function is definitely a bug, and if the function is frequently used in conjunction with user input it is a security issue as well. You said it yourself "The session_id() function was designed to allow scripts to supply their own session ID in case ext/session cannot extract it from GPC vars.", a statement with which I agree with. However, you are suggesting that the developer can pass ANYTHING to the function and it'll be ok, because PHP will do its magic and clean things up for you. posted on Saturday, June 2. 2007
Look at it from this angle....
The PHP programmer knows that ext/session handles any chars in the GPC variable PHPSESSID correctly. (Or atleast they think that is the case) Now session_id() is a function to help ext/session to find the session id in case it cannot find it automatically. How should a PHP programmer magically know that suddenly it his responsibility to filter characters. And well there are systems were ; is a perfectly legal character in a session id. I see it nowhere documented that this is not the case for PHP. I don't understand all this discussion: ext/session puts user input into something like the header() call. Therefore it is ext/session's job to encode it. posted on Saturday, June 2. 2007
Hi Stefan!
I've got one question! You've got karma on everything and you could simply commit all security fixes by yourself. It would be better than mailing two times to security@php.net. Okay, you don't get any attention but it would be better for PHP. So, please answer my question: Why don't you simply commit those fixes into CVS? -Thorsten posted on Saturday, June 2. 2007
First of all if I would commit all necessary security fixes without discussion I would loose my commit rights very soon because the PHP developers don't understand that security is always more important than performance.
The majority of PHP servers are not highspeed sites. They give a shit if a single syscall per request is removed. However Rasmus and Co have forgotten that the majority of PHP users are not enterprise companies with millions of PI per day that might need such performance tweaks. And secondly I already told you several time that if I commit every fix then there will be NEVER EVER a change in the PHP development team/process. There is no learn effect if I do all the work (and the PHP developers have to learn alot about professional release management, vulnerability management). It is very naive to believe that just commiting fixes is good for PHP. It is actually the opposite. It is never a healthy situation when the responsibility for the whole security etc... of such a big project rests on a single shoulder. And I am demonstrating exactly this. And last but not least the behaviour of the PHP development team towards my person is indiscutable and therefore I don't see a reason why I should do their work for them. posted on Saturday, June 2. 2007
Hi Stefan,
> I would loose my commit rights very soon because the PHP > developers don't understand that security is always more important > than performance. it would be an own goal for the PHP project when they would take off your commit rights because of committing security patches. It's nonsense what you're writing. > It is very naive to believe that just commiting fixes is good for PHP. Is disclosing security holes one day after the release the better way? I don't think. It's a bad habbit for PHP users. > And last but not least the behaviour of the PHP development team > towards my person is indiscutable and therefore I don't see a > reason why I should do their work for them. It's as indiscutable as your habbit of offending people. You call them dumbasses and that they are stupid. What do you espect as reaction? It would be great if your social competence would be as good as your technical. -Thorsten posted on Saturday, June 2. 2007
I call stupid dumbasses "stupid dumbasses"...
So what. I am just honest. I have technical reason to call them dumb. They on the other hand just lie (spread FUD) because they dislike that I show how many vulnerabilities PHP has. And for the rest of your comments. Well you are not a PHP developer, you were never a PHP developer. So please don't assume that you know what the PHP developers do and not do. I was forbidden often enough by rasmus, andi, zeev and the rest of the "group" to fix stuff correctly. I am no longer arguing about such things. They can commit the broken, half assed patches themself. I don't support half assed fixes. And last but not least learn to read: The session vulnerability was disclosed 14 days before the release of PHP 5.2.3. I did not disclose it 1 day after the release but 2 weeks before. It is not my problem that the PHP developers do not commit the only fix that makes sense and that was recommended by me. All this mud throwing is as usual initated by the PHP developers, not by me. I just state facts and they attack me. Blog postings like the one by Antony are just based on lies with the single goal to discredit me. posted on Saturday, June 2. 2007
This dialogue is a textbook example of why you should stick to technical facts instead of making disparaging remarks about people: They don't work.
Stefan: If the PHP developers really were dumb-asses they wouldn't be able to learn and you'd be wasting your time. Some commits and remarks, on the other hand, sure are dumb-assed. When I saw that "int out_len > MAX_INT" comparison I was laughing my ass off, and in fact if I were a PHP developer I would lobby to remove commit right from whoever it was that checked in this nonsense. But don't mix up people and their actions. Don't resort to name-calling yourself. That doesn't tend to achieve any results. (Or at least not the results I assume you want.) I do wonder, however, why the PHP developers *still* don't get it that it's not the PHP application programmer's job to sanitize input to PHP functions. posted on Wednesday, June 6. 2007
Stefan, why not make patches available somewhere and point send the URL to internals@php.net seeing that security@php.net does not understand the nature of the problem? Using ducktape to fix a hole instead of the correct fix is pointless. It's time people stop ego surfing and sorting out the problems.
posted on Wednesday, June 6. 2007
Add Comment
|
Calendar
Archives Categories Syndicate This Blog |
|||||||||||||||||||||||||||||||||||||||||||||||||


