LDAP queries that use unsanitized inputs might allow attackers to inject unwanted elements into the query, allowing attackers to read or modify sensitive data, run code, and perform other unwanted actions.
Non-Compliant Code Examples
fromflaskimportFlask,requestapp=Flask(__name__)@app.route("/login",methods=["POST"])deflogin():data=request.get_json()username=data.get("username","")password=data.get("password","")# Not compliantldap_filter=f"(&(uid={username})(userPassword={password}))"returnf"Filter: {ldap_filter}"