Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Well, the good news is that you use CGI.pm. The bad news is that you don't use it.

You shouldn't scrub the query string directly; let CGI.pm deal with that. In fact, your initial tr/// of the query string completely breaks most requests. Moreover, if you were to add needed characters like [%&?] to your regex, it still would be unsafe, because of the unescaping performed by CGI.pm. Now, onto the following line:

$temp =~ s/\.+\///g;

Remember what you've been told regarding code checks for specific hacks. It's never something you should do, and that is what you are doing here. Consider how this expression would perform if given "..\..\" instead of "../../" on an NT platform- you can't possibly check for all the sploits, so don't even try. It would only serve to make your code more complex, buggy, and insecure. Now, moving on to this comment:

#you may now use the CGI methods.
You can always use the CGI.pm methods. CGI.pm is quite secure, and neeedn't launder any raw request data before it gets to see it. Launder the data that you get back from CGI.pm.

Also, as a matter of style, you should consider using CGI.pm's functions like print $query->header for some of your code. There's really no need to type alot that stuff out.

   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

In reply to Re: Second hack at Secure Mailer by MeowChow
in thread Second hack at Secure Mailer by SilverB1rd

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2022-12-07 05:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?