comments on input attack artile
I should probably do this tomorrow after sleeping so I can actually write
and run test code, but I just saw the article now so...
On page 1:
First, don't most people use VBscript to write ASP pages or maybe its just
me? (Yeah, I know its a minor point but it has more importance later on)
SELECT count(*) FROM client WHERE (name='x' or 1) or ('1')
Something's not right about the SQL statement. At least Query Analyzer on
MS SQL 7 doesn't like it with name being a varchar in a database called
client. It didn't produce any useful error message though (SELECT
count(*) FROM client by itself worked fine) But then you were using an
So the SQL statement will fail passing control to the catch part of your
code denying access
the value of count(*) will always be one or greater
No. If the table is empty how could it return something? (this is assuming
a good SQL statement)
You said to change the 500-100 error message in order to not send
information to a possible hacker. Wouldn't the better solution be to change
the option in the IIS control panel under "Application Configuration" to
"Send text error message to client" instead of the default "Send detailed
ASP error messages to client"
It would seem like the more built in method would be better.
This is where the differences between VBscript and Jscript are big.
First VBscript needs to create the RegEx object which Jscript doesn't need
so someone who uses VBscript and doesn't use regular expressions may have a
problem converting it.
Second, VBscript doesn't use / to make the end and beginning of the regular
expression but "
So it may be useful to point out the differences or at least that there are
differences more then putting a semicolon at the end of the line
if (strName.search(/[^A-Za-z 0-9]/) != -1) return false;
This code will search strName and if it contains anything other than
uppercase letters, lowercase letters, whitespace , or numbers (that's what
the ^ means), then the input is rejected.
Isn't it better style to use:
if (strName.match(/^[a-z 0-9]*$/i) = Null) return false;
Since that way your saying what the string has to be made up of instead of
what it can have in it. Then again I think I'm getting too tired from it
being late and converting between jscript and VBscript.
Shouldn't you not depend on the order the SQL server gives you the data? So
shouldn't be used and should be oRS('name')
You know there seemed to be real errors before I figured out how Jscript
works in terms of regular expressions.
Now if only it was possible to right a regular expression for a URL without
false bad matches. Its so hard to make good regular expressions that aren't
more restrictive then they have to be.
Re: comments on input attack artile
"Eli Allen" <firstname.lastname@example.org> wrote:
yeah, there's a typo in the SQL statement. i'll fine tune the code tonite
and get the update posted.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL