Repository navigation
ENG-8829 fix(network-ops): run relay/coercion tools as streaming listeners, not 30s force-kills - #177
Merged
Merged
Conversation
…t 30s force-kills (ENG-8829) krbrelayx_relay, certipy's relay action, and the standalone impacket_ntlmrelayx are long-running listeners, but ran under execute()'s short blocking timeout: the process group was force-killed at the deadline and the call reported as a timeout failure, so a relay could never stay up long enough to catch a relayed/coerced authentication. Add a shared _relay.py that streams a listener's stdout and: - returns early on a tool-specific success line (patterns verified against the real krbrelayx/certipy source); - on no match, distinguishes still-listening-at-timeout (returns the captured output — catching nothing is a result, not an error) from a self-exit (non-zero raises, a clean exit returns a note); - caps retained output so a verbose relay can't blow up memory/context; - redacts credentials from the command it logs. Wire the three listener tools to it with a per-call relay_timeout. Leave the one-shot coercion triggers (printerbug, petitpotam, etc.) unchanged, documented as triggers rather than listeners. Bump network-ops to 2.1.9 and add tests, including a real-subprocess timeout/kill test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
krbrelayx_relay, certipy'srelayaction, and the standaloneimpacket_ntlmrelayxare long-running listeners, but they ran underexecute()'s short blocking timeout: at the deadline the process group was force-killed and the call reported as a timeout failure. A relay could never stay up long enough to catch a relayed/coerced authentication.This ports the async stdout-reader pattern (already used by
impacket_ntlmrelay_attack) into a shared helper and wires the three listener tools to it.What changed
tools/_relay.py—stream_listener()streams a listener's stdout and:RuntimeError; a clean exit returns a note). This restores the failure signalexecute()used to give on a crash;-p,-hashes,--aeskey) from the command it logs.krbrelayx_relay, certipyrelay, standaloneimpacket_ntlmrelayxnow stream via the helper with a per-callrelay_timeout.krbrelayx_printer_bug, petitpotam, etc.) — documented as one-shot triggers, not listeners (the ticket describedprinter_bugas a listener; it isn't).FAILEDauth line.network-opsbumped to2.1.10.Testing
just validatepasses; the!checks are environment binaries not installed in CI.Known limitation
The live Windows coercion end-to-end (a real target coerced → authenticates back → listener catches it) isn't exercised here — it needs a Windows host (print spooler / EFSRPC), which the Linux sandbox can't be. The design bounds the downside: a missed/early pattern degrades to "returns the full captured output at the timeout," never a lost or mislabeled result. A minor trailer-wording dedup was split out as a follow-up (ENG-8882).