Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Too Secure??? [SOLVED]
PostPosted: Sun Nov 30, 2008 1:11 pm 
Offline
Senior Member

Joined: Mon Sep 01, 2008 5:14 pm
Posts: 92
So I host a few joomla sites on my linode and know there are some potential vulnerabilities in doing so. I took some time and read many articles on how to secure apache and the rest of my install to protect against many of the common hacks.

My problem now is that I think I made it "too secure", I am unable to upload files from a browser. I tried to remove mod security and had the same issue, I checked some things in php.ini and from what I can tell thats not blocking it. What else could be blocking the files from making it to the server?

One of the scripts allows for an image to be uploaded and resize it. When I look at the error log the first item is that it can not find the image where it should have been placed. This is whats making me think that some setting somewhere is still messing with me.

Its Centos if that helps.

Thanks guys.


Last edited by eld101 on Thu Dec 11, 2008 7:02 pm, edited 1 time in total.

Top
   
 Post subject:
PostPosted: Sun Nov 30, 2008 8:52 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
Does the web server have write permissions to the directory where your uploaded files are supposed to go? The directory should be owned by the same user as the web server, or else it should be writable by everyone (permission 777).


Top
   
 Post subject:
PostPosted: Sun Nov 30, 2008 9:03 pm 
Offline
Senior Member

Joined: Mon Sep 01, 2008 5:14 pm
Posts: 92
hybinet wrote:
Does the web server have write permissions to the directory where your uploaded files are supposed to go? The directory should be owned by the same user as the web server, or else it should be writable by everyone (permission 777).


yes


Top
   
 Post subject:
PostPosted: Sun Nov 30, 2008 9:12 pm 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
Do you have SELinux enabled? This is a common problem with CentOS and SELinux when changing where the web server document root is. Google around.

_________________
Rgds
Stephen
(Linux user since kernel version 0.11)


Top
   
 Post subject:
PostPosted: Sun Nov 30, 2008 10:23 pm 
Offline
Senior Member

Joined: Mon Sep 01, 2008 5:14 pm
Posts: 92
sweh wrote:
Do you have SELinux enabled? This is a common problem with CentOS and SELinux when changing where the web server document root is. Google around.

I have checked that, It is not enabled.


Top
   
 Post subject:
PostPosted: Mon Dec 01, 2008 10:37 am 
Offline
Senior Member

Joined: Fri Sep 12, 2008 3:17 am
Posts: 166
Website: http://independentchaos.com
eld101 wrote:
hybinet wrote:
Does the web server have write permissions to the directory where your uploaded files are supposed to go? The directory should be owned by the same user as the web server, or else it should be writable by everyone (permission 777).


yes


which of the statements are true?

Do you mind posting your php.ini? here preferably


Top
   
 Post subject:
PostPosted: Mon Dec 01, 2008 5:38 pm 
Offline
Senior Member

Joined: Mon Sep 01, 2008 5:14 pm
Posts: 92
freedom_is_chaos wrote:
eld101 wrote:
hybinet wrote:
Does the web server have write permissions to the directory where your uploaded files are supposed to go? The directory should be owned by the same user as the web server, or else it should be writable by everyone (permission 777).


yes


which of the statements are true?

Do you mind posting your php.ini? here preferably


files and folders are owned by user apache:bbt and are 775

php.ini --> http://pastebin.linode.com/1524


Top
   
 Post subject:
PostPosted: Thu Dec 04, 2008 5:58 pm 
Offline
Senior Member

Joined: Mon Sep 01, 2008 5:14 pm
Posts: 92
any other ideas?


Top
   
 Post subject:
PostPosted: Thu Dec 04, 2008 6:36 pm 
Offline
Senior Member

Joined: Mon Jun 16, 2008 6:33 pm
Posts: 151
Quote:
One of the scripts allows for an image to be uploaded and resize it. When I look at the error log the first item is that it can not find the image where it should have been placed.


Which log ? It would be worth posting the relevant, sanitized lines, as well as whatever is posted back to your browser, if anything.

Is this a Joomla script, or one you've written and included in the site ? If Joomla, have you checked the config for the module, and for whichever graphics module/toolkit you're using for the resize ?

Does it fail for all (Joomla) users and file sizes ?


Top
   
 Post subject:
PostPosted: Thu Dec 04, 2008 7:03 pm 
Offline
Senior Member

Joined: Mon Sep 01, 2008 5:14 pm
Posts: 92
This is not a joomla script, I will try and get the log file posted shortly.


Top
   
 Post subject:
PostPosted: Thu Dec 04, 2008 7:09 pm 
Offline
Senior Member

Joined: Mon Jun 16, 2008 6:33 pm
Posts: 151
Quote:
This is not a joomla script


May be worth posting that also.


Top
   
 Post subject:
PostPosted: Wed Dec 10, 2008 7:11 pm 
Offline
Senior Member

Joined: Mon Sep 01, 2008 5:14 pm
Posts: 92
eld101 wrote:
This is not a joomla script, I will try and get the log file posted shortly.


sorry it took so long.... any ideas?


