RE: [PHP] /etc/passwd

2003-07-11 Thread Ford, Mike [LSS]
> -Original Message- > From: Fejes Jozsef [mailto:[EMAIL PROTECTED] > Sent: 10 July 2003 12:33 > > My method is: > 1. check if id starts with / > if(ereg("^\/", $id)) > goaway; That's a rather expensive (and slightly obscure) way of performing that check. Try: if ($id{0}=='/') go

Re: [PHP] /etc/passwd

2003-07-10 Thread Andreas Mendyk
Hi, > if the make script > and then just write > test.php?id=/etc/passwd , they see all the file. Well, FreeBSD provides a way to jail webservers: Jails 8-) http://www.freebsd.org/doc/en_US.ISO8859-1/books/developers-handbook/jail.html with best regards -- Andreas Mendyk [EMAIL PROTE

Re: [PHP] /etc/passwd

2003-07-10 Thread Wendell Brown
>> So how to make sure that no one can access other people files and >> server files? and is there any way that nobody would be able to >> download php files or how to make them look like code when they are >> downloaded. Thanks! I think he means "How do I keep people who have access to upload

Re: [PHP] /etc/passwd

2003-07-10 Thread Chris Hayes
At 13:45 10-7-03, Marek wrote: Add a check for php files, or any other files you don't want anybody to include: if(ereg('php[0-9]$', $id)) goaway; but what about '?' and '#' additions? $id="however_they_would_find_out/your_path/file.php?extra=x#loc"; ? so maybe if(ereg('\.php', $id)) ? -

Re: [PHP] /etc/passwd

2003-07-10 Thread Marek Kilimajer
Add a check for php files, or any other files you don't want anybody to include: if(ereg('php[0-9]$', $id)) goaway; Fejes Jozsef wrote: My method is: 1. check if id starts with / if(ereg("^\/", $id)) goaway; 2. check if there is .. in it if(ereg("\.\.", $id)) goaway; -- PHP General Ma

Re: [PHP] /etc/passwd

2003-07-10 Thread Fejes Jozsef
My method is: 1. check if id starts with / if(ereg("^\/", $id)) goaway; 2. check if there is .. in it if(ereg("\.\.", $id)) goaway; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] /etc/passwd

2003-07-10 Thread Jason Wong
On Thursday 10 July 2003 17:26, Mantas Kriauciunas wrote: > my server is running freebsd 5.0 > > and yet i havent fixed bug that i knew long time ago, so can anyone > point me with some links or resources about it, i could not find any > good on google, maybe i don't know how to search. First

Re: [PHP] /etc/passwd

2003-07-10 Thread Marek Kilimajer
Exactly like I said, just check this: $id='/etc/passwd'; if($id && eregi('^[a-z0-9_]+\.html',$id)) include($id); else die('Go away!'); The regular expression prevents anyone from accessing any file that is not in your web root (http://your.server.net/) or its name does contain any other character

Re: [PHP] /etc/passwd

2003-07-10 Thread Marek Kilimajer
Mantas Kriauciunas wrote: The problem is if the make script and then just write test.php?id=/etc/passwd , they see all the file. Check if $id is valid. Exact way depends on the structure of the files. Example 1: All included files are in web root and are named something.html, something can c