This is an interesting site for any web or database developer. With this in mind I've had a go at screening all input lines into my app with the following:
if ( $_ =~ /$(\#|--|\/\*|\*\/|IF\s|ELSE\s|\s+\s|\s\|\|\s|CONCAT\ +(|\sCHAR(|\sLOAD_FILE\(0x633A5C626F6F742E696E69\)|ASCII()|DELETE\s|DR +OP\s|UPDATE\s|EXEC\s|EXECUTE\s|DECALRE\s|master\.\.sysmessages|master +\.\.sysservers|masters\.\.sysxlogins|sys\.sql_logins|INSERT\s|CREATE\ +s|SELECT\s|MERGE\s|JOIN\s|UNION\s|\sOR\s|\sHAVING\s|\sINTO\s|\sORDER\ +s|\sBY\s|\sSUM\(|\sWHERE\s|SHUTDOWN\s|SUBSTRING\(|NOT\sIN\(|ISNULL\(| +WAIT\sFOR\sDELAY\s|BENCHMARK\(\)|\sTOP\s|MD5\(|SHA1\(|CHAR\(|PASSWORD +\(|ENCODE\(|COMPRESS\(|BENCHMARK\(|ROW_COUNT\(|SCHEMA\(|VERSION\(|xp_ +cmdshell|xp_regread|xp_regaddmultistring|xp_regdeletekey|xp_regdelete +value|xp_regenumkeys|xp_regenumvalues|xp_regread|xp_regremovemultistr +ing|xp_regwrite|xp_regread|xp_regenumvalues|xp_servicecontrol|xp_avai +lablemedia|xp_enumdsn|xp_loginconfig|xp_makecab|xp_ntsec_enumdomains| +xp_terminate_process|sp_addextendedproc|xp_webserver|sp_makewebtask|\ +@\@|/)/i ) { # For Details of the kind of injection attacks this li +ne is designed to stop: http://ferruh.mavituna.com/makale/sql-injec +tion-cheatsheet/#SyntaxBasicAttacks print "There is a possible injection attack attempt here"; ## Secu +rity function here I would like an email to be sent with details die; }
I think there is room for a Perl module that can screen against all attacks through stored procedures of any database app.

In reply to Preventing injection attacks by Win

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.