ldapLightweight Directory Access Protocol v3 (ASN.1 BER)Directory Binds & BloodHound-Style Recon Queries (pc <-> dc ldap TCP 389)
What It Does on the Wire
Test Active Directory reconnaissance detections (filter "(adminCount=1)") and anonymous bind alerts over TCP 389 with real ASN.1 BER sequences and zero Domain Controller required.
Lightweight Directory Access Protocol (ldap, RFC 4511) queries user accounts, security groups, and organizational units in Microsoft Active Directory and OpenLDAP over TCP port 389 (or Global Catalog port 3268). Unlike HTTP or SMTP, LDAP is a binary ASN.1 BER protocol.
FrameAssembly encodes valid ASN.1 BER LDAPMessage sequences for bindreq, bindres, searchreq, searchentry, searchdone, and unbindreq—allowing cybersecurity teams to simulate BloodHound/SharpHound-style reconnaissance filters, cleartext simple binds, or resultcode 49 (invalidCredentials) failures without running enumeration tools on a production domain.
Test Active Directory Reconnaissance & BloodHound NDR Signatures
Craft ldap searchreq frames carrying high-signal filters ("(adminCount=1)", "(servicePrincipalName=*)") to verify SOC/NDR directory-enumeration alerts.
Detect Insecure Cleartext LDAP Simple Binds (Port 389)
Simulate ldap bindreq traffic on TCP 389 to confirm monitoring alerts catch applications that still need migration to LDAPS (636).
Validate resultcode 49 (invalidCredentials) Brute-Force Rules
Pair bindreq with bindres resultcode 49 to test failed-bind alerting across Linux/AD authentication proxies.
Minimal Quickstart (ldap_quickstart.frasm)
Hit Preview Packets to compile in-browser and eyeball timestamps + wire byte lengths, or ship it straight to the Playground.
host app_srv { ip 10.10.30.25 }host dc01 { ip 10.10.0.10 }compile { app_srv -> dc01 tcp syn srcport 51389 dstport 389 wait 1ms app_srv <- dc01 tcp syn ack wait 1ms app_srv -> dc01 tcp ack wait 1ms app_srv -> dc01 ldap bindreq msgid 1 basedn "cn=svc_portal,ou=Services,dc=corp,dc=internal" wait 2ms app_srv <- dc01 ldap bindres msgid 1 resultcode 0}What the Compiler Calculates So You Don't Have To
- Defaults to TCP destination port
389(psh ack) and wraps every operation in an ASN.1 BERSEQUENCE(0x30) with exact definite-length tags. - Encodes RFC 4511 protocolOp tags (
0x60BindRequest,0x61BindResponse,0x63SearchRequest,0x64SearchResultEntry,0x65SearchResultDone,0x42UnbindRequest). - Encodes LDAP search filters (
filter) so Wireshark displays the Base DN and filter expression cleanly.
AD Bind Failure (49), Authorized Bind, Privileged Group Search & Unbind
Captures a rejected bind (resultcode 49), a successful bind (resultcode 0), an (adminCount=1) privileged-account search returning an entry + searchdone, and a clean unbindreq.
host jump_ws { ip 172.16.30.44 }host ad_dc { ip 172.16.1.10 }compile { jump_ws -> ad_dc tcp syn srcport 52389 dstport 389 win 65535 mss 1460 wait 1ms jump_ws <- ad_dc tcp syn ack win 65535 mss 1460 wait 1ms jump_ws -> ad_dc tcp ack wait 1ms // 1. Failed Simple Bind -> resultcode 49 (invalidCredentials) jump_ws -> ad_dc ldap bindreq msgid 1 basedn "cn=backup_ro,dc=corp,dc=internal" wait 2ms jump_ws <- ad_dc ldap bindres msgid 1 resultcode 49 wait 5ms // 2. Successful Bind -> Search privileged accounts -> Unbind jump_ws -> ad_dc ldap bindreq msgid 2 basedn "cn=backup_ro,dc=corp,dc=internal" wait 2ms jump_ws <- ad_dc ldap bindres msgid 2 resultcode 0 wait 2ms jump_ws -> ad_dc ldap searchreq msgid 3 basedn "dc=corp,dc=internal" filter "(adminCount=1)" wait 3ms jump_ws <- ad_dc ldap searchentry msgid 3 basedn "cn=Domain Admins,cn=Users,dc=corp,dc=internal" wait 1ms jump_ws <- ad_dc ldap searchdone msgid 3 resultcode 0 wait 2ms jump_ws -> ad_dc ldap unbindreq msgid 4}# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show ldap_ad_search_audit.frasm
# 2. Compile .frasm -> classic .pcap (tcpdump/tcpreplay/Suricata) or nanosecond .pcapng
frameassembly ldap_ad_search_audit.frasm ldap_ad_search_audit.pcap
frameassembly ldap_ad_search_audit.frasm ldap_ad_search_audit.pcapng
# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse ldap_ad_search_audit.pcap ldap_ad_search_audit_edited.frasmAll ldap Keywords & Header Options
Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after ldap:
src_host -> dst_host ldap [msgid <number>] [bindreq | bindres | searchreq | searchentry | searchdone | unbindreq] [basedn "<text>"] [filter "<text>"] [resultcode <number>]| Keyword / Option | Accepted Value | Default | Effect on Packet |
|---|---|---|---|
| bindreq | bindres | searchreq | searchentry | searchdone | unbindreq | LDAPv3 protocol operation keyword | searchreq | Selects the ASN.1 BER protocolOp tag inside LDAPMessage. |
| msgid <number> | LDAP MessageID integer (1, 2, 3...) | 1 | Correlates asynchronous LDAP requests (searchreq) with replies (searchentry, searchdone). |
| basedn "<text>" | Quoted Distinguished Name ("dc=corp,dc=internal") | "dc=example,dc=com" | Sets the Bind DN on bindreq, Base Object on searchreq, or Object Name on searchentry. |
| filter "<text>" | Quoted LDAP search filter ("(objectClass=*)", "(sAMAccountName=jdoe)") | "(objectClass=*)" | Encodes the filter inside searchreq frames. |
| resultcode <number> | RFC 4511 LDAPResult code (0 success, 32 noSuchObject, 49 invalidCredentials, 50 insufficientAccessRights) | 0 (success) | Sets the ENUMERATED result code in bindres and searchdone replies. |
Cross-Layer Wrappers Valid with ldap
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
11 options
Cross-Layer Wrappers Valid with ldap
802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol
| Option | Range / Format | Default | Effect on Packet |
|---|---|---|---|
| wait <number><ns|us|ms|s|m> | Time gap (ns, us, ms, s, m) | 10ms | Advances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back). |
| payload "<text>" | hexpayload "<hex>" | Quoted text or hex bytes (choose one) | Omitted | Appends or overrides raw payload bytes ("deadbeef" or "de:ad:be:ef") and updates packet lengths and checksums. |
| srcmac <mac> | dstmac <mac> | Colon, hyphen, or Cisco dot MAC | Host MAC / RFC multicast MAC | Overrides the 14-byte Ethernet II source or destination MAC address for this single packet. |
| vlan <0..4095> [pcp <0..7>] [dei <0|1>] | VLAN ID 0..4095, PCP 0..7, DEI 0..1 | Untagged | Wraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority. |
| qinq <0..4095> [innervlan <0..4095>] | Outer S-VLAN 0..4095, Inner C-VLAN 0..4095 | Untagged (innervlan 1 when qinq is set) | Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100). |
| mpls <0..1048575> [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>] | Label 0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255 | Unlabeled (at most 1 mpls tag per packet) | Inserts a 32-bit MPLS label header (0x8847) ahead of the Layer 3 header. |
| ttl <0..255> [dscp <0..63>] [ecn <0..3>] | TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3 | ttl 64, dscp 0, ecn 0 | Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings. |
| ipid <0..65535> [df] [mf] [fragoffset <0..8191>] | IPv4 ID, DF/MF flags, fragment offset 0..8191 | ipid 1, flags 0, fragoffset 0 | Sets IPv4 Identification, Do-Not-Fragment (df), More-Fragments (mf), and fragment offset (ignored over IPv6). |
| flowlabel <0..1048575> | 20-bit IPv6 Flow Label (0..1048575) | 0 | Sets the 20-bit IPv6 Flow Label for ECMP routing tests (ignored when running over IPv4 hosts). |
| srcport <0..65535> | dstport <0..65535> | Port number 0..65535 | srcport 49152 (remembered), TCP 389 | Overrides source or destination port and remembers the port pair automatically on <- replies. |
| seq <number> | acknum <number> | win <0..65535> | syn | ack | psh | fin | rst | TCP sequence/ack numbers, window size, flags & RFC 7323 options | psh ack, win 65535, automatic TCP seq/acknum | Overrides automatic TCP sequence tracking, flags, or RFC 7323 options (mss, wscale, sackperm, tsval, tsecr). |
Gotchas & Quick Fixes
Match msgid Between Request and Response Pairs
a -> b ldap searchreq msgid 3 ...
a <- b ldap searchdone msgid 3 resultcode 0Increment msgid for each new request (1, 2, 3) and echo the same msgid on its bindres, searchentry, and searchdone replies.