Over 78% of All PHP Installs Are Insecure 112
An anonymous reader writes: Anthony Ferrara, a developer advocate at Google, has published a blog post with some statistics showing the sorry state of affairs for website security involving PHP. After defining a list of secure and supported versions of PHP, he used data from W3Techs to find a rough comparison between the number of secure installs and the number of insecure or outdated installs. After doing some analysis, Ferrara sets the upper bound on secure installs at 21.71%. He adds, "These numbers are optimistic. That's because we're counting all version numbers that are maintained by a distribution as secure, even though not all installs of that version number are going to be from a distribution. Just because 5.3.3 is maintained by CentOS and Debian doesn't mean that every install of 5.3.3 is maintained. There will be a small percentage of installs that are from-source. Therefore, the real 'secure' number is going to be less than quoted." Ferrara was inspired to dig into the real world stats after another recent discussion of responsible developer practices.
"Over 78% of All PHP Installs Are Insecure" (Score:5, Funny)
What is insecure? (Score:2)
Basically the article assumes that everything the PHP team puts out is "insecure" and that Linux distributors have some magic pixie dust that makes it "secure".
Both assumptions are wrong:
- First, the latest version of PHP will fix all known security vulnerabilities and will be as secure as those patched by Linux distributors.
- Second, just because a distribution "supports" a PHP version does not make it any more secure.
Pure clickbait.
I don't believe this. (Score:5, Funny)
Re: (Score:3)
Re: (Score:3)
Re: (Score:2)
Remember that 100% is over 78%.
Re: (Score:3)
22percent of PHP installs are secure???
Typical slashdot user not reading the summary. It's way less than 22%.
Re: (Score:3)
This is a real surprise. I guess they did not count insecure applications....
Re:I don't believe this. (Score:4, Informative)
22percent of PHP installs are secure???
The PHP install is secure.
That does not include the code being executed by PHP... just PHP itself.
Or, as a php dev would say (Score:3)
Re: (Score:1)
A php dev would probably say 32%.
Re: (Score:1)
ircmaxell (Score:5, Insightful)
If you're reading this ircmaxell, thanks for the help. The PHP Project is better for it.
Re:ircmaxell (Score:5, Interesting)
Re: (Score:3)
This is why it is a good idea to find a solid, trusted, up to date 3rd party repository that is well managed for your OS build.
For you Debian guys and galz out there, check out DotDeb: https://www.dotdeb.org/categor... [dotdeb.org]
Re: (Score:2)
Or use a distribution which provides updated and supported versions of the tools you need. Red Hat for example provides a base version of PHP if you want something which is stable throughout the entire life cycle of the operating system, but they also provide software collections with a shorter 18 month life cycle if you want a newer version of say PHP.
Re: (Score:2)
Hackers tend to focus on the most common tools because a discovered flaw can be used on more instances. If Python or Your Favorite Language were more common, it would probably be a bigger relative target. There is some truth to Security Through Obscurity.
Thus, write your CMS in Brainfuck :-)
so the solution is.... (Score:4, Informative)
to assume every web server is hacked already.
Seriously, if you assume this, and code your way in a more secure, 3-tier manner, with a separate, and secured, application server, then you will mitigate all the problems with an insecure web server - well, at least they won't have full unfettered access to your database.
This may mean giving up those "all in one" frameworks people so love (whether its PHP or .NET or any other language), but that can only be a good thing - write an app server with a secure API isn't so hard to do, but will mean your CEO won't have to appear on the news explaining why every user of his site needs to change their password and replace their credit cards.
Re: (Score:2)
Apparently gbjbaanb has never heard of a man in the middle attack.
Re: (Score:2)
I don't think that means what you think it does...
Re: (Score:2)
If it doesn't mean what I think it means you must not understand where the web server sits in web application architecture.
Security at the small scale (Score:3)
Seriously, if you assume this, and code your way in a more secure, 3-tier manner, with a separate, and secured, application server, then you will mitigate all the problems with an insecure web server
For PHP web applications that aren't yet quite popular enough to need even a single dedicated server, is there a way to see some of the benefits of "a separate, and secured, application server" without tripling the budget?
Re: (Score:2)
Depends - if you're running on a shared webhost for $5 then you'll have more issues than cost to deal with - reliability and performance for instance.
But you don't need full-on dedicated servers where the DB is completely disconnected from the web server, if you are just trying to mitigate the issue of an insecure front-end, then simply running the rest of the system secured from each other with different user accounts and a application layer running as a service (written n something else) will provide you
Re: (Score:2)
Re: (Score:2)
the power and bandwidth requirements are both miniscule as well as incidental (need the electricity and internet at the house anyway).
Unless your ISP doesn't let you run a web server at home. Some ISPs threaten to disconnect residential customers that receive a large amount of inbound traffic. Other ISPs, especially those using a microwave last mile (such as cellular or satellite) and those in areas hit hardest by the IPv4 address shortage, put their users behind a carrier-grade NAT and don't forward ports to subscribers. And even if they did forward non-well-known ports, alternate ports confuse end users because HTTPS and HTTP user agent
Re: (Score:2)
Re: (Score:2)
The web server is on my Centarra Instance out in the cloud, and it's making the direct calls to the home network that run the apps
That's the problem. If you're behind NAT, your web server instance can't connect to your application and database servers on your home network.
Re: (Score:2)
PHP (Score:5, Insightful)
And why?
Because upgrading PHP breaks shit. It's the old story of backwards compatibility versus security and, inevitably, when you've commissioned a website in a language that you can't program in yourself, you will choose backwards compatibility every time.
Most people do not host their own web services. As such they are at the mercy of their host and what their host needs to run for everyone to be happy.
Every web host I've ever used, personally or professionally, will give you a version of PHP and rarely update it. When they do, they will invariably warn you that your scripts (i.e. website) are probably about to break. Most people in that position do not have the skills and knowledge (or even the tools or hosting capability!) to log in and fix the problem. So it's "we're going to break your website... you have to pay money to fix it".
Hence, there is a pushback every time they do it, and that makes them even more reluctant to suggest to their users that they need to do it again next month.
This is partly a user problem, yes, but it's mainly in the court of the PHP developers. Why does going from PHP 5.3 to 5.5 break SO MUCH without reason? Almost every bulletin board, forum, image gallery or what-have-you you find that runs PHP tells you version it will work on, and has had to issue at least one update that fixes shit that breaks on the newer versions of PHP.
I'm not sure there's another language out there that's quite so undefined and variable when it comes to how things should work and what could change/break in new versions.
Sure, I get that we have to keep everything up-to-date when we're running net-facing servers, but the problems of PHP compatibility and that most web-hosts are scared to upgrade has caused more problems than those old scripts still running. For the most part, they are even worked around so they are still compatible with old PHP's rather than, as should happen, upping the minimum required PHP version and making people get secure throughout.
I think we can safely lay the majority of this problem on the removal of register_globals (something that should never have existed in the first place), magic quotes and safe mode. The last two of which were touted as the lazy-man's security functions so you didn't have to worry about all the fine detail. The rest of the changes in those versions are pretty minor and to-be-expected of a new version of software.
If PHP hadn't done a "PHP isn't safe", "Here, use this hodgepodge of half-assed security feature", "Shit, they're more dangerous than what we were avoiding, remove them!", then maybe they wouldn't be in this mess.
Re: (Score:2)
Seems like you put a lot of thought into this but you're frankly wrong. Wordpress didn't exist until years after "register globals" got deprecated. I agree it should never existed in the first place, but Wordpress is insecure entirely without any help from "register globals."
Re:PHP (Score:5, Informative)
Re: (Score:2)
Ummm... No. WordPress was first written in PHP3. Before it was even called "register globals". Back when that was just how you did things.
Wordpress 0.7 was first released in 2003. Register globals was first disabled in PHP 4.2 in 2002. So, yes, register globals was deprecated (though it did not throw a warning until later) before Wordpress was released. As PHP 4.0 was released in 2000, a full 3 years before Wordpress, I even question the PHP3 claim (well, I question their reasoning for developing a new product on PHP 3).
As a PHP developer at the time, I also dispute the claim that register globals was "just how you did things", in 2003.
Re: (Score:2)
As a PHP developer at the time, I also dispute the claim that register globals was "just how you did things", in 2003.
Nah, thinking back some more... At least one job did still use PHP 3 in 2002... So, ya, I'll retract this statement. Many people did still use it, and 4.2.0...
Re: (Score:3, Informative)
Wordpress is widely adopted. Very widely. The #1 reason it is insecure is because it is targeted so often.
Is that PHP's fault?
Along with WP, plenty of other platforms plainly store their database credentials in some config file. It might be PHP, maybe XML, maybe JSON ... irrelevant. The credentials are stored in plaintext on the server.
Is that PHP's fault?
All these platforms do things in their own way. I'm a Magento developer and it is a platform that is notorious for it's complexity. I understand it pr
Re:PHP (Score:4, Insightful)
No, the #1 reason it is insecure is that it isn't secure. The #1 reason it looks insecure is because it is targeted so often.
There's nothing wrong with doing that. The database shouldn't be accessible from arbitrary machines anyway, so having the credentials buys an attacker nothing. Besides, how the heck else are you going to provide credentials to a script? No, the real problems are that:
All of these fall under the category of sysadmin configuration mistakes, not flaws in the software, per se, though in some cases, the software may create files with poor permissions (or in an insecure way, allowing for race condition attacks) that exacerbate those problems.
To some degree, that points to the need for both better logging systems and better back-end software design. When I'm writing code, I'm very careful to explicitly have separate debug levels, with explicit comments about the security or insecurity of each of those levels. Those security-risky debug levels are turned on only for short periods of time while fixing authentication-related bugs, and any secret info goes into a separate log file in a location outside the web root so that you can't trivially access it by making requests to the server itself—and never to a syslog daemon (whose log files are potentially readable by other users on shared hosting systems).
I also segregate user credentials into separate objects/variables. With the exception of the numeric user ID itself, none of that info is ever used outside of my authentication and authorization code, which is segregated into separate files to avoid accidental disclosure. Thus, none of the authentication information ever appears in any object that could realistically get logged. The obvious exceptions are objects associated with the database, which ostensibly contain database auth information, but I'm never going to print_r a database connection object (assuming that's even possible), so that's mostly moot.
Actually, it is probably much lower, for several reasons:
Re: PHP (Score:2, Interesting)
I've programmed heavily in both PHP and .NET and I can say the PHP upgrades are not the cause of security issues. PHP's weakness is a combination of being interpreted at runtime and not enough access to the kernel. Things break heavily between .NET versions yet those developers do not jump ship over it. As PHP moved towards being more object oriented the implementation of it changed. Code which ran in a safe manner previously all of a sudden is a security problem. In .NET things are structured so that in th
Re: (Score:2, Interesting)
This.
Old php3 / php4 dev here. Moved to python when got the chance.
I think that one of the main reasons for not updating PHP on production arises from its interpreted nature, and some other come from the language itself. First, there is no mechanism to know if an application will work with a new version of the interpreter before running into production. You may say your test coverage is nearly complete, but: a) that leaves some code untested, and b) most of the php apps I've found have zero tests. Then, you
Re: PHP (Score:1)
First, there is no mechanism to know if an application will work with a new version of the interpreter before running into production. You may say your test coverage is nearly complete, but: a) that leaves some code untested, and b) most of the php apps I've found have zero tests.
Why would someone with zero tests day they have nearly complete test coverage? And why would anyone just throw up their hands, say "testing is impossible," and just implement straight to production? You sound like a PHP developer
Re:PHP (Score:5, Insightful)
There is a lot of angst here, but the reality is that putting a CMS online is not the end of the task, it's the beginning. If you want to have a public-facing web site, that means keeping it up to date so that providers have no qualms about upgrading. In many cases, the issue isn't the client, per se, but the requirements of the client site that slow down upgrading. As an example, Zend still hasn't managed to add PHP 5.5 support to their Guard product, so anybody who has clients using Zend in their sites will be stuck on 5.4.x till, well, whenever Zend gets a move on.
In any case, running a provider is a matter of pushing clients to keep up with server changes in a timely yet forgiving fashion. There's no reason that upgrading from PHP 5.4.35 to 5.4.36 should break ANYthing, so there's no excuse for a provider to not keep up with patch releases. Moving from 5.4 to 5.5, for example, will introduce potential incompatibilities, so providers need to give 30-60 days advanced notice to ensure client sites can be checked and upgraded as required. As long as plugins and CMS releases have been updated as they come along, the reality is that most upgrades are pretty painless. It's the big-jump scenario, 5.2-5.5 kind of upgrade that will be a nightmare. Those should never happen.
A good provider will retain legacy servers for those who still toddle along with FrontPage extensions and the like, but only till such time as the base services, e.g., Apache 2.2.x and PHP 5.4.x reach end of life. At that point, a provider needs to come to the realization that putting an entire server at risk at the behest of a few clients who are slow with the updates is bad business. PHP might have its downside, but keeping in tight lockstep with upgrades keeps things (usually/hopefully/OMG-I-pray) one step ahead of the kiddies and blackhats.
Re: (Score:2)
Why aren't there "long-term support versions" similar to what Ubuntu offers? Only security flaws are patched in such versions. However, I realize patching security flaws can break existing software also, but if you only patch security flaws rather than add and change features for the line, the magnitude of problems from updates would be smaller.
Re: (Score:3)
Why aren't there "long-term support versions" similar to what Ubuntu offers? Only security flaws are patched in such versions.
Ubuntu only supports a handful of packages, specifically those in the main and restricted sections of the package archive. This includes the main php5 package but a large number of modules are kept in universe and are not supported at all.
However, I realize patching security flaws can break existing software also, but if you only patch security flaws rather than add and change features for the line, the magnitude of problems from updates would be smaller.
It depends on the vulnerability. I had things break when the bash vulnerability was patched some time ago. There is no solution other than test that things work before you apply the update.
Re: (Score:1)
I meant Ubuntu LTS distro's directly (as an example), not Php in their distros.
And while I agree that security patches will probably always break some stuff, it's still the lessor evil compared to full upgrades (features & security).
Re: PHP (Score:2)
Like upgrading from Python v2 to v3?
Re: (Score:1)
No. It was announced loud and clear that going from Python 2.x to 3.x would require changes.
I never had a problem with Python 2.x -> Python 2.x or Python 3.x -> Python 3.x
you PHP shills just don't get how bad PHP sucks balls.
Re: (Score:2)
Every web host I've ever used, personally or professionally, will give you a version of PHP and rarely update it.
And every web host I've ever used long enough to notice has updated PHP and then you have to go into cPanel to change the version you're using. Perhaps your hosting companies were doing the same, and you simply failed to notice.
I didn't do it. (Score:1)
PHP coder since before 4.x. All the bad stuff started happening when people started using redistributed PHP frameworks.
Re: (Score:2)
Do you imply that redistributed PHP frameworks are the problem. In 2015, do you have some alternative suggestions?
I feel like you're saying it would be a great thing if everyone went back to CFML, because you know, hey, it's great having to pay for all your software tools. Of course freely distributed software is going to cause "bad stuff" to happen. I'm pretty sure licensed software isn't immune, either, it's just a different flavor of "bad stuff".
You make a great point, don't get me wrong, it's just tha
Re: (Score:2)
You realise there are loads of us who spend our time in "work week land" happily getting on with shit using .Net, ASP.Net MVC and other .Net frameworks (I currently heavily use NancyFX) and earn money while having a great time doing it? And up until 2008 I was a full time PHP developer, but you won't ever see me going back to PHP now, its just not worth putting myself through that pain and suffering.
So, dismissing ASP.Net out of hand, seemingly simply because you dont like it, limits your options for no go
Well... (Score:1)
I guess the Perl-loving neckbeards at
Why the distros? (Score:2)
If someone can explain, I don't understand why he is mapping to Linux distros. The W3Techs.com site just give the distribution of various versions of PHP and the percentage of these. I just did a spreadsheet using only the numbers from W3Techs.com and I am getting something like: 27.1% secure and 72.9% unsecure. Not that is a big difference, however it evades me why he is mapping everything to a Linux distro given many distros are missing in his analysis. Any hints?
Re:Why the distros? (Score:5, Informative)
So, to get around that, I looked at the popular distro's versions that they maintain. Then I counted *all* of those point versions as secure (over counting). So 5.3.3 is insecure as distributed by php.net, but as installed by Debian 6 it is secure.
So therefore to get an upper bound (rather than lower bound) on secure versions, you need some way of factoring in for distro support.
So I picked the most popular distros for server usage. Is this hand-waving? Absolutely. But it should give a pretty reasonable upper-bound.
Re: (Score:2)
Re: (Score:2)
Are you aware of any analysis as to the extent that is actually true, ie for distro X or Y which patches really have been backported and which are skipped?
I had a quick poke about the W3Tech site and couldn't really see much of their methodology, especially in terms of how they identify PHP usage and what version is being used. I'd have though that if you looked at their PHP page [w3techs.com] there should be a not insignificant number wh
Re: (Score:2)
Yes. For most CVEs, the major distributions do backport fixes. They don't however backport all security fixes.
For example, there was a bug in crypt's bcrypt implementation which would cause collisions for certain classes of passwords (specifically those with characters with high bits set). The fix in 5.3.6 was to add a check into the normal $2a$ imp
Re: (Score:1)
Makes sense (Score:1)
Student Suspended Over Suspected Use of PHP [bbspot.com]
Re: (Score:2)
It was a joke link... The aspergers is strong in this one.
re (Score:2)
not surprising at all
over at LinuxQuestions we had a rash of
H E L P ! ! ! ,or 13,or14 ( fedora 21 is current)
I just installed RHEL6.0 ( unlicensed !!!)
i just installed Fedora 12
and !! NO KIDDING !!!
i just installed RH7.2 ( the rh7.2 from 1996 )
and
i just installed RH9 ( from 2001 )
and a few
"i just installed RHEL4.0 " ( RHEL 7.0 is current)
and this was only in the redhat family
Re: (Score:3)
Time traveler problems.
Re: (Score:2)
I'd wager a lot of it is school assignments. School courses are rarely kept up to date with the current distros. I can't blame them for not keeping up with the latest Fedoras, but at least they should be running a supported enterprise release (i.e. RHEL6, but encourage them to use CentOS).
I see a lot of the "I am trying to install Fedora 10 but it won't work". Of course it's normally because the package repositories have been archived and the default install can't find them. When asked why they are usin
Re: (Score:2)
I just installed OpenSUSE 13.2 on a VM with 2GB RAM assigned, installed using the network image. EVERYTHING worked. I mean EVERYTHING. All my devices, mapped shares, the lot.
The fuck did I do wrong?? Usually when I install $NT, I have to spend the next six hours dicking around with system updates, device drivers and application licence keys.
Why am I not surprised? (Score:1)
Bogosity (Score:2)
What he's saying is that the only "secure" version of something is x.x, x.y, z.x. Anything else is "insecure."
Well fuck, what about all those XP installations? Default apache configs? Systems using heartbleed SSL? What about if they're hosted on platforms that aren't current? What about embedded platforms?
Basically, 99% of the internet is insecure.
I mean, come on: 82.27% of perl installs are secure? 77.59% of python installs? Get real.
Re: (Score:2)
No. 82.27% of all PERL installs have no known vulnerabilities in PERL itself.
This isn't to say the code on top is secure. And it isn't saying that it's exploitable. Just whether known vulnerabilities in the platform itself exist.
Re: (Score:2)
What's relevant is whether or not
a) your code uses the insecure portions of the language
b) the security vulnerabilities are remotely exploitable
c) you have not used a workaround
A lot of vulnerabilities within PHP are "if you have a PHP install on the same host that shares a common PHP instance" or "if you do these things in this particular way". I don't think there are a lot of vulnerabilities of the sense that it will drop down to a terminal if you send a special packet to the website.
Re:Bogosity (Score:4, Interesting)
However, I would like to make a point. How many of these installs made a conscious decision by investigating the security fixes and balancing that against their codebase to see if it's exploitable or not? I'd wager that the number is so small as to not even register.
Besides, I think a variant of Schneier's law applies:
The same thing applies to vulnerabilities: If you can't think of a way to exploit it, that doesn't mean it isn't exploitable.
So yes, it is an over-statement. But it's also showing quite clearly how updates are being dealt with. And that was the precise point of the original post. If it gets people to think about upgrading more, then awesome. If not, nothing lost.
All PHP installs? (Score:1)
I just deployed a secure PHP install for my new blog. Please adjust the numbers to reflect this since those numbers are allegedly for all installs.
And who cares? (Score:2)
And who cares?
I don't have anything that requires security or matters in PHP. I never would, it's just kind of a crappy scripting language to me.
I've PHP that does "Stuff" but none of it is handling private data or writing to databases. At best it's manipulating the data after it's arrived locally and displaying it. Or manipulating it in a form or something before delivering it. I supose it could alter the users intent on send, but I don't care. I'd treat them as untrusted anyways, they're just as likely to
Re: (Score:2)
There are plenty of PHP websites out there taking card payments etc, so yes, this is a real problem.
Re: (Score:2)
my document repository on my netbook runs through a wiki written in php.
Why? Because I can. And it looks cool.
Ubuntu is all I know (Score:3)
Our company runs our own servers; we run Ubuntu Linux. Our web sites are PHP. All I know is to run apt-get every Sunday and Ubuntu can update whatever it wants to. These are in-company web sites with login user names and passwords. No e-commerce involved; no public involved.
Am I a security export? Hell no. I've been programming for 45 years. My first language was FORTRAN; my first "personal computer" was a 360/20.. If it takes a security expert to code a program today than our industry is fundamentally flawed.
Re: (Score:2)
Our company runs our own servers; we run Ubuntu Linux. Our web sites are PHP. All I know is to run apt-get every Sunday and Ubuntu can update whatever it wants to. These are in-company web sites with login user names and passwords. No e-commerce involved; no public involved.
In case you ever run a public Ubuntu-based server make sure that you never install packages from the universe or multiverse components of the package archive. They are not updated by the Ubuntu security team and can therefore include unpatched vulnerabilities, which include a large number of php5 packages.
Re: (Score:2)
Re: (Score:2)
Thanks. Will do. But ,,,
I can use dpkg-query to see the names of the packages which are installed on our server. But how do I tell what component of the package archive that package comes from? What comes from "universe"; what comes from "mulltiverse"? The only thing I know of that tells me that is the Synaptic Package Manager, and of course we have no GUI on our servers.
Thanks.
5.3.10? (Score:3)
Why is it that 5.3.10 is listed as the last secure PHP 5.3 when there's many more releases after it?
Re: (Score:3)
5.3.10 is listed as secure by the post because that version is supported by Ubuntu 12.04...
web hosts are the perpetrators (Score:1)
Waht about servers with hidden version numbers? (Score:1)
Responsible developers? (Score:3)
I have never heard of a developer held responsible for failures. EEs, CivEs, ChemsEs, etc have to carry malpractice insurance to work.Until they can be sued and held responsible they will not be responsible.
That is why Software Engineering, IMO, does not exist. At best developers are skilled workers but not engineers.
Re: (Score:2)
Bah, an engineer is someone that runs a locomotive.
Re: (Score:2)
Rail engineers have been sued too.
Make patching easier! (Score:1)
WordPress / Drupal extra? (Score:1)