Skip to content

MIR0809

TaintedXpath

User-controlled input reaches DOMXPath::query(), DOMXPath::evaluate() or SimpleXMLElement::xpath(), risking XPath injection.

<?php
$xpath->query("//user[name='" . $_GET['name'] . "']"); // TaintedXpath

Validate the value against a strict format, or compare it in PHP after selecting candidate nodes with a fixed expression.