High severityC#InjectionMEDIUM confidence
LDAP Filter Concatenation
An LDAP search filter is built by concatenating/interpolating a runtime value into the filter string (CWE-90).
Standards mapping
- OWASP Top 10
- A03:2021 - Injection
- OWASP ASVS
- V5.3.7 (L1)
Vulnerable vs. safe
Flagged by this check
var ds = new DirectorySearcher($"(uid={uname})", null);Passes - the safe pattern
var ds = new DirectorySearcher("(uid=admin)", null);Why it matters & how to fix it
An LDAP search filter is built by concatenating/interpolating a runtime value into the filter string (CWE-90). Attacker input can alter the filter logic and bypass access controls. Escape each value per RFC 4515 before inserting it (e.g. via a filter-encoding helper) or use a fixed, validated filter template.
References
Rule ID integsec.csharp.injection.ldap-filter-concat - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - InjectionCode Injection Tainted Input
- JavaScript / TypeScript - InjectionEval Dynamic Argument
- JavaScript / TypeScript - InjectionNoSQL Query From Request
- JavaScript / TypeScript - InjectionNoSQL Where Operator
- JavaScript / TypeScript - InjectionOS Command Injection Tainted Input
- JavaScript / TypeScript - InjectionSQL Injection String Concatenation