wmi/dcom: respect proxy in dcerpc.Dial sites#21
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
|
Hi @Not exactly! Checking in on this PR - it's been open for 12 days without any reviews. Just wanted to bump it for visibility. Happy to make any changes if you have feedback! |
|
👋 Hi @mandiant/gopacket - this PR has been open for 14 days with no review feedback. Just checking in — is there anything I can help with to move this forward? |
|
Hi! Just checking in — this PR has been open for 13+ days without any reviews. Happy to make changes or clarify anything. Thanks for considering it! |
|
Thanks for catching this and writing it up so clearly. PR #26 just merged and ended up covering this. Lab testing surfaced two additional leak layers: gokrb5.fork/v9 KDCDialer for the Kerberos handshake inside the proxied dcerpc connection, and go-msrpc's pre-dial Separately, the Appreciate the careful writeup and the offer to take feedback on shape. Hope to see more contributions. |
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.).