iSnare.com - Free Content Articles Directory
Authors Contents [Advanced Search][Add OpenSearch][Job Search]
Distribute your articles to thousands of article sites for only $2 and below! Read more...

Index  Internet
 

Security - Keeping It Off The Web

 
[ Contact the Author] [ Send to a Friend] [ Article Publisher] [Make PDF] [ Print] [ Bookmark & Share]
 
Read our Terms of Service before reprinting this article. The submitter specified above has claimed the rights to this article.
Jamie Hoglund

The topic of website security is seldom brought up among non-programmers andthose who may not be technically inclined, yet if you operate a website, it isan issue of substantial concern to you.

Addressed in this article is a nearly universal problem, it affects almostevery single PHP or CGI script I've ever seen. We won't delve into thetechnical issues too far, this is intended for the web site owner, someone whomight install the occasional PHP file or CGI script. I will assume you are nota software developer.

A general rule I like to follow when installing php scripts or web applicationsis this: If it doesn't need to be on the web, it shouldn't be there. This isobvious, but it has implications that are not always clear.

What we are mainly referring to is configuration and to a lesser extent,program libraries and source code. It may also apply to files and otherresources that are controlled through a script interface. An example of thiswould be scripts that charge money for downloading files or set up newsletters.

Lets start with an example, we'll call it program.php. In our example,program.php is a database application using mysql to store information.

For our script to do it's job, it will need access to your mysql password anduser-name. It may also need access to many other program files and so-forth.

During installation, a control panel probably asked for your mysql credentials,it may even have asked you to change the file permissions on a configurationfile of some sort. You've probably been through this type of install process at one time or another.

What it will do next, is write your database password and other privateinformation to a configuration file. This usually happens without yourknowledge, it is also where our problems begin.

Most people don't catch this right away, if the configuration file is inthe same directory (or sub-directory) it is web accessible. Quite often it is a php file, usually with write permissions turned on.

The extension .php does afford some degree of protection, under normalcircumstances these files aren't sent to a visitors browser but it is stillunsafe.

If someone makes a slight mistake in the configuration or .htaccess file, itwill dump the actual contents of "conf.php" to the users web browser, completewith your database password and other private information.

As anyone who has been around web servers very long can tell you, this isa common occurrence. I've personally seen it happen on several occasions.

Furthermore, many other web editing tools need to create backup files,resulting in something like config.php.BAK or perhaps config.php.tmp.

We now have a file ripe for hackers and other would-be intruders to gain accessto your mysql database passwords as well as any other private informationkept there.

What is most alarming is that almost every single off the shelf web basedprogram exhibits this very problem in some form or another.

You may ask yourself why a competent software designer would do such a thing? Why is it so common?

The answer is simplicity and market value. Customers demand software that iseasy to install. It is actually done this way for your convenience.

Scripts that store everything in one directory make it easy for you, thewebsite owner, to install and manage. Web software customers have come to demand this sort of thing.

Most software designers are aware of this problem, this is why they oftenchoose to write configuration into a .php file, it gives you some protection atthe expense of introducing other potentially security problems we won't coverhere.

While java servlet technology provides WEB-INF/ (a secure place to store thistype of information) most PHP or CGI environments do not offer such anenvironment.

Furthermore some web servers use something called "safe mode" which is amisguided attempt to make PHP "secure", operating in this mode forces a softwaredeveloper to write insecure programs in the manner I've just outlined.

For those of you who have inspected your website, good job! you've probablydiscovered you do have this problem. The next question is "What can be done"?

