| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Lecture - SQL Injection Attack

Page history last edited by Dr. Ron Eaglin 11 years, 1 month ago

  SQL Injection Attack

 

Summary of Video

 

Demonstrates a SQL Injection Attack and how to prevent these.

 

Prerequisites

 

Working knowledge of SQL and Stored Procedures

 

Video Link

 

 

http://online1.daytonastate.edu/player2.php?id=59dfa2df42d9e3d41f5b02bfc32229dd

 

 

Support Materials

 

http://msdn.microsoft.com/en-us/library/ms161953%28v=sql.105%29.aspx - MSDN Article on SQL Injection

 

CREATE TABLE Students (
id INT PRIMARY KEY IDENTITY(1,1),
FirstName NVARCHAR(200),
LastName NVARCHAR(200))
INSERT INTO Students ('John', 'Doe')
 
CREATE PROCEDURE sp_SelectStudent (
 @StudentName VARCHAR(200)
 )
AS
BEGIN
 SELECT * FROM Students WHERE FirstName = @StudentName
END
GO
EXEC sp_SelectStudent 'John'
EXEC sp_SelectStudent 'John'';  EXEC sp_HelpUser --'
ALTER PROCEDURE sp_SelectStudent2 (
 @StudentName VARCHAR(200)
 )
AS
BEGIN
 DECLARE @Query NVARCHAR(500)
 SET @Query = 'SELECT * FROM Students WHERE FirstName = ''' + @StudentName + ''''
 PRINT @Query 
 EXECUTE(@Query)
END
GO
CREATE TABLE Sacrifice (
 id INT PRIMARY KEY, 
 Field1 NVARCHAR(200)
 )
EXEC sp_SelectStudent2 'John'
EXEC sp_SelectStudent2 'John'';  DROP TABLE Sacrifice --' 
EXEC sp_SelectStudent2 'John'';  EXEC sp_HelpUser --' 
  

 

 

 

All Materials Copyright 2012 Dr. Ron Eaglin

Comments (0)

You don't have permission to comment on this page.