LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > CGI Security

Reply
 
Thread Tools Display Modes
  #1  
Old 12-22-2005, 02:46 PM
zoom zoom is offline
Senior Member
 
Join Date: Nov 2005
Posts: 92
Default CGI Security

Just wondering why I'm able to create a cgi script that can browse the any of the files in the chroot environment?? Below are the settings I'm using for the server. The document root for the test website is owned by user other than the LSWS.

(Server) Enable chroot Yes
(VH) CGI Set UID Mode DocRoot UID
(VH) CGI Chroot Mode Same as Server

Context /cgi-bin/ is set as follows
Allow Set UID N/A

Why can I browse files in other directories? I should be locked into my doc root..
Reply With Quote
  #2  
Old 12-22-2005, 03:08 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
I think it is a unix account security issue.

A private group should be created for each user, the root directory of each user should be owned by the user and the private group, perission should be 0750 or 0770. then only this user can read his own directory.

The user that web server running as should be member of the private groups of those users, so the web server can read all files.

Then a set-uid CGI script will not able to peak files of another user. :-)
Reply With Quote
  #3  
Old 12-23-2005, 11:28 AM
zoom zoom is offline
Senior Member
 
Join Date: Nov 2005
Posts: 92
Yes,
But why can I browse files outside the chroot for LSWS. For example have a simple cgi script that can 'cat' the /etc/passwd file. The file has the following attributes

rw-r--r-- 1 root root 242 Dec 22 15:00 passwd

I'm guessing this is because the it's world readable. Still, bothers me that people within a shared environment can browse these types of files. Do they really need to be world readable??? Is there anyway to prevent it?
Reply With Quote
  #4  
Old 12-23-2005, 01:34 PM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
Are you sure it is /etc/passwd out side the jail, not the /chroot/etc/passwd? If it is, then it is a bug means that the CGI has not been chroot properly.

As some application need to read /etc/passwd to work properly, so I don't recommend making it not world readable, you can fake a passwd file in the jail. Information in /etc/passwd is not very sensitive to me. :-)
Reply With Quote
  #5  
Old 12-23-2005, 01:47 PM
zoom zoom is offline
Senior Member
 
Join Date: Nov 2005
Posts: 92
mistwang,
I'm referring to the passwd file located within the jail /chroot/etc/passwd. Take for example a very simple script as shown below.

Code:
echo "Content-type: text/plain; charset=iso-8859-1"
echo
echo CGI/1.0 test scriptt:
echo
echo `cat /etc/passwd`
Initially I was somewhat concerned that CGI scripts could read world readable files within the chroot. However, I'm not as worried now. Simply because I can control what binaries are available to users within the chroot. If users were able to get information from the httpd.conf etc it wouldn't be any good since they can't browse other virtual hosts outside of their own. Provided of course that each virtual host is running under a separate userid and has the corrrect file permissions. The only danger is that they have to potential to spot a misconfiguration, which could be exploited.
Reply With Quote
Reply

Thread Tools
Display Modes

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
security Dani Feedback/Feature Requests 29 06-17-2008 09:32 AM
Security vulnerability in Ruby's CGI could cause DoS on LS servers subBlue Bug Reports 1 10-28-2006 01:27 PM
security: possible to hide that the server is litespeed? apachesux Install/Configuration 5 01-03-2006 02:49 PM
Security Question zoom Install/Configuration 5 12-02-2005 09:20 AM
"Context Access Control" in vhost security section ts77 Install/Configuration 2 03-14-2005 01:19 AM


All times are GMT -7. The time now is 01:11 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.