Yesterday, one of my students in a
Learning Perl class
at $VERY_LARGE_COMPANY brought in some production code that she had inherited and wanted me to help decipher.
My jaw hit the floor when I saw:
use CGI::Carp qw(fatalsToBrowser);
my $cgi = new CGI;
my $p_type = $cgi->param('p_type');
die "\$someobject->make_$p_type failed: $@";
In other words, not only was unchecked data from a form field (presumably from a pop-up menu or radio button) being used directly in an eval
, but quite helpfully, the syntax errors were being sent back to the browser to help you refine your breakin!
(And I looked hard for some sort of screening or
vetting of the $p_type
value, and there
And this is live code, in production, on a customer-facing website that gets thousands of hits a minute.
And thanks to cutbacks, the owner of this code is someone who now has just barely taken her first Perl
instruction from me, and has changes to make to the site within the next two weeks; thus she doesn't have time
to take my PROM class, but must change code riddled
with objects and references and modules, and as
you see here, security holes the size of Kansas.
Is there really that lack of clues out there?
I don't know whether to be more scared or saddened.
-- Randal L. Schwartz, Perl hacker
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||