-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New function? Port forwarding #126
Comments
I think it could be interesting, but beside You mentioned If you have nc -c 'nc example.com 80' -lp 8080 But how would you do it with plain Bash for example? |
@cyrus-and If you already have a reverse shell ( Alternatively, if you re-purpose your reverse shell listener, you can bridge two tcp servers through the pivot. I.e.
|
Hmm yes, the point is that |
@cyrus-and As my example demonstrates; it may not be exact, but the effect can be reconstructed and the goal satisfied. Thus my suggestion to rename the function as a "network pivot" as this is generalized to cover both variations. One side, like socat, ssh, and some variations of netcat, which allow for binding on a port; and the other with bash and weaker variants of netcat which do not. The latter is independently useful as it doesn't require you to bind on the pivot and be able to communicate to it directly, you can have it connect out to you. If you need many connections, you can automate this as you like for the respective context. |
Yes, I see your point and the "network pivot" suggestion actually does make sense. Let me clarify, in my previous comment I was only pointing out with
Plus Also in your Having said that I think that a "network pivot" function could be interesting, we just need to figure out how to add concise and reusable examples that can be used in common scenarios. |
I'd treat the bindless pivot not so differently to the usual reverse shell, the server listens for their connection. Cat can be removed as a dependency but it looks like a mess of read/printf may be necessary to create a polyfill which acts properly like cat including nulls and newlines without choking on large packets. I was hoping something like |
I don't think it's a problem of closing the fd, rather it's a matter of having no one that actually performs read/write on that file descriptors. I might be wrong though... I wonder if a real pure |
The hacky cat alternative produced in #bash on Freenode by pj appears to work. I've tested up to a 512M random file. This is as expected, quite a bit slower, but works.
|
Oh nice, I didn't know |
ssh, nc/ncat/socat/openssl, bash /dev/tcp redirects, et al can be used to forward ports to access more systems.
If you have a 3-machine ssh-chain, say A->B->C, where B->C is a forced ssh command, then unless the forced command includes
-e none
you can interact with this second client using~~C
(a tilde per ssh client in the chain) to add-L
,-R
, and-D
forwards. It is common for servers with forced commands to block port forwarding, but easy to not know about the escape sequence which effectively re-enables them under this (rare) configuration.The text was updated successfully, but these errors were encountered: