Skip to content

Fix Kerberos auth, target-file mounts, and DNS hangs in Docker run - #126

Merged
aconite33 merged 1 commit into
blacklanternsecurity:masterfrom
Sw3d1shPh1sh:fix/kerberos-docker-mounts-and-timeouts
Oct 13, 2026
Merged

aconite33 merged 1 commit into
blacklanternsecurity:masterfrom
Sw3d1shPh1sh:fix/kerberos-docker-mounts-and-timeouts

Conversation

@Sw3d1shPh1sh

Copy link
Copy Markdown
Contributor

Summary

  • manspider.sh: mount the invoking user's real home directory read-only so absolute target-file and ccache paths resolve inside the container, mount cwd at /work so relative target-list files resolve too, and pass through KRB5CCNAME/krb5.conf when present on the host. Still pulls the published blacklanternsecurity/manspider image by default; set MANSPIDER_LOCAL_BUILD=1 to instead build and run from a local checkout.
  • manspider.py: validate Kerberos ccache availability up front with a clear error instead of failing silently deep in impacket, and add -K/--ccache to point at a specific ccache file directly (bypasses sudo stripping KRB5CCNAME, and overrides any existing KRB5CCNAME).
  • smb.py/util.py: add run_with_timeout() and use it around SMBConnection() and kerberosLogin() — impacket's own timeout= kwarg only bounds the TCP connect/recv phase, not DNS resolution (socket.getaddrinfo()), so an unreachable/garbage target could hang for minutes with no indication anything was wrong. Also stop re-attempting Kerberos on the guest/null session fallback, and warn (rather than silently swallow) when a target-list file can't be opened.

Test plan

  • Manual run against a real target list file and Kerberos ccache to confirm the original "exits without warning" / "file target list processes as file:445" bugs are fixed
  • Confirm an unreachable/garbage target now times out with a clear message instead of hanging
  • MANSPIDER_LOCAL_BUILD=1 ./manspider.sh --help still builds and runs correctly

- manspider.sh: mount the invoking user's real home directory read-only
  so absolute target-file and ccache paths resolve inside the container,
  mount cwd at /work so relative target-list files resolve too, and pass
  through KRB5CCNAME/krb5.conf when present on the host. Still pulls the
  published blacklanternsecurity/manspider image by default; set
  MANSPIDER_LOCAL_BUILD=1 to instead build and run from this checkout's
  source (e.g. when testing local patches before they're released).
- manspider.py: validate Kerberos ccache availability up front with a
  clear error instead of failing silently deep in impacket, and add
  -K/--ccache to point at a specific ccache file directly (bypasses
  sudo stripping KRB5CCNAME, and overrides any existing KRB5CCNAME).
- smb.py/util.py: add run_with_timeout() and use it around
  SMBConnection() and kerberosLogin() -- impacket's own timeout= kwarg
  only bounds the TCP connect/recv phase, not DNS resolution
  (socket.getaddrinfo()), so an unreachable/garbage target could hang
  for minutes with no indication anything was wrong. Also stop
  re-attempting Kerberos on the guest/null session fallback, and warn
  (rather than silently swallow) when a target-list file can't be
  opened.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@aconite33
aconite33 merged commit 932aae1 into blacklanternsecurity:master Oct 13, 2026
5 checks passed
aconite33 added a commit that referenced this pull request Oct 13, 2026
…-mounts-and-timeouts"

This reverts commit 932aae1, reversing
changes made to 4f69984.
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