/security-agent-skills:hunting-ldap-injection-and-bind-trustfrom security-agent-skills
Hunts LDAP injection and bind-trust flaws where untrusted input reaches directory queries or authentication binds. Covers filter metacharacter injection, DN injection, and anonymous/empty-password bind bypasses.
Ships in security-agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
LDAP sits under a great deal of enterprise authentication and lookup, and it has two distinct injection-shaped failures. The first is classic filter and distinguished-name injection: when a request value is spliced into a search filter or a DN without escaping the directory's metacharacters, the attacker rewrites the filter's logic (turning a scoped match into a match-anything clause) or redirects the search to a different subtree. The second is a bind-trust failure: LDAP permits anonymous and unauthenticated binds, and a login flow that binds with an empty password, or treats an anonymous bind as success, authenticates an attacker who supplied no valid credential. You find these by tracing untrusted input into filter and DN construction, and by reading the bind logic for the empty-credential and anonymous cases.
Test LDAP queries and binds only against directories and applications you own or are authorized to assess, on non-production data. A confirming filter can enumerate directory entries outside the intended scope and a bind test touches authentication, so stay inside the authorized boundary. If you can't name the authorization, stop.
Establish the filter, DN, and bind sinks first. Inventory every LDAP search (its filter and base DN) and every authentication bind. This is the false-positive killer: a filter assembled entirely from fixed structure with properly escaped values, and a bind that rejects empty credentials, is not vulnerable. Name the search and bind sinks first.
Trace untrusted input into filter construction. Follow request values into the search filter. If a value is concatenated into the filter string without escaping the LDAP special characters, the attacker can inject a clause: closing the intended predicate and adding a match-anything condition, or altering the boolean logic. Confirm whether each interpolated value is escaped for the filter context.
Trace untrusted input into distinguished names. A DN built from input, a base DN or a bind DN, can be injected to change the subtree searched or the identity bound. DN escaping differs from filter escaping; confirm the correct one is applied where the value lands, because a value safe for a filter may still be unsafe in a DN.
Read the bind logic for anonymous and empty-credential acceptance. LDAP treats a bind with a valid DN and an empty password as an unauthenticated bind that can still return success, and it permits anonymous binds. A login flow that binds and checks only for the absence of an error, without rejecting empty passwords and without distinguishing an authenticated bind, accepts a no-credential login. Confirm the flow requires a non-empty password and treats anonymous or unauthenticated binds as failure.
Check the defenses that actually stop it. Context-correct escaping of every interpolated value (filter escaping for filters, DN escaping for DNs), parameterized or builder-based filter construction, an explicit non-empty-password check before binding, and rejecting anonymous binds in the auth path each remove a vector. A generic input sanitizer that does not match the LDAP context does not. Determine which stands at each sink.
Confirm and record. Confirm by supplying an in-scope input that changes the filter's meaning (a value that makes a scoped search match more than intended) or, for bind trust, an empty or anonymous credential that the flow accepts as a login, without enumerating out-of-scope entries. Kill the lead if every interpolated value is context-correctly escaped or built through a safe API, and the bind path rejects empty passwords and anonymous binds. Record the input, the sink, and the change in filter meaning or the accepted bind.
Confirm. A user-lookup endpoint builds a filter by concatenating the
usernameparameter into the filter string without escaping. A crafted username closes the name predicate and adds a match-anything clause, returning directory entries the endpoint was scoped to hide. The response confirms filter logic injection. Confirmed LDAP filter injection to directory enumeration,high, remediation = escape every interpolated value with the LDAP filter-escaping rules or build the filter through a parameterizing API, and never concatenate raw input into a filter.Kill. Filters are built through a builder that escapes each value for the filter context and DNs through the DN-escaping API, the login flow rejects empty passwords before binding and treats anonymous or unauthenticated binds as authentication failure. A crafted filter value is escaped inert and an empty credential is refused. Killed,
kill_reason= "filters and DNs are context-correctly escaped through safe APIs and the bind path rejects empty-password and anonymous binds; no untrusted value alters the query and no credential-less bind passes as login."
You need every LDAP search with its filter and base DN, every authentication bind, the untrusted inputs that reach each, the escaping applied at each interpolation, and the bind path's handling of empty and anonymous credentials. For each search sink, ask whether an interpolated value is context-correctly escaped; for each bind, whether an empty or anonymous bind can pass as a login. Reading the construction and the bind logic shows the intent; supplying a match-anything value or an empty credential shows whether the boundary holds.
hunting-orm-and-query-builder-injection - the same value-versus-structure distinction in relational
queries; LDAP filters need the same escape-at-the-context discipline.auditing-saml-and-oidc-flows - directory binds often sit behind federation; a bind-trust gap and a
federation gap can both authenticate the wrong principal.finding-fail-open-flaws - an auth bind that treats an anonymous or errored bind as success is a
fail-open decision worth checking alongside this.adjudicating-taint-paths - use it to confirm untrusted input reaches a filter, a DN, or a bind through
framework indirection.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub unboundcompute/security-agent-skills --plugin security-agent-skills194 skills in this plugin
/adjudicating-dependency-cve-reachabilityDecide whether a CVE in a dependency actually exposes your application before you scramble to patch: is the vulnerable function on a real call path from your code, do the trigger preconditions hold, and can an attacker control the input that reaches it. Use when an advisory, SCA scan, or dependency bot flags a CVE and you must separate a genuine exposure from unreachable noise, or justify why you are or are not affected. Covers pinning the vulnerable symbol, call-path reachability, precondition checks, and taint from your entry points./adjudicating-taint-pathsDecide whether a whitebox lead is a real bug by tracing taint from an untrusted source to a dangerous sink and confirming every hop against live source. Use after a scanner, a candidate list, or your own reading surfaces a "this looks dangerous" sink (SQL exec, system/exec, file open, deserialize, template render, redirect target, memcpy) and you must decide whether attacker- controlled input actually reaches it - or kill the lead with evidence. Covers forward and reverse taint, witness paths, sanitizer analysis, and the evidence rules that separate a finding from a false positive.Other plugins' skills for the same job