Beefy Boxes and Bandwidth Generously Provided by pair Networks chromatic writing perl on a camel
Perl: the Markov chain saw
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
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; use CGI::Carp qw(fatalsToBrowser); my $cgi = new CGI; ... my $p_type = $cgi->param('p_type'); ... eval "\$someobject->make_$p_type(\$some,\@args)"; 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 was none.)

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


In reply to Web Security by merlyn

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!
  • 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, 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
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (5)
    As of 2014-04-21 02:39 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (489 votes), past polls