Skip to content

Improve --scan-all-computers timeout handling and configurability#20

Closed
jazofra wants to merge 3 commits into
SpecterOps:mainfrom
jazofra:claude/fix-scan-all-computers-6qH2f
Closed

Improve --scan-all-computers timeout handling and configurability#20
jazofra wants to merge 3 commits into
SpecterOps:mainfrom
jazofra:claude/fix-scan-all-computers-6qH2f

Conversation

@jazofra
Copy link
Copy Markdown
Contributor

@jazofra jazofra commented May 12, 2026

Summary

Fixes --scan-all-computers runs that could appear stuck near the end of enumeration and makes the blind computer sweep more configurable.

The main issue was that --scan-all-computers could leave the concurrent worker pool waiting forever if one target became stuck in a nested SQL, LDAP, DNS, or Windows SID lookup path. This PR adds bounded timeout behavior around the risky paths and adds an outer per-server worker timeout so one wedged target cannot prevent the run from completing.

This also improves scan-all behavior. SPN-discovered SQL Servers still preserve their AD-advertised port or instance. Blindly enumerated domain computers continue to default to TCP 1433, but operators can now provide additional candidate ports and tune the TCP reachability timeout.

Changes

  • Added direct LDAP dial deadlines so LDAP fallback setup cannot block before LDAP operation timeouts apply.
  • Added a bounded Windows computer SID lookup wrapper.
  • Added an outer per-server worker timeout so blocked nested calls return a failed result instead of holding the worker pool open.
  • Added --scan-all-computer-ports, defaulting to 1433, for scanning additional candidate SQL ports on domain computers.
  • Added --port-check-timeout, defaulting to 2 seconds, for TCP reachability checks.
  • Preserved existing default behavior when the new flags are not provided.
  • Added regression tests for port parsing, scan-all computer target expansion, Windows SID timeout behavior, and worker timeout behavior.
  • Updated the saved project plan and lessons for the timeout patterns found during investigation.

Validation

  • go test ./...
  • go build ./cmd/mssqlhound

claude added 3 commits May 12, 2026 08:15
…computers is more configurable

The main issue was that --scan-all-computers could leave the concurrent worker pool waiting forever if one target became stuck in a nested SQL, LDAP, DNS, or Windows SID lookup path. This PR adds bounded timeout behavior around the risky paths and adds an outer per-server worker timeout so one wedged target cannot prevent the run from completing.

This also clarifies and improves scan-all behavior. SPN-discovered SQL Servers still preserve their AD-advertised port or instance. Blindly enumerated domain computers continue to default to TCP 1433, but operators can now provide additional candidate ports and tune the TCP reachability timeout.

Changes
Added direct LDAP dial deadlines so LDAP fallback setup cannot block before LDAP operation timeouts apply.
Added a bounded Windows computer SID lookup wrapper.
Added an outer per-server worker timeout so blocked nested calls return a failed result instead of holding the worker pool open.
Added --scan-all-computer-ports, defaulting to 1433, for scanning additional candidate SQL ports on domain computers.
Added --port-check-timeout, defaulting to 2 seconds, for TCP reachability checks.
Preserved existing default behavior when the new flags are not provided.
Added regression tests for port parsing, scan-all computer target expansion, Windows SID timeout behavior, and worker timeout behavior.
Adds the new scan-all flags to the Target Selection table and to the
Full Domain Enumeration examples, and notes the per-server worker
timeout that prevents a wedged target from holding the pool open.
principal.Name from sys.server_principals is always DOMAIN\account for
Windows logins. The AD node creation loop was using that form directly,
producing DOMAIN\account@DOMAIN.COM instead of BloodHound's expected
account@DOMAIN.COM convention.

Strip the NETBIOS prefix before appending the UPN suffix, mirroring the
identical pattern already present in the service-account node block.
@jazofra jazofra closed this May 28, 2026
@jazofra jazofra deleted the claude/fix-scan-all-computers-6qH2f branch May 28, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants