I'm evaluating the possibility of doing SQL injection for my sp.
I have tried using this to do SQL injection but didn't manage to inject (meaning the injection text was inserted to table as per normal):
data'; DROP TABLE my_table; --
How should I try SQL injection? Or the SP is so safe that SQL Injection is prevented somehow?
My reduced SP as below:
@ID int,
@AIType varchar(1),
@parent varchar(20),
@child varchar(20),
AS
BEGIN
SET NOCOUNT ON;
-- Insert statements for procedure here
BEGIN TRY
UPDATE AI_Grouping
SET AIType=@AIType,
parent=@parent,
child=@child,
WHERE ID=@ID
END TRY
BEGIN CATCH
-- Catch exceptions
END CATCH
END
EDIT:
In case it helps - at front end, I have a field length validation which is consistent with SP variable type. Some fields are limited max 8 chars, some are max 20 chars (like above example). Maybe the injection example that I tried above is a bad example, because the length is more than 20 chars... The ultimate question is, is my SP vulnerable to SQL injection or not?