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!
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.