XPATH injection
XPath Injection is an attack technique used to exploit applications that construct XPath (XML Path Language) queries from user-supplied input to query or navigate XML documents.
Info about how to make queries: https://www.w3schools.com/xml/xpath_syntax.asp
Basic Syntax
Nodes
Examples:
Predicates
Unknown Nodes
Examples:
Example
pepe peponcio admin mark m12345 regular fino fino2 regularAll names - [pepe, mark, fino]name//name//name/node()//name/child::node()user/nameuser//name/user/name//user/nameAll values - [pepe, peponcio, admin, mark, ...]//user/node()//user/child::node()Positions//user[position()=1]/name #pepe//user[last()-1]/name #mark//user[position()=1]/child::node()[position()=2] #peponcio (password)Functionscount(//user/node()) #3*3 = 9 (count all values)string-length(//user[position()=1]/child::node()[position()=1]) #Length of "pepe" = 4substrig(//user[position()=2/child::node()[position()=1],2,1) #Substring of mark: pos=2,length=1 --> "a"Authentication Bypass
Example of queries:
OR bypass in user and password (same value in both)
Abusing null injection
Double OR in Username or in password (is valid with only 1 vulnerable field)
IMPORTANT: Notice that the "and" is the first operation made.
The output contains strings and the user can manipulate the values to search:
Blind Explotation
Get length of a value and extract it by comparisons:
Example:
References
https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/XPATH%20injection
最后更新于
这有帮助吗?