Re: Can System() of Perl be bypassed?
From: Brian Hatch (secprog@ifokr.org)
Date: 01/23/03
- Previous message: Valdis.Kletnieks@vt.edu: "Re: Standards for developing secure software"
- In reply to: Sandeep Giri: "Re: Can System() of Perl be bypassed?"
- Next in thread: Luciano Miguel Ferreira Rocha: "Re: Can System() of Perl be bypassed?"
- Reply: Luciano Miguel Ferreira Rocha: "Re: Can System() of Perl be bypassed?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Thu, 23 Jan 2003 14:15:43 -0800 From: Brian Hatch <secprog@ifokr.org> To: Sandeep Giri <sandeepgiri@indiatimes.com>
> 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
- application/pgp-signature attachment: stored
- Next message: Gustaf Bjorksten: "RE: Standards for developing secure software"
- Previous message: Valdis.Kletnieks@vt.edu: "Re: Standards for developing secure software"
- In reply to: Sandeep Giri: "Re: Can System() of Perl be bypassed?"
- Next in thread: Luciano Miguel Ferreira Rocha: "Re: Can System() of Perl be bypassed?"
- Reply: Luciano Miguel Ferreira Rocha: "Re: Can System() of Perl be bypassed?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|