|
|
|
|
|
|
|
![]() |
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
![]() |
#1 |
a.k.a. Sparky
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
|
![]() Recently, there have been a number of exploits targeted on holes in commonly run software. Autolinks Pro was one such exploit with a direct call to al_initialize.php.
Today, we found another script that has also been exploited -- a script that was downloaded off a site that provides some quick and easy functionality, however, has a pretty serious url injection issue. There are a few things that can be done to prevent this pretty easily. If the software you installed has an include or inc directory, it is generally accepted that you wouldn't ever directly link those files. To avoid most web exploits, an .htaccess file in the include directory with Code:
deny from all Another method that can be used within your php script is: Code:
if(strpos($_SERVER['PHP_SELF'], "filename.php") !== false) { exit; } I'm not a fan of using somefile.php.inc as a filename because even though you have prevented the server from parsing the file, a normally configured server will make that file viewable by a surfer, perhaps giving them other opportunities to exploit other code. Even if it is code that is written by reputable firms, you still need to protect yourself. Another possibility which might add some headaches is running mod_security, an apache module which attempts to filter requests that might be exploit attempts. It isn't just php that is a problem here. Safe coding really needs to be used whenever you use any programming language.
__________________
SnapReplay.com a different way to share photos - iPhone & Android |
![]() |
![]() |
![]() |
#2 |
Certified Nice Person
|
Shit!
![]() This is twice within two weeks you and Brian have saved my pathetic ass. ![]() ![]()
__________________
Click here to purchase a bridge I'm selling. |
![]() |
![]() |
![]() |
#3 |
Internet! Is that thing still around?
|
with all the scripts I develop I have all the php include files outside the web document root so they can only be pulled in by a php script and cannot be loaded up directly by a browser.
hth rich
__________________
ICQ# 6820996 |
![]() |
![]() |
![]() |
#4 | |
You can now put whatever you want in this space :)
|
Quote:
I use classes, not bare functions, so access to a php file doesn't do anything.
__________________
Success is going from failure to failure without a loss of enthusiasm. |
|
![]() |
![]() |
![]() |
#5 |
Certified Nice Person
|
I download free scripts and put them exactly where the install directions tell me to put them.
![]()
__________________
Click here to purchase a bridge I'm selling. |
![]() |
![]() |
![]() |
#6 |
A woman is like beer. They look good, they smell good, and you'd step over your own mother just to get one!
Join Date: Sep 2003
Location: Irving, TX
Posts: 57
|
cd24, thanks for the excellent advice. That's a good tip, rich06.
__________________
mikey likes it |
![]() |
![]() |
![]() |
#7 | |
Internet! Is that thing still around?
|
Quote:
cheers rich
__________________
ICQ# 6820996 |
|
![]() |
![]() |
![]() |
#8 | |
You can now put whatever you want in this space :)
|
Quote:
Also, each of my domain requires a variant of the basic classes I use across all domains, so it's easier for me to use a set per domain instead of set per server.
__________________
Success is going from failure to failure without a loss of enthusiasm. |
|
![]() |
![]() |
![]() |
#9 |
The only guys who wear Hawaiian shirts are gay guys and big fat party animals
|
More PHP security advice:
ALL PHP scripts have security issues, including the following script, which lets any visitor to the site upload any file they want to your server: PHP Code:
people uploaded files to your server due to the design (or rather lack of design) of PHP itself. To improve PHP security turn register_globals off, fopen_url off, open_basedir on, and except for directories that hold scripts which accept file uploads turn file uploads off. |
![]() |
![]() |
![]() |
#10 | |
With $10,000, we'd be millionaires! We could buy all kinds of useful things like ... love!
|
Another option is to deter the 'hackers' in the first place by:
1) disguising the fact you use scripting by renaming your .php files to .htm and adding the following to your .htaccess Quote:
2) hiding all file extensions using mod_rewrite so that they appear to be directories. I do that at my TopSites list at topsites.allyoursex.com Option 1 would be the easiest for most, I expect, but I mentioned option 2 as an alternative for those in position to use it.
__________________
Playboy Webmasters - The name says it all! $35 per signup or 60% revshare. |
|
![]() |
![]() |
![]() |
|
|