Connecting Tech Pros Worldwide Help | Site Map

Basic security question

  #1  
Old July 17th, 2005, 01:15 PM
deko
Guest
 
Posts: n/a
If I have scripts located in public_html, can anyone download them and see
the code? For example, if I have an authentication script with code that I
don't want anyone to see, is it safe in public_html?


  #2  
Old July 17th, 2005, 01:15 PM
Colin McKinnon
Guest
 
Posts: n/a

re: Basic security question


deko wrote:
[color=blue]
> If I have scripts located in public_html, can anyone download them and see
> the code? For example, if I have an authentication script with code that
> I don't want anyone to see, is it safe in public_html?[/color]

Anybody whom can get code to run on the webserver can see the source by
writing a suitable script (e.g. '<?php print
file_get_contents('/home/user/public_html/private.php'; ?> )

If they can't get code onto the server, they can't see the source unless you
make it visible.

C.
  #3  
Old July 17th, 2005, 01:15 PM
deko
Guest
 
Posts: n/a

re: Basic security question


> > If I have scripts located in public_html, can anyone download them and
see[color=blue][color=green]
> > the code? For example, if I have an authentication script with code[/color][/color]
that[color=blue][color=green]
> > I don't want anyone to see, is it safe in public_html?[/color]
>
> Anybody whom can get code to run on the webserver can see the source by
> writing a suitable script (e.g. '<?php print
> file_get_contents('/home/user/public_html/private.php'; ?> )
>
> If they can't get code onto the server, they can't see the source unless[/color]
you[color=blue]
> make it visible.[/color]

So it sounds like if my host is doing it's job, I should be okay. But what
about in a shared environment? I assume my host has some kind of security
in place to keep other accounts out of my disk space.


  #4  
Old July 17th, 2005, 01:15 PM
Jerry Sievers
Guest
 
Posts: n/a

re: Basic security question


"deko" <deko@hotmail.com> writes:[color=blue]
>
> So it sounds like if my host is doing it's job, I should be okay.
> But what about in a shared environment? I assume my host has some
> kind of security in place to keep other accounts out of my disk
> space.[/color]

Best you don't assume anything. Ask your hosting company about
security against other developers on the same site being able to
access your scripts.

If you have shell access to this box, dig around yourself to see
what's possible from another developer's perspective. Can you see the
other guys' code? If so, they can very likely see yours.

Though you may have FTP access that's setup to put you in a chrooted
environment, you'd be surprised what can be learned by writing scripts
to do the "looking" around and then running them.

Want to learn who's on this box? Write a script to 'ls /home'. See
something of interest? Write a script to 'find /home/foo'.

Might work, might not. If you are very concerned about security, all
of this needs to be explored.

From an old time security buster...

--
-------------------------------------------------------------------------------
Jerry Sievers 305 854-3001 (home) WWW ECommerce Consultant
305 321-1144 (mobile http://www.JerrySievers.com/
  #5  
Old July 17th, 2005, 01:16 PM
Michael Vilain
Guest
 
Posts: n/a

re: Basic security question


In article <Vaw0e.1267$FN4.158@newssvr21.news.prodigy.com>,
"deko" <deko@hotmail.com> wrote:
[color=blue]
>
> So it sounds like if my host is doing it's job, I should be okay. But what
> about in a shared environment? I assume my host has some kind of security
> in place to keep other accounts out of my disk space.[/color]

One of the security issues with php is in a shared environment. The web
server has to have read access to the scripts and images, so commonly
they're owned by the user but given 644 permissions. SO, another user
with a shell account can read your files. Don't put passwords in them.

The only way you can protect against this is to restrict permissions on
your files to 600 and use something like CGIwrap (google for it) to run
scripts as your UID. I did this with my perl scripts and it works just
fine.

Read http://shiflett.org/articles/security-corner-mar2004 for more info.

--
DeeDee, don't press that button! DeeDee! NO! Dee...



  #6  
Old July 17th, 2005, 01:16 PM
pdt256
Guest
 
Posts: n/a

re: Basic security question


<?php echo `whoami`; ?>

That will tell you what user apache is running as. Thought that might
help...

Notice those are backticks `` and not single quotes ''.

-JI

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
A simple security question Oriane answers 5 September 8th, 2008 07:35 AM
Adding security question/answer check to ASP.NET *ChangePassword* control Ken Fine answers 2 August 25th, 2008 02:25 AM
Basic security question LP answers 0 March 4th, 2008 02:45 PM
CAL & MSSQL Security Question (by an ignorant) Martin Feuersteiner answers 2 July 20th, 2005 05:26 AM