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

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,这将会显示你登录系统的第一个用户。密码是必须的字段,可以任意输入。

 

posted @ 2016-11-14 23:21  励志SQA女  阅读(755)  评论(0编辑  收藏  举报