473,761 Members | 10,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I create an innocuous SQL injection attempt to test apps and evaluate the result programmaticall y?

There are assorted "SQL Injection vulnerability assessment tools" out there.
They scan your site and send your report. They also take your money.

We don't have the money so I was wondering if I could replicate the tool's
behavior myself. I am guessing that they work by attempting a
non-destructive injection attack against your DB and evaluating the success
or failure of that test.

I am curious if a) I'm correct about this, and b) if anyone could suggest a
starting point for a "safe" injection test and an evaluation of the result
using C# / ASP.NET.

Thanks,
-KF
Mar 16 '07 #1
7 2572
Some examples of SQL injection can be found here:
http://msdn.microsoft.com/msdnmag/is.../SQLInjection/

Anyway, if you follow the guidelines here
http://msdn2.microsoft.com/en-us/library/ms998271.aspx (like use the
SQLParameter object to pass the parameters), your program should not be
vulnerable to common SQL injection.

<ke*****@nospam .nospam¼¶¼g©ó¶l ¥ó·s»D:%2****** **********@TK2M SFTNGP06.phx.gb l...
There are assorted "SQL Injection vulnerability assessment tools" out
there. They scan your site and send your report. They also take your
money.

We don't have the money so I was wondering if I could replicate the tool's
behavior myself. I am guessing that they work by attempting a
non-destructive injection attack against your DB and evaluating the
success or failure of that test.

I am curious if a) I'm correct about this, and b) if anyone could suggest
a starting point for a "safe" injection test and an evaluation of the
result using C# / ASP.NET.

Thanks,
-KF

Mar 16 '07 #2
Thank you for your links. I understand the nature of SQL injection and how
to safeguard against it using the common methods: string checking, type
checking, white listing, blacklisting, various mechisms associated with the
database and database interactions.

What I'm looking for now is a safe way to scan sites for vulnerabilities ,
just as those expensive tools do. This would help people who know very
little, or who are non-technicians: they can at least recognize that they
have a problem. I need to know how to perform a non-destructive check, and
to evaluate the success or failure of my non-destructive check. My purpose
here is to write some code and maybe even an open-source tool that people
could use to check sites for SQL injection vulnerabilities .

-KF

"Lau Lei Cheong" <le****@yehoo.c om.hkwrote in message
news:Ok******** ******@TK2MSFTN GP03.phx.gbl...
Some examples of SQL injection can be found here:
http://msdn.microsoft.com/msdnmag/is.../SQLInjection/

Anyway, if you follow the guidelines here
http://msdn2.microsoft.com/en-us/library/ms998271.aspx (like use the
SQLParameter object to pass the parameters), your program should not be
vulnerable to common SQL injection.

<ke*****@nospam .nospam>
¼¶¼g©ó¶l¥ó·s»D: %2************* ***@TK2MSFTNGP0 6.phx.gbl...
>There are assorted "SQL Injection vulnerability assessment tools" out
there. They scan your site and send your report. They also take your
money.

We don't have the money so I was wondering if I could replicate the
tool's behavior myself. I am guessing that they work by attempting a
non-destructive injection attack against your DB and evaluating the
success or failure of that test.

I am curious if a) I'm correct about this, and b) if anyone could suggest
a starting point for a "safe" injection test and an evaluation of the
result using C# / ASP.NET.

Thanks,
-KF


Mar 16 '07 #3
the easiest test is to enter a single ' into each form field. if you get
a sql syntax error on postback you have an open door.

-- bruce (sqlwork.com)

ke*****@nospam. nospam wrote:
There are assorted "SQL Injection vulnerability assessment tools" out there.
They scan your site and send your report. They also take your money.

We don't have the money so I was wondering if I could replicate the tool's
behavior myself. I am guessing that they work by attempting a
non-destructive injection attack against your DB and evaluating the success
or failure of that test.

I am curious if a) I'm correct about this, and b) if anyone could suggest a
starting point for a "safe" injection test and an evaluation of the result
using C# / ASP.NET.

Thanks,
-KF

Mar 16 '07 #4
"bruce barker" <no****@nospam. comwrote in message
news:Ol******** ********@TK2MSF TNGP05.phx.gbl. ..
the easiest test is to enter a single ' into each form field. if you get a
sql syntax error on postback you have an open door.
Indeed. In fact, of all the SQL Injection testing sites I've seen, this is
pretty much the first thing they try...
Mar 16 '07 #5
Thanks, guys.

