XPath Advanced Data Exfiltration

XPath Advanced Data Exfiltration Notes

1. Understanding XPath Injection

  • XPath is used to query XML data.

  • Injection occurs when user input is inserted into an XPath query without proper sanitization.

  • Common attacks include authentication bypass, data extraction, and blind XPath injection.

2. Successful Payload Analysis

  • The working payload:

    GET /index.php?q=SOMETHINGINVALID&f=fullstreetname+|+/*[1]/*[2]/*[3]/*[1]/*[3]
  • The | (union operator) allowed traversal through multiple XML nodes.

  • The nested /*[1]/*[2]/*[3]/*[1]/*[3] structure accessed deeper elements in the XML hierarchy.

3. Additional Exploration

Extract Full XML Structure

  • Try dumping all available XML elements:

    GET /index.php?q=SOMETHINGINVALID&f=| //*
  • Navigate deeper step by step:

    GET /index.php?q=SOMETHINGINVALID&f=| /*/*/*/*

Extract Multiple Fields

  • To retrieve multiple values at once:

Extract Usernames and Passwords

  • List all users:

  • Extract credentials:

4. Blind XPath Injection

Boolean-Based Extraction

  • Check if a username starts with ‘A’:

Automated Character-by-Character Extraction

5. Advanced Attacks

Time-Based Blind Injection

  • If there’s no direct output, force longer responses:

Testing for XXE Injection

  • If the response includes file contents, the server is vulnerable.

Out-of-Band (OOB) Data Exfiltration

  • If the server contacts your external URL, it confirms an OOB vulnerability.

Conclusion

  • XPath injection was successfully exploited.

  • Additional attacks were tested for further enumeration.

  • Blind extraction techniques and external entity vulnerabilities were explored.

Last updated