A week ago, we noticed in our error logs that some one was using SQL injection to walk our database tables - they didn't get far, as our operations group has alerts that notify them when things of this nature happen, and they cut the attack off at the fire wall about 5 minutes after it started - the attacker got some table names and that was it. The ops group also fixed the problem by changing the web.config file (it was set to show errors to remote users instead of sending them to the nice error screen oops).
Our development group is going to also going to impliment some sanity checks on querystring values at critical points in the code - we can't rewrite the entire system to use stored proceedures and paramaterized queries at this time - as we work on old areas of the code however, we are making these changes and all new code is coded using paramterized queries.
So my question is this, I need a Regular Expression that will allow any valid character 0-9 A-Z (and lower case) _ (Underscore) and . (period) but NOT allow the words SELECT, DELETE, UPDATE.
I've found this regular expression that would get a match on SELECT, DELETE, UPDATE and SCRIPT and some others
What I would like to do is combine that so it says take any character that's valid and the characters don't match SELECT etc.... Is this even possible? If I have to I can do it in two steps.. but one would be prefereable.
Thanks in advance.
Rick
Our development group is going to also going to impliment some sanity checks on querystring values at critical points in the code - we can't rewrite the entire system to use stored proceedures and paramaterized queries at this time - as we work on old areas of the code however, we are making these changes and all new code is coded using paramterized queries.
So my question is this, I need a Regular Expression that will allow any valid character 0-9 A-Z (and lower case) _ (Underscore) and . (period) but NOT allow the words SELECT, DELETE, UPDATE.
I've found this regular expression that would get a match on SELECT, DELETE, UPDATE and SCRIPT and some others
Code:
(script)|(<)|(>)|(%3c)|(%3e)|(SELECT) |(UPDATE) |(INSERT) |(DELETE)|(GRANT) |(REVOKE)|(UNION)|(&lt;)|(&gt;)
What I would like to do is combine that so it says take any character that's valid and the characters don't match SELECT etc.... Is this even possible? If I have to I can do it in two steps.. but one would be prefereable.
Thanks in advance.
Rick