473,406 Members | 2,847 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,406 software developers and data experts.

Security in an process started with exec

a
Hi,

The php script that processes user input from a form, starts a new process
using exec. In my case, the process may contain arbitrary, user defined
functionality. How do I ensure that that process doesn't do any harm? Is
there a way to define a sort of sandbox that the process can run in, so it
won't be able to access any unauthorized resources, or do some other damage
to the server?

I am running PHP 5.1.2 on Apache 2, on Win XP Pro.

Thanks,

A
Jan 18 '06 #1
4 1332
NC
a wrote:

The php script that processes user input from a form, starts a new process
using exec. In my case, the process may contain arbitrary, user defined
functionality. How do I ensure that that process doesn't do any harm? Is
there a way to define a sort of sandbox that the process can run in, so it
won't be able to access any unauthorized resources, or do some other
damage to the server?


If your process contains arbitrary user-defined functionality, there's
nothing you can do to define a sandbox for it. Arbitrary user-defined
functionality may include switching to the superuser mode (e.g., su on
Unix), which renders any sandbox meaningless.

Cheers,
NC

Jan 18 '06 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

a wrote:
Is there a way to define a sort of sandbox that the process can run in, so
it won't be able to access any unauthorized resources, or do some other
damage to the server?


You may want to evaluate chroot jails, xen virtual machines, and other ways
of running processes within a different enviroment.

- --
- ----------------------------------
Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net

Un ordenador no es un televisor ni un microondas, es una herramienta
compleja.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDzr823jcQ2mg3Pc8RAiAXAJ9N3unVw1t4IX6srErQyO WF8FKuhQCePzbJ
U+TweXdejY8dPTNnti880VU=
=QZ3u
-----END PGP SIGNATURE-----
Jan 18 '06 #3
a
>
You may want to evaluate chroot jails, xen virtual machines, and other
ways
of running processes within a different enviroment.

The solutions you mention are not available for Windows (the exec-ed
processes must run on Windows), but I'll check other solutions like VMWare.

Thanks,

A
Jan 19 '06 #4
a
>
If your process contains arbitrary user-defined functionality, there's
nothing you can do to define a sandbox for it. Arbitrary user-defined
functionality may include switching to the superuser mode (e.g., su on
Unix), which renders any sandbox meaningless.


I don't know how things work on Unix, but at least on Windows I think there
is a solution. Instead of calling exec to run the process that does the
actual work (P1), I create a thin executable (P2) that runs my process using
CreateProcessAsUser. This will run a process in the context of a specific
Windows user and which can be different from the user that is calling it.
Then in my php script I use exec to start P2, which will start P1 in a safe
context, assuming that the user in whose context is running has the
appropriate rights on the server.

I still have to try it, but it seems like a safe solution to me.

A
Jan 19 '06 #5

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

Similar topics

3
by: Jenkins | last post by:
I want to start a perl pgm in the background on my hosts web server as a stand-alone process. I only have ftp access. What I've done, so far, is: 1) created the actual background perl script,...
3
by: Noloader | last post by:
Hello, We are using Access Front End (ADP Project) and SQL Server 2000 backend. SQL Server is using NT Security. We do not want the users to access the the underlying tables. So, we went to...
1
by: Elham.Ghoddousi | last post by:
How can I implement "Row Level Security" in SQL Server 2000? Thanks alot.
1
by: The Boss | last post by:
Hi All, I am trying to find a way to record when processes on a Unix/Linux system are started and when (i.e. new process ID, parent process ID, spawning user,time) as a way of modeling user...
4
by: Phil Mc | last post by:
Say for example you have a application running on a windows 2003 server (that is on server, not from). This application needs to start child applications (must be stand alone console applications),...
8
by: adserte | last post by:
I have a security related question. I was wondering how i can set up security so that for a table: a user can read all data in the table but only update and delete their own data (there is a...
2
by: jvvhie | last post by:
Hello, I am writing a pure-Python game engine that interprets the code of game objects within the same process with the exec statement. My main goal is to make as much power available as possible...
8
by: mandydhaliwal | last post by:
Hi all, I am porting a win32 c++ program on Linux which first reads a list of processes and their paths from a file.Then this program should launch all of thesese processes. I tried to...
31
by: Nikos Chantziaras | last post by:
Hello. Is there a way to check if the current process has an stdin handle? In the win32 API, one can do: _eof(_fileno(stdin)) Crucial here is that the above doesn't block. Is there a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.