zoukankan      html  css  js  c++  java
  • xpath injection

    The d parameter appears to be vulnerable to XPath injection attacks.
    The t parameter appears to be vulnerable to XPath injection attacks.
    The URL path filename appears to be vulnerable to XPath injection attacks.

    https://owasp.org/www-community/attacks/XPATH_Injection

    Suppose we have a user authentication system on a web page that used a data file of this sort to login users. Once a username and password have been supplied the software might use XPath to look up the user:

    VB:
    Dim FindUserXPath as String
    FindUserXPath = "//Employee[UserName/text()='" & Request("Username") & "' And
            Password/text()='" & Request("Password") & "']"
    
    C#:
    String FindUserXPath;
    FindUserXPath = "//Employee[UserName/text()='" + Request("Username") + "' And
            Password/text()='" + Request("Password") + "']";
    

    With a normal username and password this XPath would work, but an attacker may send a bad username and password and get an XML node selected without knowing the username or password, like this:

    Username: blah' or 1=1 or 'a'='a
    Password: blah
    
    FindUserXPath becomes //Employee[UserName/text()='blah' or 1=1 or
            'a'='a' And Password/text()='blah']
    
    Logically this is equivalent to:
            //Employee[(UserName/text()='blah' or 1=1) or
            ('a'='a' And Password/text()='blah')]
    

    In this case, only the first part of the XPath needs to be true. The password part becomes irrelevant, and the UserName part will match ALL employees because of the “1=1” part.

  • 相关阅读:
    Redis面试题
    redis基本操作
    pwd命令和cd命令
    ls命令详解
    Python时间操作所相关
    Nginx
    网络相关知识
    LeetCode 刷题记录(6-10题)
    绕过校园网Web认证
    Java相关知识
  • 原文地址:https://www.cnblogs.com/chucklu/p/15147730.html
Copyright © 2011-2022 走看看