Do Wiser Monks Than I have anything to offer that the article overlooks?

I don't like that in Listing 3 they use backticks. They should have illustrated how to use a safe system() call like:

print system("/bin/whois", $parm);

For that matter, I don't like that they rolled their own way of getting the form parameters. That wheel has been invented.

I don't like this (style, I know :)..

if ($radiobutton =~ m/^(file1|file2|file3)$/)

This isn't a very good regex. Could be better as:

/^file(1|2|3)$/

They say later on..:

Is the CGI script starting subshells? If so, why? Is there a way to accomplish the same thing without starting a subshell?

But in that listing 3, they do start a subshell.

They don't cover safe system calls, preventing users from viewing any file on the system (the common you.com/foo.cgi?file=../../../etc/passwd hole), the Taint.pm and Untaint.pm modules, that -T takes . out of @INC, tainted variables in XS (which is a little different than pure Perl), etc...

I don't believe they mentioned perlsec once.

Do not write a SUID CGI script in a shell scripting language (csh, ksh, etc.). There are too many possible security problems.

Like..?? A pointer to information on why they make this statement would have been good.

I didn't really like the article. They left too much out without even a mention, IMO.

Cheers,
KM


In reply to Re: Safer CGI at SysAdmin by KM
in thread Safer CGI at SysAdmin by ybiC

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.