Skip to content

MIR0808

TaintedLdap

User-controlled input reaches the base DN or filter of ldap_search(), ldap_list() or ldap_read(), risking LDAP injection.

<?php
ldap_search($ldap, 'dc=example,dc=com', '(uid=' . $_GET['user'] . ')'); // TaintedLdap

Escape the value with ldap_escape() using the LDAP_ESCAPE_FILTER or LDAP_ESCAPE_DN flag.