Jump to content

Shell code


regdude

Recommended Posts

Well, the problem is that a PHP shell can get to the actual root of the system which also includes access to all other virtual hosts on this web server.

I need to disallow access from one virtual host to another. Safe-mode does this, but that makes problems to available intergrated PHP functions.

Can I use open_basedir with virtual hosts? I got this setting wrong and as a result I had a 404 error everywhere.

Maybe .htaccess in the root of virtual host could do the trick?

Link to comment
https://forums.phpfreaks.com/topic/142675-shell-code/#findComment-747929
Share on other sites

This is lighttpd :P

 

Ok, but I ran in to a problem anyway, the virtual host syntax differs.

This is how it looks it lighttpd:

$HTTP["host"] == "x" {
server.document-root = "/var/www/x/htdocs"
server.errorlog = "/var/log/lighttpd/x/error.log"
accesslog.filename = "/var/log/lighttpd/x/access.log"
server.error-handler-404 = "/error.php"
}

 

Also, .htaccess with:

php_value open_basedir "/var/www/music.ngames.lv/htdocs"

doesn't work, the shell still has access out of the virtual host.

Link to comment
https://forums.phpfreaks.com/topic/142675-shell-code/#findComment-747949
Share on other sites

Honestly,

 

  If you are using PHP on a server, I suggest using suPHP / suExec.  And if you want to go really paranoid about it, use it under a chroot jail as mentioned.

 

suPHP Information:

 

www.suphp.org/

http://www.markgrenham.com/articles/howto_lighttpd_and_suphp

http://www.itc.virginia.edu/server/web/php/suphp.html

http://howtoforge.com/install-suphp-on-various-linux-distributions-for-use-with-ispconfig-2.2.20-and-above

 

Chroot Information:

 

What is a Chroot?

http://www.rootprompt.org/article.php3?article=10883

http://www.cyberciti.biz/tips/ultimate-lighttpd-webserver-security.html

 

If you are anything like me, when researching how to do something, no single how-to or About is going to suffice.  Thats why I am just linking to several different sites.

 

 

Essentially, suPHP forces php to run as a particular user and ONLY that user (this can be done per-vhost so ONLY the user owning that vhost can access the php files for that site). 

 

Added protection would be implementing a chroot jail. Implementing a chroot jail for your web server will isolate the service to a particular location on the filesystem.  The service may be able to access files below its spot on the file system but will typically not be able to get above its location.  (ex. if you hate lighttpd chrooted to /vhosts/mydomain.tld, it will be able to access /vhosts/mydomain.tld/www-data/images but it will not be able to access /vhosts/myotherdomain.tld).

Link to comment
https://forums.phpfreaks.com/topic/142675-shell-code/#findComment-749433
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.