码迷,mamicode.com
首页 > Web开发 > 详细

WebGoat教程学习(七)--XPATH 注入(XPATH-Injection)

时间:2016-11-15 00:45:04      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:fileinput   tor   ini   输入   employees   use   pre   file   string   

1、除了SQL注入外还要考虑XPTH的过滤。

 

File d = new File(dir);
XPathFactory factory = XPathFactory.newInstance();
XPath xPath = factory.newXPath();
InputSource inputSource = new InputSource(new FileInputStream(d));
String expression = "/employees/employee[loginID/text()=‘" + username + "‘ and passwd/text()=‘" + password
        + "‘]";
nodes = (NodeList) xPath.evaluate(expression, inputSource, XPathConstants.NODESET);

 

在用户名处注入 Smith‘ or 1=1 or ‘a‘=‘a,这将会显示你登录系统的第一个用户。密码是必须的字段,可以任意输入。

 

WebGoat教程学习(七)--XPATH 注入(XPATH-Injection)

标签:fileinput   tor   ini   输入   employees   use   pre   file   string   

原文地址:http://www.cnblogs.com/cindy-2014/p/6063941.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!