wmi/dcom: respect proxy in dcerpc.Dial sites#21
Open
aimogging wants to merge 2 commits intomandiant:mainfrom
Open
wmi/dcom: respect proxy in dcerpc.Dial sites#21aimogging wants to merge 2 commits intomandiant:mainfrom
aimogging wants to merge 2 commits intomandiant:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
wmiexec, wmiquery, wmipersist, and dcomexec called upstream
go-msrpc/dcerpc.Dial directly with no WithDialer option, so connections
fell back to net.Dialer. That bypassed both the SOCKS5 dialer that -proxy
and ALL_PROXY configure, and the libc connect() hook that proxychains
relies on. Tools that go through pkg/dcerpc.DialTCP (secretsdump et al.)
were unaffected.
Add a DialContext method to transport.Dialer so it satisfies the upstream
dcerpc.Dialer interface, then pass dcerpc.WithDialer(&transport.Dialer{})
into every dcerpc.Dial call in the four affected tools (the EPM connect
on 135 and the OXID-resolved high-port connect).
Verified end-to-end against a live target: -proxy, ALL_PROXY, and
proxychains all succeed and tcpdump on the egress interface shows zero
packets to the target on port 135.
5d4ae9c to
0406637
Compare
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.
Thanks for maintaining gopacket. Ran into a small bug while driving it through a SOCKS5 proxy and (claude) put together a fix.
Running
gopacket-wmiexecthrough SOCKS5, all three proxy mechanisms (-proxy,proxychains,ALL_PROXY) silently bypassed.tcpdumpshowed SYNs heading straight to the target on 135.wmiquery,wmipersist, anddcomexecexhibit the same behavior. All four call upstreamdcerpc.Dialwithout aWithDialeroption, so it falls back tonet.Dialerand skips both proxy paths. Looks like these four were missed when SOCKS5 support landed.The fix adds a
DialContextmethod topkg/transport.Dialer(additive; the existingDialis untouched) and passesdcerpc.WithDialer(&transport.Dialer{})into everydcerpc.Dialsite in the four tools. Hanging it off the existingDialerrather than per-tool adapters means any future go-msrpc-based tool picks up proxy support automatically. Verified end-to-end:wmiexecsucceeds through all three proxy mechanisms,wmiqueryreturns query rows,dcomexecreaches the target (its DCOM-layer errors are pre-existing and unrelated). Regression-checkedrpcdumpandsmbclientdirect and proxied.tcpdumpon the egress interface captured zero packets to the target across every proxied run.Open to a different shape if you'd prefer (per-tool adapters, a separate
ContextDialertype, etc.).