473,396 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Basic security question

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?
Jul 17 '05 #1
5 1307
deko wrote:
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?


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.
Jul 17 '05 #2
> > 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?
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.


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.
Jul 17 '05 #3
"deko" <de**@hotmail.com> writes:

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.


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/
Jul 17 '05 #4
In article <Va****************@newssvr21.news.prodigy.com>,
"deko" <de**@hotmail.com> wrote:

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.


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...

Jul 17 '05 #5
<?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

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Greg | last post by:
I am developing an application where I need to secure a workstation for periods of time. I can use BlockInput to stop users from task switching or messing with the keyboard, but I would like to...
4
by: Ramesh | last post by:
hi, Let me ask some basic questions. Can anybody explain me about the following questions: 1. When we have to create sn key? Whenever we compiled Component we have to create or it is a one time...
6
by: Sahil Malik [MVP] | last post by:
Public Private Key Pairs - How do they work? ----------------------------------------------- I was looking at a presentation recently in which it was suggested that - User 1 Encrypts a message...
4
by: Mark Fox | last post by:
Hello, I've noticed in some sample code that sometimes people use the @ before a string when concatenating them. Example: string filePath = Appl.Request.PhysicalApplicationPath + @"bin\" +...
6
by: Erez Shor | last post by:
Hi, I need to build and asp page which access a remote windows server's registry and create a registry key. In order for the ASP page to be able to access the registry on the remote server I need...
5
by: Aussie Rules | last post by:
Hi, Having a mental block on this one. Have done it before but can't rack my brain on how... I have an object, with a bunch on property, and I add that object to a combo box. I want the...
7
by: jason | last post by:
In the microsoft starter kit Time Tracker application, the data access layer code consist of three cs files. DataAccessHelper.cs DataAcess.cs SQLDataAccessLayer.cs DataAcccessHelper appears...
6
by: j2ee.singh | last post by:
Hi, I'm looking to buy a new laptop primarily to learn & practice .NET and C#. My Question is: Is there any requirement for .NET and C# in terms of the following Operating Systems: -...
2
by: Dave Dean | last post by:
Hi all, I'm just starting out in sockets/network programming, and I have a very basic question...what are the 'security' implications of opening up a socket? For example, suppose I've written a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.