Code:
[Wed Dec 10 18:10:23 2008] [error] [client 65.24.37.56] PHP Warning:  imagecreatefromjpeg() [<a href='function.imagecreatefromjpeg'>function.imagecreatefromjpeg</a>]: open_basedir restriction in effect. File(/tmp/phpGC7YF1) is not within the allowed path(s): (/var/www/html/) in /var/www/html/bitchesbetrippin.com/uploader2/submit.php on line 26, referer: http://www.bitchesbetrippin.com/uploader2/submit.php
[Wed Dec 10 18:10:23 2008] [error] [client 65.24.37.56] PHP Warning:  imagecreatefromjpeg(/tmp/phpGC7YF1) [<a href='function.imagecreatefromjpeg'>function.imagecreatefromjpeg</a>]: failed to open stream: Operation not permitted in /var/www/html/bitchesbetrippin.com/uploader2/submit.php on line 26, referer: http://www.bitchesbetrippin.com/uploader2/submit.php
[Wed Dec 10 18:10:23 2008] [error] [client 65.24.37.56] PHP Warning:  imagejpeg(): supplied argument is not a valid Image resource in /var/www/html/bitchesbetrippin.com/uploader2/submit.php on line 45, referer: http://www.bitchesbetrippin.com/uploader2/submit.php
[Wed Dec 10 18:10:23 2008] [error] [client 65.24.37.56] PHP Warning:  chmod() [<a href='function.chmod'>function.chmod</a>]: No such file or directory in /var/www/html/bitchesbetrippin.com/uploader2/submit.php on line 46, referer: http://www.bitchesbetrippin.com/uploader2/submit.php
[Wed Dec 10 18:10:23 2008] [error] [client 65.24.37.56] PHP Warning:  getimagesize(image_files/eric.jpg) [<a href='function.getimagesize'>function.getimagesize</a>]: failed to open stream: No such file or directory in /var/www/html/bitchesbetrippin.com/uploader2/submit.php on line 51, referer: http://www.bitchesbetrippin.com/uploader2/submit.php
[Wed Dec 10 18:10:23 2008] [error] [client 65.24.37.56] PHP Warning:  imagedestroy(): supplied argument is not a valid Image resource in /var/www/html/bitchesbetrippin.com/uploader2/submit.php on line 75, referer: http://www.bitchesbetrippin.com/uploader2/submit.php
[Wed Dec 10 18:10:23 2008] [error] [client 65.24.37.56] File does not exist: /var/www/html/bitchesbetrippin.com/uploader2/image_files/eric.jpg, referer: http://www.bitchesbetrippin.com/uploader2/submit.php?upload_message=Image%20Uploaded&upload_message_type=success&show_image=eric.jpg


Top
   
 Post subject:
PostPosted: Wed Dec 10, 2008 7:20 pm 
Offline
Senior Member

Joined: Mon Jun 16, 2008 6:33 pm
Posts: 151
This might be your problem:

Code:
[Wed Dec 10 18:10:23 2008] [error] [client 65.24.37.56] PHP Warning:  imagecreatefromjpeg() [<a href='function.imagecreatefromjpeg'>function.imagecreatefromjpeg</a>]: open_basedir restriction in effect. File(/tmp/phpGC7YF1) is not within the allowed path(s): (/var/www/html/) in /var/www/html/bitchesbetrippin.com/uploader2/submit.php on line 26, referer: http://www.bitchesbetrippin.com/uploader2/submit.php


...where you have set in php.ini:

Quote:
http://pastebin.linode.com/1524:
; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
open_basedir = /var/www/html/


Top
   
 Post subject:
PostPosted: Wed Dec 10, 2008 7:22 pm 
Offline
Senior Member

Joined: Mon Sep 01, 2008 5:14 pm
Posts: 92
mjrich wrote:
This might be your problem:

Code:
[Wed Dec 10 18:10:23 2008] [error] [client 65.24.37.56] PHP Warning:  imagecreatefromjpeg() [<a href='function.imagecreatefromjpeg'>function.imagecreatefromjpeg</a>]: open_basedir restriction in effect. File(/tmp/phpGC7YF1) is not within the allowed path(s): (/var/www/html/) in /var/www/html/bitchesbetrippin.com/uploader2/submit.php on line 26, referer: http://www.bitchesbetrippin.com/uploader2/submit.php


...where you have set in php.ini:

Quote:
http://pastebin.linode.com/1524:
; open_basedir, if set, limits all file operations to the defined directory
; and below. This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file. This directive is
; *NOT* affected by whether Safe Mode is turned On or Off.
open_basedir = /var/www/html/


what would the issue be with this?


Top
   
 Post subject:
PostPosted: Wed Dec 10, 2008 7:28 pm 
Offline
Senior Member

Joined: Mon Jun 16, 2008 6:33 pm
Posts: 151
Surely you jest ? Oi ?

(Non ? open_basedir is doing exactly as per the comments in php.ini. Either you'lll need to change your script so that it operates within the the aforementioned path, /var/www/html, or change the open_basedir path to fit your script.)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group