PHP Security Consortium Launched
Chris Shiflett writes "We're happy to announce the official launch of the PHP Security Consortium (PHPSC). Our mission is 'to promote secure programming practices within the PHP community through education and exposition while maintaining high ethical standards.' You can read the official press release or visit us at phpsec.org."
It's good to see more promotion of secure coding practices, especially with Web languages like PHP.
Though so far there's not a lot of content on the site (one article on CAPTCHAs, a bunch of links). It'd be nice to see them covering the most common problems, such as Cross-site scripting attacks, SQL Injection attacks and so on, which are prevalent on PHP/ASP/other CGI sites. I'm sure PHP-using Slashdot readers can help out?
Screw you all! I'm off to the pub
Like, for example, PHP or Perl, are a good thing for startes, since they let them understand what coding is all about, and to experience the pleasure of programming. But they are also dangerous because they make it ease for the uninitiated to shoot their foot, in C, it's even easier to shoot yourself in the foot, but you won't go very far with no experience and limited knowledge, so, you will shoot your foot with a simple curses based agenda, and not with an online CMS, with PHP or even Perl, unexperienced people can create large projects, and in those cases, they can blow off the entire house and not just their foot.
It's good to see some initiative to prevent these.
Just my 2 cents.
ALMAFUERTE
WTF am I doing replying to an AC at 5 A.M on a Friday night?
I suppose that next time a story about a new Microsoft Windows exploit is posted, you will say "It's not good to see such little promotion of secure coding practeces, especially with popular Operating Systems like Microsoft Windows" ?
Somebody mod the parent redundant, please?
They must have offices next door to the MySQL Data Integrity Consortium and the Internet Explorer Web Standards Consortium.
Drop all insecure legacy features like "register globals".
Use exception handling from top to bottom. Don't allow an error or return value to go unchecked.
Run code in some kind of sandbox by default. Example: fork and chroot each PHP script. Safe mode isn't good enough.
HTML ESCAPE BY DEFAULT. Use a separate set of tags for un-escaped output. Isn't it ridiculous that you have to remember to HTML escape output??? All you have to do is forget one spot, and congratulations, your app is on bugtraq.
Then I'll start to take PHP seriously.
As long as PHP caters to the bottom 95% ("but if we change that, people will get confused"). I'll look elsewhere.
I realize that this is a huge generalization. Don't get me wrong; I don't reject a program outright if I find that it was created with PHP. PHP does, though, raise an eyebrow.
All things being equal, I do reject a PHP app quicker than a non-PHP app if it shows a similar number of questionable or just flat out poor security defaults or is designed with little attention to security. It's often harder to deal with and keep up to date as the original branch of the app is updated -- raising the frustration as time goes on.
A firewall can not protect you from yourself. Turn off what you do not need. Do not use the firewall to do your work.
it should be array('filter'=>'htmlentities'));
There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
(I also posted this on the CAPATCHA topic, but I think it's relevant here too).
.jpg file, so two people requesting the page at the same time will see the same image (the last generated one).
Too bad that that example on that site of 'an international group of PHP experts dedicated to promoting secure programming practices within the PHP community.' is flawed.
It always writes to the same
If these are the PHP experts on secure programming, I am now really worried.
--
If code was hard to write, it should be hard to read
The only article if you don't count the security guide.
.jpg file, so two people requesting the page at the same time will see the same image (the last generated one).
It always writes to the same
It doesn't always write the same one. Yes, two people could see the same one, but how is that a problem?
Jason Lotito
The code says:
and:
$image = $captcha->getCAPTCHAAsJPEG();
$handle = fopen('captcha.jpg', 'w');
fwrite($handle, $image);
fclose($handle);
So, assume this happens:
- Client A requests the site
- Client B requests the site
- PHP engine process request for A: generates a random string 'abcde' and creates the captcha.jpg for this 'abcde'
- PHP engine process request for B: generates a random string 'fghij' and creates the captcha.jpg for this 'fghij'
- Due to some network lag (200ms), A will now request 'captcha.jpg'
A will see 'fghij', but the session for A will have 'abcde' set. This means that A cannot validate himself.
The problem here is ofcourse that the file is always the same: if you would use a PHP file that generates the images for a request (based on the sessionid from a cookie), you would be safe.
--
If code was hard to write, it should be hard to read
Aaah .. stupid me. The first line of code should be:
/> ... i did have 'Plain old Text' enabled when posting, well, nevermind.
<img src="captcha.jpg"
--
If code was hard to write, it should be hard to read
I'm not comparing what these languages are designed to address as far as application, I'm talking about good programming habbits prevent nasty things that you can do in almost any language.
"Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
Your example shows filtering on output. Which part of "filtered on input" did you not understand? If you accept input, you need to filter input. Telling programmers to work harder if they are not filtering input is the right approach. If PHP had imitated the BRL define-input syntax it would be easier. Easy or not, it has to be done.
If the language makes it easy to filter input, and if you teach about filtering input in the same place you teach about accepting input, then security problems from newbies can be dramatically lessened.
Only if you use the same name every time, which the article does not say to do. So, you're trying to belittle the article based on your own screwup. Classic.
It is so refreshing to see these issue being dealt with head-on. The larger issue to me, however, is that PHP more than any other language these days is begging for coding standards and "best practices" -- of which security is an important part. As I mentioned in my blog, I am considering writing an article about this for the next issue of IPM.
Ok, so they didn't plan it too well...going by IP would have been a better idea. But it was secure, wasn't it?
Not really. At times in the past I've been behind a firewall that put over 100k people effectively on the same IP address (or a small pool of IP addrs). Thankfully that time is past now, but if you think that an IP addr identifies a unique machine, you're sorely wrong. The right answer is to go by session (identified by cookies, which web proxies usually handle right) and not commit any temporary files (like CAPTCHAs) to disk at all.
"Little does he know, but there is no 'I' in 'Idiot'!"