> Taking chapter from replies,now I've changed my code to: > > #!/usr/bin/perl -T -W > my $key_words; > my $help; > GetOptions('kw=s' => \$key_words, > 'help' => \$help) || usage(); > my @args = ($Keywords,....); > my @cmd = ("$JAVA", > "-search.home=$SEARCH_HOME", > "Searcher", > @args); > system(@cmd) == 0) ||error(); > > Need I be more paranoid than this and use my own regex to filter out > keywords my self? Well, since that's pseudo code and not complete, I can't be sure what you're saying. "...." is not valid perl. What you have above would safely make sure that the user input is not processed by the shell. However I have no idea if those values could be used to break the program itself ($JAVA). If this program were running with greater privs (suid, CGI, etc) then they can supply a new $SEARCH_HOME path then they could cause their own code to run. If there are bad keywords then you aren't doing anything to get rid of them. (Or, preferably, only allowing good keywords.) Without knowing what you're actually running, I can't say it's secure. But you do successfully keep the shell from interpreting the user input, and that's a good step. -- Brian Hatch "Ugly and old, yes? Then Systems and their families must be Security Engineer both rich and powerful." http://www.ifokr.org/bri/ Every message PGP signed
This archive was generated by hypermail 2b30 : Thu Jan 23 2003 - 15:23:17 PST