Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Calling external programs via cgi on win32

by paulbort (Hermit)
on Jul 02, 2004 at 18:34 UTC ( [id://371478]=note: print w/replies, xml ) Need Help??


in reply to Calling external programs via cgi on win32

I've said before, and I'll say again: this is a dangerous design and should not be used.

This kind of code gives anyone with a web browser complete access to your system. If you want users to be able to run specific programs, have the CGI write commands to a queue somewhere (files in a directory, registry entries, database rows, whatever), then have a second program that runs in the background (as a service maybe) pick up the queue entries and execute them.

This gives you two big wins right off the bat: First, your web server doesn't need any special privileges, it just needs to be able to write to your queue. Second, when you later get hacked and decide you want to limit the commands that can be run, the back-end script is the only part you need to change.

Even if you're doing this on an isolated system, that no one can acces from a network, it's still worthwhile to think about security and isolation in every program. These are good programming habits that will serve you well all of your days.

--
Spring: Forces, Coiled Again!

Replies are listed 'Best First'.
Re^2: Calling external programs via cgi on win32
by jamesjyu (Acolyte) on Jul 03, 2004 at 02:35 UTC
    Thank you paulbort, I took your advice, and all is well now.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://371478]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-03-28 11:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found