SQL includes a simple stored procedure, sp_who that allows for fast monitoring of SQL server resources by examining active and inactive SQL processes. Even with an efficient facade and coding style, sp_who can be used to assess performance in several different ways:
Consider the following two examples:
Dim UserInput As String = "1'); DELETE FROM tblInjectionAttack;"
Dim SQL As String
SQL = "INSERT INTO tblInjectionAttack (Column1) VALUES ('" & UserInput & "')"
CREATE PROCEUDRE InsertInjection @UserInput NVARCHAR(500) AS INSERT INTO tblInjectionAttack (Column1) VALUES (@UserInput) --EXEC InsertInjection '1''); DELETE FROM tblInjectionAttack;'
In the first example, the SQL query will be injected and the attacker will be able to execute any command that they have access to. In the second example, the attacker’s SQL injection will be saved in Column1 and won’t be executed at all.
If you create a new user in a database, by default, that user has no privileges; however, if you need to remove existing privileges from an account, you can do so by executing the following query:
[sourcecode language="sql"]
–To deny access on one single table:
DENY SELECT,INSERT,UPDATE,DELETE ON [TableName] TO [Username]