hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : Hosting Security and Technology Tutorials : How to reduce risk uploads directories
Reply

Hosting Security and Technology Tutorials Tutorials related to server security or the like.
Forum Jump

How to reduce risk uploads directories

Reply Post New Thread In Hosting Security and Technology Tutorials Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 03-15-2006, 07:01 AM
andreyka andreyka is online now
Linux Guru
 
Join Date: Mar 2004
Location: Odessa, Ukraine
Posts: 604

How to reduce risk uploads directories


This is small script, which search upload directories and add .httaccess for disable php and cgi script execution:
#!/bin/sh
HOME=/home
NOBODY=nobody

htaccess () {
cat > "$j/.htaccess"

RemoveType php
Options -ExecCGI -Indexes
EOF
}

fixupload () {
if [ -e "$j/.htaccess" ]; then
if [ -z "`grep RemoveType "$j/.htaccess"`" ]; then
htaccess
fi
else
htaccess
chown $i:$i "$j/.htaccess"
fi
}

cd $HOME
for i in *; do
if [ -d $i/public_html ]; then
# Fix 777 upload
for j in `find $i/public_html -type d -perm 777`; do
fixupload
done
# Fix 775 nobody upload
for j in `find $i/public_html -type d -perm 775 -group $NOBODY`; do
fixupload
done
# Fix 755 nobody upload
for j in `find $i/public_html -type d -perm 775 -user $NOBODY`; do
fixupload
done
fi
done

Reply With Quote


Sponsored Links
  #2  
Old 08-16-2006, 03:41 AM
markhard markhard is offline
Web Hosting Master
 
Join Date: Mar 2004
Location: Netherlands
Posts: 740
have any body try this script?

question for andreyka, does your script can prevent hackers from uploading perl script?

usually hacker using mambo/joomla security hole to upload script that can download files from internet and then execute it on /tmp

Reply With Quote
  #3  
Old 08-16-2006, 07:53 AM
Markus H Markus H is offline
Newbie
 
Join Date: Jul 2006
Posts: 22
You can add you /tmp directory in noexec mode.

This will help you to found script that have been uploaded to your /tmp directory.
Quote:
find /tmp -exec file {} \; | egrep -i '(script|exec)'

Reply With Quote
Sponsored Links
  #4  
Old 09-20-2006, 01:26 PM
andreyka andreyka is online now
Linux Guru
 
Join Date: Mar 2004
Location: Odessa, Ukraine
Posts: 604
Usually some pic gallery don't check files what be uploaded. If somebody upload php scritp and run it - recive access to site.
This script pervent do it.

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Cloudmark Shares Strategies to Avoid Email Blacklisting, Improve Deliverability Blog 2013-05-31 14:57:24
Liquid Web Uses Google Street View in Data Center Scavenger Hunt Blog 2013-04-25 11:13:26
Five Cool Android Apps Created by Web Hosting Companies Web Hosting News 2012-11-12 13:28:51
A Cool DMCA Takedown Flowchart from Web Host Nexess Blog 2012-02-29 18:00:18
Parallels US SMB Market Study Points Out Cloud Opportunities for Hosts Web Hosting News 2012-02-29 12:00:50


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?