Ldap injection

From zakirkun/ice-tea · View interactive version

Ldap injection is an AI agent skill from the GitHub repository zakirkun/ice-tea. Detects LDAP queries constructed from user input without proper escaping, enabling authentication bypass and data exfiltration.

How to use this skill

Skill file

LDAP Injection

Overview

LDAP injection occurs when user-controlled input is incorporated into LDAP search filters without sanitization. Attackers can:

Detection Strategy

Look for LDAP filter strings built via string concatenation or format strings containing request parameters.

Remediation

Use LDAP escaping functions to sanitize input before including in filters.

Vulnerable (Java):

String filter = "(&(uid=" + username + ")(userPassword=" + password + "))";
DirContext ctx = new InitialDirContext(env);
ctx.search(baseDN, filter, controls);

Safe (Java):

String filter = "(&(uid={0})(userPassword={1}))";
// Use parameterized search with MessageFormat or escaping
String safeFilter = "(&(uid=" + LdapEncoder.encode(username) + "))";
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.