LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-23-2006, 10:55 PM   #1
nephish
Member
 
Registered: Jun 2005
Distribution: arch, ubuntu
Posts: 456

Rep: Reputation: 30
got hacked, think i know how, help me stop it


lo there,
i am running a simple lamp from home.
i tried out this package from e107 that is a content management system.
i think i had some of the file permissions a little too permissive, and about a day after i installed it, something got in, created a user, and started to wreck havoc right in frot of my eyes. i unplugged from the ethernet, but still , lost a lot of time because i had to restore everything, lost root password, all kinds of stuff. i feel like an idiot about this.. but it brings me to my questions....

what is a good permissions setup for files in a webserver and cgi-bin ?
chmod 655 ? i know that 777 is no good.

another twist, i have a couple of users set up (friends) whose websites i was also hosting. i would let them ssh to upload their files to their home directory (also the web-root of their website). So they need to still be able to do that.
would ftp be safer ?

need some advice because, although i did not loose anything except some face and time, the thing cost a lot in doing a reinstall of archlinux and restoring backups.

any tips are welcome.


thanks gents
 
Old 01-23-2006, 11:44 PM   #2
Kahless
Member
 
Registered: Jul 2003
Location: Pennsylvainia
Distribution: Slackware / Debian / *Ubuntu / Opensuse / Solaris uname: Brian Cooney
Posts: 503

Rep: Reputation: 30
i dont know about this package, but is its php config file readable on the web server? if so.... is there any way to make it not readable and still work, perhaps by putting it outside the web root?


if it is readable, was the mysql username and password the same as a system account username and password? if so, that would have been a very easy first step in.
 
Old 01-23-2006, 11:48 PM   #3
Kahless
Member
 
Registered: Jul 2003
Location: Pennsylvainia
Distribution: Slackware / Debian / *Ubuntu / Opensuse / Solaris uname: Brian Cooney
Posts: 503

Rep: Reputation: 30
http://www.networksecurityarchive.or.../msg00106.html


google around for hacking e107 to find other problems and possibly ways to secure agenst them
 
Old 01-24-2006, 05:10 AM   #4
nephish
Member
 
Registered: Jun 2005
Distribution: arch, ubuntu
Posts: 456

Original Poster
Rep: Reputation: 30
yeah, the name and password were the same, guess i know better than to do that now.
thanks
 
Old 01-24-2006, 05:30 AM   #5
nephish
Member
 
Registered: Jun 2005
Distribution: arch, ubuntu
Posts: 456

Original Poster
Rep: Reputation: 30
by the way, thanks for the link.
what permissions should the files in the web_root folders be ?
 
Old 01-24-2006, 06:40 AM   #6
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
For directories:
755 if you want to allow indexing
711 to disallow it

HTML,IMAGE,..:
644

CGI:
755 or 711

Last edited by nx5000; 01-24-2006 at 06:42 AM.
 
Old 01-24-2006, 08:12 AM   #7
nephish
Member
 
Registered: Jun 2005
Distribution: arch, ubuntu
Posts: 456

Original Poster
Rep: Reputation: 30
wow, thanks a lot for that.
after googling around, not just at e107 hacking, but php (what i use most) there is some scary stuff out there, kinda surprised that i have not had this happen before, i have been running my server for a year.
thanks for the great info.
 
Old 01-24-2006, 09:06 AM   #8
dbogdan
Member
 
Registered: Feb 2005
Location: Metro Detroit, US
Distribution: Suse/Slackware/Mepis
Posts: 174

Rep: Reputation: 31
I've been running e107 for several years now on an internet facing box, been lucky I guess... anyway, have you checked out the e107.org site for updates ? they also have a very helpful and active forum that might help you out on permission/security questions.

Dave
 
Old 01-24-2006, 01:12 PM   #9
doublejoon
Member
 
Registered: Oct 2003
Location: King George, VA
Distribution: RHEL/CentOS/Scientific/Fedora, LinuxMint
Posts: 370

Rep: Reputation: 44
Get mod_security!!! http://www.modsecurity.org/

It rocks!!
 
Old 01-24-2006, 02:19 PM   #10
nephish
Member
 
Registered: Jun 2005
Distribution: arch, ubuntu
Posts: 456

Original Poster
Rep: Reputation: 30
mod security looks great, even a debian package for it (use debian at work, arch at home) so i will have to get it for arch too.
thanks much. Yeah, having the same user name and password in the scripts as i use on my system was somewhat foolish of me, even more to just blanket everything with chmod 777 . i guess you just don't do that.

thanks everyone.

Last edited by nephish; 01-24-2006 at 02:21 PM.
 
Old 01-24-2006, 09:51 PM   #11
KimVette
Senior Member
 
Registered: Dec 2004
Location: Lee, NH
Distribution: OpenSUSE, CentOS, RHEL
Posts: 1,794

Rep: Reputation: 46
Why not disable indexing in your {vhost}.conf file or at minimum in .htaccess?
 
Old 01-25-2006, 07:30 AM   #12
nephish
Member
 
Registered: Jun 2005
Distribution: arch, ubuntu
Posts: 456

Original Poster
Rep: Reputation: 30
ok, if i disable indexing, it means that someone cannot go to www.mysite.com/some_directory/ and see all the files listed there right?

ok, that sounds good.

I have hit a snag here with my permissions. There is part of the website where users can upload images to a certain directory. It doesnt work right now because i dont have permission as a web user to view the contents of said directory.

what permissions do i use in this case, the images need to be able to be uploaded, but also viewed later from the website.

thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Have I been hacked? lagu2653 Linux - Security 4 11-08-2005 08:01 PM
How do I stop services from restarting after I stop them? M$ISBS Linux - Software 3 10-27-2005 08:13 PM
hacked! I_AM Linux - Security 5 06-09-2005 05:26 PM
am i being hacked? issey Linux - Newbie 3 06-08-2005 08:47 AM
HELP I think i got hacked spank Linux - Newbie 5 03-24-2004 08:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration