Skip to main content

Parameterized Query a countermeasure for SQL Injection

Introduction:


What is a SQL Injection?

SQL Injection is a technique of passing SQL commands to backend database through web application by accepting the unvalidated inputs from form, URLS etc.

 

What is an Impact of SQL injection?

 An Attacker can take advantage of SQL injection to dump the database and also can pass the commands to database which results in DOS i.e shutting down the database or droping the important tables in the database.

How can we Mitigate?

One can mitigate the SQL injection with the use of Parameterized query.

What is Parameterized query?

A parameterized query is a type of SQL query that requires at least one parameter for execution. A placeholder is normally substituted for the parameter in the SQL query. The parameter is then passed to the query in a separate statement.
  


The following is an example of an ADO.NET parameterized query:

SELECT LastName FROM Contacts WHERE ContactID = @ContactID;

@ContactID is the parameter for this query, which might be defined in a subsequent statement similar to the following:

command.Parameters.Add(new SqlParameter("@ContactID", theContactID));


 


Comments

Popular posts from this blog

Android Damn Vulnerable App by Security Compass

Tutorial of Android Damn Vulnerable App by Security Compass Introduction: Hi folks, today I am gonna show you some hands on or tutorial of the android app testing which I done during my R&D of android app security testing. Here I will show you from scratch setting up of Lab Server to testing of application. In this you will learn on below topics: 1)Insecure Connection (Traffic over HTTP) 2)Server Side Authorization Issue 3)Insecure File Storage 4)Insecure Logging 5)Encryption of data on device 6)Memory Protection Setting-up of lab (App & Server) First of all you have to download the base app which is damn vulnerable from here . After downloading zip and extracting it you have to build it in .apk format using Eclipse IDE. Now you have to install the app in the emulator before that you have to make sure that you installed SDK and its packages. To install the app you have to start emulator using AVD and clicking on "Start" or by command line emul...

Damn Vulnerable Android Application by Security Compass - Lab 6 Advanced Encryption

Lab 6 Advanced Encryption  Today we are going to see the solution of basic encryption post in that no encryption was used for sensitive info. The solution is implementing the encryption and that we will try to bypass the encryption implementation as some times the developers store the hardcoded encryption key in the app itself. For this you need to install the BasicEncryptionSolution.apk. Now start this app and configure the credentials.   Now app is configured and credentials are also stored as per design in preferences.xml but I am expecting some sort of encryption now as we have installed solution for this flaw. Browse to the /data/data/com.securitycompass.androidlabs.basicencryptionsolution/shared_prefs as you can see that all the credentials are encrypted. So now we go and disassemble the app and try to figure out is there any key hardcoded key in the app. You can disassemble the app by using EasyApkDisassembler to...

Nmap Cheat Sheet / Nmap Commands with examples

Nmap Cheat Sheet NMAP Commands Goal Command Example Scan a Single Target nmap [target] nmap 192.168.0.1 Scan Multiple Targets nmap [target1, target2, etc] nmap 192.168.0.1 192.168.0.2 Scan a List of Targets nmap -iL [list.txt] nmap -iL targets.txt Scan a Range of Hosts nmap [range of ip addresses] nmap 192.168.0.1-10 Scan an Entire Subnet nmap [ip address/cdir] nmap 192.168.0.1/24 Scan Random Hosts nmap -iR [number] nmap -iR 0 Excluding Targets from a Scan nmap [targets] --exclude [targets] nmap 192.168.0.1/24 --exclude 192.168.0.100, 192.168.0.200 Excluding Targets Using a List nmap [targets] --excludefile [list.txt] nmap 192.168.0.1/24 --excludefile notargets.txt Perform an Aggressive Scan nmap -A [target] nmap -A 192.168.0.1 Scan an IPv6 Target nmap -6 [target] nmap -6 1...