ldap-injection-anti-pattern

Detect LDAP injection vulnerabilities and provide secure escaping examples in Python, Java, C#, and Node.js.

8|1|Updated Jan 19, 2026
One-click install
npx skills add https://github.com/igbuend/grimbard --skill ldap-injection-anti-pattern
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ldap-injection-anti-pattern
Source: https://github.com/igbuend/grimbard/tree/main/skills/ldap-injection-anti-pattern
Command: npx skills add https://github.com/igbuend/grimbard --skill ldap-injection-anti-pattern

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the critical security vulnerability of LDAP injection, which can lead to unauthorized data access, authentication bypass, and system compromise by preventing the insecure construction of LDAP queries with user-supplied input.

Core Features & Use Cases

  • Vulnerability Detection: Identifies instances where user input is directly concatenated into LDAP filters without proper escaping.
  • Secure Coding Guidance: Provides clear "BAD" and "GOOD" code examples across multiple languages (Python, Java, C#, Node.js) demonstrating secure escaping techniques and the use of bind operations for authentication.
  • Use Case: A developer is building a user authentication system that queries an LDAP directory. This Skill helps them ensure that usernames and passwords are handled securely, preventing attackers from manipulating the LDAP query to gain unauthorized access.

Quick Start

Review the provided code examples to understand how to securely escape user input when constructing LDAP filters.

Frequently Asked Questions about ldap-injection-anti-pattern

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent LDAP injection vulnerabilities in my application?

To prevent LDAP injection vulnerabilities, always properly escape special characters in user input before constructing LDAP filters. This approach stops attackers from manipulating queries to bypass authentication or access unauthorized directory data.

How does LDAP injection work and when do I need to secure my queries?

LDAP injection occurs when user-supplied input is directly concatenated into LDAP filters without proper escaping, allowing attackers to manipulate the query logic. You must secure queries whenever external input is used to search or authenticate against an LDAP directory.

Can I see secure LDAP filter construction examples in Python, Java, C#, and Node.js?

Yes, secure LDAP filter construction examples are provided for Python, Java, C#, and Node.js. These examples demonstrate proper escaping techniques using library functions and recommend using bind operations for authentication to prevent injection.

What is the best way to securely handle user authentication against an LDAP directory?

The best way to securely handle user authentication against an LDAP directory is to use bind operations rather than constructing filters with user credentials. This method validates credentials directly with the directory server, preventing authentication bypass attacks.

Does this approach address CWE-90 and related injection flaws in LDAP implementations?

Yes, this approach directly addresses CWE-90 and related injection flaws in LDAP implementations. It identifies insecure query construction and enforces proper special character escaping across Python, Java, C#, and Node.js environments to eliminate vulnerabilities.