In .NET/C#, do you know approximately how you would test for the return of a
SQL syntax error? Does it return some kind of error code that could be
captured and evaluated by the app, or is another approach going to be
required?

Does anyone know of other tests that SQL Injection test suites commonly do
besides what Bruce and Mark suggested?

Thanks, this is helpful.

-KF

"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:uZ******** ********@TK2MSF TNGP02.phx.gbl. ..
"bruce barker" <no****@nospam. comwrote in message
news:Ol******** ********@TK2MSF TNGP05.phx.gbl. ..
>the easiest test is to enter a single ' into each form field. if you get
a sql syntax error on postback you have an open door.

Indeed. In fact, of all the SQL Injection testing sites I've seen, this is
pretty much the first thing they try...

Mar 16 '07 #6
<ke*****@nospam .nospamwrote in message
news:ON******** ********@TK2MSF TNGP03.phx.gbl. ..
In .NET/C#, do you know approximately how you would test for the return of
a SQL syntax error?
try
{
// ADO.NET code
}
catch (SqlException ex)
{
// handle the error
}
Mar 16 '07 #7

Thank you Mark. A super-helpful first step.

-KF
"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:%2******** **********@TK2M SFTNGP05.phx.gb l...
<ke*****@nospam .nospamwrote in message
news:ON******** ********@TK2MSF TNGP03.phx.gbl. ..
>In .NET/C#, do you know approximately how you would test for the return
of a SQL syntax error?

try
{
// ADO.NET code
}
catch (SqlException ex)
{
// handle the error
}

Mar 16 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4995
by: RL | last post by:
Hello Perl gurus, 1. I have a web page where I can push a button (dospawn.html). 2. This button calls a CGI script (spawnboss.cgi) 3. spawnboss.cgi calls a forking perl script (forkme.pl) 4. forkme.pl calls the process creation script (createme.pl) 5. createme.pl creates my notepad.exe process, but no window shows up on my PC. The result on my web browser is:
7
2511
by: Rolf Kemper | last post by:
Dear All, somehow I remember that such or similar question was discussed already somewhere. But I can't find it anymore. I have a template calling itself. As long it goes deeper into the hierarchy (by the key) I can set the CurrentY parameter by itself + some constant correctly. Hence which each call the CurrentY gets bigger. But when the template reaches a leave and the caller is poped from
6
1861
by: Jan Roland Eriksson | last post by:
For those interested, read and rip it up as you wish :-) ===== Archive-name: www/stylesheets/newsgroup-faq Posting-Frequency: twice a week (mondays and thursdays) Last-modified: July 20, 2004 Version: 2.00 URL: <http://css.nu/faq/ciwas-mFAQ.html> Maintainer: Jan Roland Eriksson <rex@css.nu>
13
33863
by: Zeng | last post by:
Hello, Please help!!! I've been stuck on this issue for months. I just wonder if there is a way to programmatically evaluate expression strings such as ( ( 3 + 5 ) / 2 ) > 4 --> this should return 0 or false( ( 3 + 6 ) / 3 ) > ( ( 5 + 3 ) / 4 ) --> this should return 1 or trueThanks for any comment or
2
1972
by: freddy | last post by:
I would like to get more information on securing my windows apps from SQL injection attacks. There is so much stuff on web apps, but I can't find info on win apps. Can you help me
4
2198
by: ss | last post by:
hi, can anybody gives me a sample code where the sql injection attack is validated. how can i do that in business logic layer and pass the error to the presentation tier I want the sample code
8
3862
by: stirrell | last post by:
Hello, One problem that I had been having is stopping email injections on contact forms. I did some research, read up on it and felt like I had created a working solution. I hadn't gotten any suspicious bouncebacks in quite some time and got many custom alerts I had set up for notifying me of injection attempts. However, just the other day, I got a bounceback from an AOL address which leads me to believe that an injection attempt was...
23
7416
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these in an array. The application compiles but aborts without giving me any useful information. What I suspect is happening is infinite recursion. Each Directory object creates an array of Subdirectories each of which has an array of...
0
2325
by: grbCPPUsr | last post by:
I am new to Python. I would like to use Python for the specialized purpose of dynamic expressions parsing & evaluation in my C++ application. I would like to encapsulate the expressions to be evaluated in Python function & compile that function at runtime, somewhat as below. Expression to eval put in Python function def isSizeSmall(size,vol,ADV,prod): if ( (size < 1000) & (vol < (0.001 * ADV)) & (prod=="Stock")): print "OK"; return 10 ...
0
9333
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10107
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9900
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8768
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5361
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3863
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3442
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.