Postcards From My Life

Lint I find in my mind's belly-button.
  • EPK
  • Consulting
  • Resume
  • Nerd Herding
  • Talks
  • CWJ 09
« Attracting Talent
I wanna talk about me…verse 2 »

PHP and Security

Dear Reader,

I received an email today from a gentleman who is preparing to give a talk and needed to understand what is being done to make PHP more secure. He told me in his email that he understands that most of the problems these days were not problems with the language. He wanted to know, however, what the PHP community and core developers were doing to make it harder to write bad applications. Below is my response.

Hi XXX,

You are absolutely correct, the vast majority of the problems in PHP applications are due to the fact that the barrier to entry for programming PHP is very low. This means that anyone can quickly hammer together a form or website, with little or no training. The community as a whole is taking several steps.

Education

* Everywhere you turn, you will find tutorials on how to write PHP properly. This is not a Zend specific movement but we are involved. The mantra of “Filter Input, Escape Output” is being repeated everywhere. Additionally, we at Zend have been methodically reviewing all of our tutorials and sample code to make sure that any code we are presenting as sample code adheres to all “security best practices”. This is an ongoing effort, not a one-time effort as best practices change from time to time as new attack vectors are revealed.

* There are 3 major PHP centric conferences in the US every year, php|tek, php|works and ZendCon. Both php|works and ZendCon this year have talks specifically on how to write more secure code. Chris Shiflett, probably the most recognized authority on PHP security, is presenting his “Security 2.0″ at both conferences. Additionally, both conferences have other content on security and I can speak for ZendCon when I say that all sessions were vetted to make sure that the speakers and examples presented all support current best practices.

* In May of 2007, in response to Stefen Esser’s “Month of PHP Security Bugs” DevZone ran a daily “Month of Security Tips”. These are all still available and widely read according to my daily log analysis. Both of these efforts were designed to raise awareness of the problems that PHP developers face. In the case of “Month of PHP Bugs”, most of the bugs that Stefen announced were dealt with in the PHP 5.2.2 and PHP 4.4.7 releases on May 2nd.

Coding

* As new attack vectors are revealed that compromise a flaw in the Zend Engine, the Core PHP team moves quickly to resolve them. Many times the patch is forthcoming days after the vector is revealed however in some cases, it takes longer as a quick fix may solve one problem but introduce two more.

* As we’ve agreed though, the majority of attack vectors have little to do with the Zend Engine. The are of the nature of “Cross Site Scripting” (XSS) or “SQL Injection” attacks. In these cases, there is little the community can do beyond education.

You mentioned register_globals, that and safe_mode, allow_url_fopen are options in the PHP ini file that were early attempts to “make the language safer” and are now widely regarded as giving users a false sense of security. As the owner of two shared hosting services, I can tell you that by-in-large, most users do not understand the proper use of these options and simply think that if they are off, they are safe.

To avoid confusion like this in the future, the community is moving away from trying to make the language safe for new programmers and is concentrating on simply making the tools available to do the job right. This fits hand in hand with the education effort.

* Tools like ext/filter are now standard on PHP 5. This gives programmers an easy way to do things like filter out extraneous html and JavaScript from input, validate that an email address is of the proper format and other necessary tasks. This tool alone cannot make your site
secure but using it properly can greatly reduce your exposure to XSS and SQL injection attacks.

* Frameworks today help with a lot of this. Currently there are over 100 frameworks written in PHP, however, it boils down to 4-5 of them control about 80% of the market. symfony, CakePHP, Solar, CodeIgniter and of course, the Zend Framework. Selecting the proper framework and investing in the time it takes to climb the learning curve will help any developer become a better developer and write more secure applications. Because I work for Zend, I use the Zend Framework and am most familiar with it. In the Zend Framework, it is very easy to filter and validate all incoming input. Again, if you can prevent malicious users from injecting code into your application, you can prevent most attacks.

Until next time,
(l)(k)(bunny)

