Descrizione
XML::Sig versions before 0.71 for Perl allow XPath injection in ID lookup.
verify() and _get_signed_xml() in lib/XML/Sig.pm build XPath expressions by concatenating the SignedInfo/Reference/@URI value read from the document being verified. The value is neither escaped nor checked against the NCName grammar that XML requires of an ID, so a URI containing a single quote closes the string literal in the generated expression and appends arbitrary XPath operators.
A crafted URI can make the lookup match elements the reference does not name, or every element in the document, so which node is selected for digest verification is decided by the injected expression rather than by the reference.
Tipo di vulnerabilità
CWE-643
Improper Neutralization of Data within XPath Expressions
The product uses external input to dynamically construct an XPath expression used to retrieve data from an XML database, but it does not neutralize or incorrectly neutralizes that input.
Impatto sui sistemi
| Ambito | Impatto |
| Controllo degli accessi |
Aggirare i meccanismi di protezione |
| Riservatezza |
Leggere i dati dell’applicazione |
Come si previene
Sviluppo
Use parameterized XPath queries (e.g. using XQuery). This will help ensure separation between data plane and control plane.
Sviluppo
Properly validate user input. Reject data where appropriate, filter where appropriate and escape where appropriate. Make sure input that will be used in XPath queries is safe in that context.
Tutte le 14 CVE di tipo CWE-643, con andamento e prevenzione