The correct approach is to relocate your configuration files (and any otherinformation that shouldn't be web accessible) to a place safely outside yourdocument root (sometimes called your "web folder") after you have done this,you shouldn't be able to access the files with a web browser, not even witha password.

I generally like to use the HOME directory, but it doesn't matter as long asit's safely kept well away from the prying eyes of would-be hackers.

With many scripts, this is not very practical, particularly if you have alreadyinstalled them. At this point, damage control may be your only option.

If you're using apache, you can give yourself some added protection in the formof an .htaccess file, this is still not not secure, but it's certainly betterthan nothing at all. In "safe" mode, this may be your only option.

There are also things you can do via the language itself, but I won't coverthem here.

After you have done this, it is important to make a note to yourself about it.When backing up your website, you will need to include not only the web pages,but these other files that you now have safely tucked outside your webdirectory.

If you are unable to solve the problem, (for example the web script won't allowyou to locate these files elsewhere) Simply being aware of it can go a long waytoward protecting your website from future attackers. Now that you know, you can keep an eye out for any backup files that may have been created by other tools.

Try not to be too tough on whoever wrote the program, chances are they choseto do it this way for the convenience of their users. I can attest from firsthand experience, if you don't store configuration data this way, customerscan become annoyed and rarely understand your reasoning.

Important NoticeDISCLAIMER: All information, content, and data in this article are sole opinions and/or findings of the individual user or organization that registered and submitted this article at Isnare.com without any fee. The article is strictly for educational or entertainment purposes only and should not be used in any way, implemented or applied without consultation from a professional. We at Isnare.com do not, in anyway, contribute or include our own findings, facts and opinions in any articles presented in this site. Publishing this article does not constitute Isnare.com's support or sponsorship for this article. Isnare.com is an article publishing service. Please read our Terms of Service for more information.

Jamie is an entrepreneur with http://www.GenieGate.com, specializing in UNIX based web technology for small to mid-size companies.
Article Tags: file [See Dictionary], php [See Dictionary], web [See Dictionary]
Got a question about this article? Ask the community!
Article published on November 22, 2007 at Isnare.com
 
Rate this article:

Cheap Web Hosting Can be Reliable
Submitted by: Jason Kay

Just saying the sentence ‘Cheap web hosting can be reliable,’ makes you sort of feel some doubt doesn’t it...

Natural Skin Care For Acne
Submitted by: Janet Davis

Acne affects nearly everyone at some point in his or her life It can be painful to endure, and even leave scars if severe enough...

How Much Will You Make by Taking Surveys?
Submitted by: Adam Woodham

How much will you make by taking surveys I see this question asked every single day on the web, yet many of those same people are still struggling to make decent cash...

The Gimp Tutorial And Free Gimp Download
Submitted by: Peter Nisbet

If you are looking for a Gimp tutorial, or 'the Gimp' as many refer to it as, then probably the best sites are those offering Gimp video tutorials...

How To Generate Traffic Using Social Bookmarking Websites
Submitted by: John Don

Social bookmarking will allow you to generate traffic to your website You will need a working strategy in order to generate the real traffic...

Let Your Voice be Heard-Create a Blog
Submitted by: Cathy Lindsay

Since the beginning of recorded time, mankind has longed to be heard, to be remembered, to have their voice live on after their body is gone, in essence, to record their time on earth...

Some Tips For Building a Website
Submitted by: Cathy Lindsay

A lot has changed in the virtual world since its creation, and even in the last ten years the bounds made in technology have allowed for richer, more engaging content on the World Wide Web...

It’s in the Content!
Submitted by: Cathy Lindsay

Content is King People want the most concise, accurate, and helpful information that they can get, whether from books, magazines, newspapers, television programming, or on the internet...

Thinking About Totally Redesigning Your Website?
Submitted by: John Dow

At the end of each calendar year I often schedule a quick review of my clients websites with the owner or person in charge of the website...

Make Money Online Products Are Junk - Learn the Free Way
Submitted by: Chris Little

The internet is flooded with make money online schemes, eBooks, and “methods” that are actually cleverly designed products that don’t really offer you anything useful at all...

The Appeal of Flash Games
Submitted by: Darena Litt

One of the principal reasons for the popularity of the World Wide Web is the emergence of online gaming...

Evolution of the Microblog
Submitted by: Brian Onorio

The status update - where are you and what are you doing Today, we live our lives online with social networks such as Facebook and Twitter, photo sharing services like Shutterfly and Picasa, and, most recently, with mobile phone apps that now remove the need to type out exactly where you are - it already knows...

Email Marketing – Three Keys Before You Hit Send
Submitted by: Enzo F. Cesario

Unfortunately, the first word that pops to mind when many people mention email marketing is 'spam' The junk mail of the modern era, spam is frequently held up as an abominable combination of inconvenience and social evil, with spam blockers and anti-spam petitions filling the news online and offline...

Make the Best Use of Mass Mail
Submitted by: John Clayton

Often you would wonder why there is no good response from the mass marketing campaigns This is quite an important thing to be considered as it accounts your business which is assumed to give you money...

Make the Most of Your Business With Mass Email Software
Submitted by: John Clayton

Are you looking for a better option to widen your business Is your business not seeming to be prospective...

Isnare.com Footer Divider

© 2004-2009. Isnare Free Articles - An Isnare Online Technologies Free Articles Project. All Rights Reserved.   Privacy Policy