Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I get SQL injection attack from SELECT statement?

2 Questions actually:

I know i must use Stored Procedures as much as Possible, but i would like to know the following please.

A: Can i get a SQL Injection attack from a SELECT statement such as (Select * from MyTable) ?

B: Also, can i get a SQL Injection attack when I use the SQLDataSource in ASP.NET?

like image 358
Etienne Avatar asked Jul 08 '09 17:07

Etienne


1 Answers

You can get an SQL injection attack anytime that you are not using parameterized queries, for the most part.

If your example,

 SELECT * from MyTable

there isn't any user-inputted data, so that should be fine. However, something like:

 SELECT * from MyTable WHERE name='x'

(x being a parameter) then there's a chance that someone injects some SQL into their name.

B: ASP.NET uses parameterized queries because it builds the query based on the parameters that you provide programmatically.

like image 130
Chris Thompson Avatar answered Oct 19 '22 04:10

Chris Thompson