Related posts

  • No related posts.

This entry was posted on Thursday, August 23rd, 2007 at 7:20 pm and is filed under PHP, Programming. You can follow any responses to this entry through the RSS 2.0 feed.Both comments and pings are currently closed.

One Response to “PHP and Security”

  1. spike123 Says:
    September 14th, 2007 at 4:12 pm

    Hello,

    I know that this is not here.

    I would like to know if I can translate into Spanish the podcast of the phpabstrac and put them in my blog, in order to make it know more about this program language.

    Regards,

    Benjamin Gonzales
    benjamin.gonzales@gmail.com

  • Team Based PHP Training

  • Sponsors and Ads

  • Conferences I’m Attending

  • About Me

    cal_evansThis is my blog. Sometimes it's my deep thoughts, sometimes it's a journal of things I've learned. Every now and then it's my box of shattered dreams. Most of the time though, it's just the place I like to write. Sit with me as I show you some postcards from my life. While you are here, do me a favor and leave a comment.

    If you are looking for my contact information, bio, picture, ASL, check out my EPK.

    My name is Cal Evans and this is my blog.



    Follow me on FriendFeed!

    View Cal Evans's profile on LinkedIn

  • My First Book

  • Support PHPWomen


    US Shop | European Shop

  • What I'm Doing...

    • Going to CodeStock? Vote for my talk http://bit.ly/aZgFiN (Please?) 1 hr ago
    • ok, podcast edited. (Left in the Ums for the eventual drinking game) Now for lunch and then I've actually got real work to do. :) 3 hrs ago
    • RT @derickr: New blog post: "Available for PHP Extension Writing" — http://derickrethans.nl/available-for-php-extension-writing.html 3 hrs ago
    • More updates...

  • Tags

    API article Cal Evans codeworks conference cw09 developers devzone elizabeth naramore Entrepreneurship Exim flex fun IBuildings iPod Kathy Evans linkedin Mac Management Marketing microsoft MySQL Nashville phar PHP phparchitect php developers podcampnashville podcast podcasting poem Programming Quickies respect RSS Silly-Con Valley sixty second tech software development terry chay twitter upgrade video wordpress zend zend framework

  • RSS PHP Podcasts

    • Writing Composite Zend_Form Elements
    • Preparing Custom Elements for Zend Validators
    • webcast: Introduction to Doctrine 2
    • 8 Reasons Every PHP Developer Should Love JavaScript
    • oddWeek Episode #4
    • Creating Custom Zend_Form Decorators
    • Habits of Highly Scalable Web Applications
    • PHPSPCast #6 – Ao vivo da Campus Party (Q&A)
    • php|architect podcast: oddWeek #003
    • Podcast #2010-02: Stalker Edition

  • XBox Gamer Card

  • Me

    • Best web design company
    • Cal Evans Dot Com
    • Cyrano’s Apprentice
    • Evans Internet Construction Company
    • My Life as a Child
    • PHP Podcasts
    • Sixty Second Tech

  • RSS My Blog at php|arch

    • An error has occurred; the feed is probably down. Try again later.

  • Flickr Recent Photos

    Blue Parabola Southern Office-Rear Annex is closed for snowSnow Heart@dzuelke getting ready to give his talk@fabpot talking about Dependancy Injection@derickr giving the opening keynotePeople meeting other peoplePHP Benelux Goody Bag ContentsCheck InDSCN2280The main room

  • Categories

    • Apache
    • BlogBling
    • Blogging
    • codeworks
    • Entertainment
    • Entrepreneurship
    • Flex
    • Humor
    • JavaScript
    • Long Form
    • Management
    • Marketing
    • Me
    • PHP
    • podcasting
    • Programming
    • SQL
    • Technology
    • Web 2.0
    • wordpress
    • WordPress Plugins
    • writing
    • zend framework

  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org


Postcards From My Life is proudly powered by WordPress
Entries (RSS) and Comments (RSS).