Unsanitized user input in XPath

Description

Unsanitized user input in XPath expressions can result in XPath injection. This vulnerability occurs when user input is directly used in XPath queries without proper sanitation, potentially granting unauthorized access to sensitive data within XML documents.

Remediations

  • Do not directly use user input in XPath expressions. This can lead to XPath injection vulnerabilities.
  • Do sanitize user input before including it in XPath queries. Ensure that any data derived from user input is properly cleaned to prevent injection attacks.

References

Associated CWE

OWASP Top 10

Configuration

To skip this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --skip-rule=php_lang_xpath_injection

To run only this rule during a scan, use the following flag

bearer scan /path/to/your-project/ --only-rule=php_lang_xpath_injection